scb-wc-test 0.1.142 → 0.1.144
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/mvc/components/scb-card/scb-card.js +26 -32
- package/mvc/components/scb-header/scb-header-tab.js +2 -2
- package/mvc/components/scb-header/scb-header.js +33 -16
- package/mvc/components/scb-menu/scb-menu.js +4 -4
- package/package.json +2 -2
- package/scb-card/scb-card.d.ts +2 -0
- package/scb-card/scb-card.js +88 -87
- package/scb-header/scb-header-tab.d.ts +1 -0
- package/scb-header/scb-header-tab.js +19 -16
- package/scb-header/scb-header.d.ts +1 -0
- package/scb-header/scb-header.js +112 -94
- package/scb-menu/scb-menu.d.ts +3 -0
- package/scb-menu/scb-menu.js +72 -45
- package/scb-wc-test.bundle.js +293 -282
|
@@ -1,11 +1,11 @@
|
|
|
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 v}from"../../vendor/preload-helper.js";import{a as x,n as o,i as $,x as a,t as
|
|
2
|
+
import{_ as v}from"../../vendor/preload-helper.js";import{a as x,n as o,i as $,x as a,t as k}from"../../vendor/vendor.js";import"../../vendor/vendor-material.js";import"../scb-list/scb-list.js";import"../scb-button/scb-button.js";import"../scb-icon-button/scb-icon-button.js";import"../scb-link/scb-link.js";import"../scb-avatar/scb-avatar.js";import"../scb-list/scb-list-item.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,c,n){try{customElements.get(s)||t(s,c,n)}catch(d){var l=String(d||"");if(l.indexOf("already been used")===-1&&l.indexOf("NotSupportedError")===-1)throw d}}}}catch{}})();var _=Object.defineProperty,z=Object.getOwnPropertyDescriptor,y=e=>{throw TypeError(e)},r=(e,t,s,c)=>{for(var n=c>1?void 0:c?z(t,s):t,l=e.length-1,d;l>=0;l--)(d=e[l])&&(n=(c?d(t,s,n):d(n))||n);return c&&n&&_(t,s,n),n},w=(e,t,s)=>t.has(e)||y("Cannot "+s),S=(e,t,s)=>t.has(e)?y("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,s),g=(e,t,s)=>(w(e,t,"access private method"),s),u,b;let i=class extends ${constructor(){super(...arguments),S(this,u),this.type="",this.variant="",this.direction="",this.mediaType="",this.mediaHref="",this.mediaAlt="",this.mediaSrcset="",this.mediaSizes="",this.mediaLoading="auto",this.mediaDecoding="async",this.mediaFetchPriority="auto",this.mediaFit="cover",this.mediaPosition="center",this.mediaWidth="",this.mediaHeight="",this.mediaAspect="",this.mediaPlaceholder=!1,this.cardHref="",this.title="",this.subtitle="",this.supportingText="",this.commentsText="",this.comments=0,this.commentsHref="",this.likesText="",this.likes=0,this.hasLiked=!1,this.likesInteractive=!1,this.sizing="stretch",this.width="",this.maxWidth="",this.height="",this.maxHeight="",this.spacing="",this.spacingTop="",this.spacingBottom="",this.__onImgLoad=e=>{const t=e.currentTarget.closest(".media");t&&t.classList.add("is-loaded")},this.__onKeyDown=e=>{const t=(this.cardHref||"").trim();t&&(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),window.location.assign(t))},this.__handleHrefNavigation=e=>{const t=(this.cardHref||"").trim();!t||e.button!==0||e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||e.target?.closest("a, button, input, select, textarea, summary")||window.location.assign(t)}}get __isLinkCard(){if(!(this.cardHref||"").trim())return!1;const t=(this.type||"").toLowerCase();return t==="standard"||t==="social"}__calcAspectWH(e){const t=(e||"").trim();if(!t)return{w:640,h:360};const s=t.includes("/")?t.split("/"):t.includes(":")?t.split(":"):t.includes("x")?t.split("x"):null;if(s&&s.length===2){const n=Number(s[0]),l=Number(s[1]);if(n>0&&l>0)return{w:n,h:l}}const c=Number(t);return isFinite(c)&&c>0?{w:1e3,h:Math.round(1e3/c)}:{w:640,h:360}}__mediaTemplate(){if((this.mediaType||"").toLowerCase()==="avatar")return a`
|
|
3
3
|
<div class="media">
|
|
4
4
|
<slot name="media">
|
|
5
5
|
<scb-avatar variant="icon" label="${this.title}" icon-name="person"></scb-avatar>
|
|
6
6
|
</slot>
|
|
7
7
|
</div>
|
|
8
|
-
`;if(this.mediaHref||this.mediaSrcset){let t=Number(this.mediaWidth)||0,s=Number(this.mediaHeight)||0;const c=(this.mediaAspect||"").trim();if(!t||!s){const p=this.__calcAspectWH(c||"16/9");t||(t=p.w),s||(s=p.h)}const n=`aspect-ratio:${c||`${t}/${s}`};`,l=this.mediaPlaceholder?"has-ph":"",d=this.mediaFit||"cover",
|
|
8
|
+
`;if(this.mediaHref||this.mediaSrcset){let t=Number(this.mediaWidth)||0,s=Number(this.mediaHeight)||0;const c=(this.mediaAspect||"").trim();if(!t||!s){const p=this.__calcAspectWH(c||"16/9");t||(t=p.w),s||(s=p.h)}const n=`aspect-ratio:${c||`${t}/${s}`};`,l=this.mediaPlaceholder?"has-ph":"",d=this.mediaFit||"cover",h=this.mediaPosition||"center";return a`
|
|
9
9
|
<div class="media ${l}" style="${n}">
|
|
10
10
|
<slot name="media-sources"></slot>
|
|
11
11
|
<img
|
|
@@ -16,13 +16,13 @@ import{_ as v}from"../../vendor/preload-helper.js";import{a as x,n as o,i as $,x
|
|
|
16
16
|
loading="${this.mediaLoading}"
|
|
17
17
|
decoding="${this.mediaDecoding}"
|
|
18
18
|
fetchpriority="${this.mediaFetchPriority}"
|
|
19
|
-
style="object-fit:${d};object-position:${
|
|
19
|
+
style="object-fit:${d};object-position:${h};"
|
|
20
20
|
width="${t}"
|
|
21
21
|
height="${s}"
|
|
22
22
|
@load=${this.__onImgLoad}
|
|
23
23
|
/>
|
|
24
24
|
</div>
|
|
25
|
-
`}return null}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}render(){const e=this.variant?`${this.variant.toLowerCase()}`:"",t=this.type==="list"?"vertical":this.direction?this.direction.toLowerCase():"",s=this.__isLinkCard,c=s?"clickable":"",n=this.date instanceof Date?this.date.toISOString().slice(0,10):this.date||"",l=(p=!1)=>p?a`<span class="title">${this.title}</span><md-icon>arrow_forward</md-icon>`:a`<span class="title">${this.title}</span>`,d=()=>this.__mediaTemplate(),
|
|
25
|
+
`}return null}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}render(){const e=this.variant?`${this.variant.toLowerCase()}`:"",t=this.type==="list"?"vertical":this.direction?this.direction.toLowerCase():"",s=this.__isLinkCard,c=s?"clickable":"",n=this.date instanceof Date?this.date.toISOString().slice(0,10):this.date||"",l=(p=!1)=>p?a`<span class="title">${this.title}</span><md-icon>arrow_forward</md-icon>`:a`<span class="title">${this.title}</span>`,d=()=>this.__mediaTemplate(),h=p=>a`
|
|
26
26
|
<div
|
|
27
27
|
class="scb-card ${e} ${t} ${c}"
|
|
28
28
|
@click=${s?this.__handleHrefNavigation:null}
|
|
@@ -37,7 +37,7 @@ import{_ as v}from"../../vendor/preload-helper.js";import{a as x,n as o,i as $,x
|
|
|
37
37
|
${p}
|
|
38
38
|
</div>
|
|
39
39
|
${s?a`<md-focus-ring></md-focus-ring>`:""}
|
|
40
|
-
`;switch(this.type){case"standard":return
|
|
40
|
+
`;switch(this.type){case"standard":return h(a`
|
|
41
41
|
<div class="full-content">
|
|
42
42
|
<div class="top-content">
|
|
43
43
|
${this.title?a`<div class="header">${l(s)}</div>`:""}
|
|
@@ -46,7 +46,7 @@ import{_ as v}from"../../vendor/preload-helper.js";import{a as x,n as o,i as $,x
|
|
|
46
46
|
${n?a`<div class="date">${n}</div>`:""}
|
|
47
47
|
</div>
|
|
48
48
|
</div>
|
|
49
|
-
`);case"list":return
|
|
49
|
+
`);case"list":return h(a`
|
|
50
50
|
<div class="full-content">
|
|
51
51
|
<div class="top-content">
|
|
52
52
|
${this.title?a`<div class="header"><span class="title">${this.title}</span></div>`:""}
|
|
@@ -58,7 +58,7 @@ import{_ as v}from"../../vendor/preload-helper.js";import{a as x,n as o,i as $,x
|
|
|
58
58
|
<slot></slot>
|
|
59
59
|
</div>
|
|
60
60
|
</div>
|
|
61
|
-
`);case"social":const p=this.commentsHref,
|
|
61
|
+
`);case"social":const p=this.commentsHref,f=m=>{m.stopPropagation()};return h(a`
|
|
62
62
|
<div class="full-content">
|
|
63
63
|
<div class="top-content">
|
|
64
64
|
${this.title?a`<div class="header">${l(s)}</div>`:""}
|
|
@@ -68,32 +68,26 @@ import{_ as v}from"../../vendor/preload-helper.js";import{a as x,n as o,i as $,x
|
|
|
68
68
|
</div>
|
|
69
69
|
<div class="content">
|
|
70
70
|
<div class="social-metrics">
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
@click=${h=>{h.stopPropagation(),this.dispatchEvent(new CustomEvent("like-click",{bubbles:!0,composed:!0}))}}
|
|
86
|
-
@keydown=${h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),h.stopPropagation(),this.dispatchEvent(new CustomEvent("like-click",{bubbles:!0,composed:!0})))}}
|
|
87
|
-
role="button"
|
|
88
|
-
aria-label="${this.likesText||"Like"}"
|
|
89
|
-
>
|
|
90
|
-
<md-icon>thumb_up</md-icon>
|
|
71
|
+
<span class="comments" >
|
|
72
|
+
${p!==""?a`
|
|
73
|
+
|
|
74
|
+
<scb-icon-button href="${p}" tabindex="0" @click=${f} variant="standard" icon="comment" aria-label="Gå till kommentarer" tooltip="Gå till kommentarer"></scb-icon-button>
|
|
75
|
+
`:a`
|
|
76
|
+
<md-icon>comment</md-icon>
|
|
77
|
+
`}
|
|
78
|
+
<span>${this.commentsText}: ${this.comments}</span>
|
|
79
|
+
</span>
|
|
80
|
+
<span class="likes">
|
|
81
|
+
${this.likesInteractive?a`
|
|
82
|
+
<scb-icon-button variant="standard" icon="${this.hasLiked,"thumb_up"}" aria-label="${this.likesText||"Like"}" tooltip="${this.likesText||"Like"}"
|
|
83
|
+
@click=${m=>{m.stopPropagation(),this.dispatchEvent(new CustomEvent("like-click",{bubbles:!0,composed:!0}))}}
|
|
84
|
+
@keydown=${m=>{(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),m.stopPropagation(),this.dispatchEvent(new CustomEvent("like-click",{bubbles:!0,composed:!0})))}}></scb-icon-button>`:a`<md-icon>"${this.hasLiked,"thumb_up"}"</md-icon>`}
|
|
91
85
|
<span>${this.likesText}: ${this.likes}</span>
|
|
92
86
|
</span>
|
|
93
87
|
</div>
|
|
94
88
|
</div>
|
|
95
89
|
</div>
|
|
96
|
-
`);case"link":return
|
|
90
|
+
`);case"link":return h(a`
|
|
97
91
|
<div class="full-content">
|
|
98
92
|
<div class="top-content">
|
|
99
93
|
${this.title?a`<div class="header"><span class="title">${this.title}</span></div>`:""}
|
|
@@ -105,7 +99,7 @@ import{_ as v}from"../../vendor/preload-helper.js";import{a as x,n as o,i as $,x
|
|
|
105
99
|
<slot></slot>
|
|
106
100
|
</div>
|
|
107
101
|
</div>
|
|
108
|
-
`);case"action":return
|
|
102
|
+
`);case"action":return h(a`
|
|
109
103
|
<div class="full-content">
|
|
110
104
|
<div class="top-content">
|
|
111
105
|
${this.title?a`<div class="header"><span class="title">${this.title}</span></div>`:""}
|
|
@@ -117,7 +111,7 @@ import{_ as v}from"../../vendor/preload-helper.js";import{a as x,n as o,i as $,x
|
|
|
117
111
|
<slot></slot>
|
|
118
112
|
</div>
|
|
119
113
|
</div>
|
|
120
|
-
`);default:return
|
|
114
|
+
`);default:return h(a`
|
|
121
115
|
<div class="full-content">
|
|
122
116
|
<div class="top-content">
|
|
123
117
|
${this.title?a`<div class="header">${l(s)}</div>`:""}
|
|
@@ -126,7 +120,7 @@ import{_ as v}from"../../vendor/preload-helper.js";import{a as x,n as o,i as $,x
|
|
|
126
120
|
${n?a`<div class="date">${n}</div>`:""}
|
|
127
121
|
</div>
|
|
128
122
|
</div>
|
|
129
|
-
`)}}updated(e){super.updated(e),e.has("width")&&(this.width?this.style.inlineSize=this.width:this.style.removeProperty("inline-size")),e.has("maxWidth")&&(this.maxWidth?this.style.maxInlineSize=this.maxWidth:this.style.removeProperty("max-inline-size")),e.has("height")&&(this.height?this.style.blockSize=this.height:this.style.removeProperty("block-size")),e.has("maxHeight")&&(this.maxHeight?this.style.maxBlockSize=this.maxHeight:this.style.removeProperty("max-block-size")),e.has("type")&&(this.type==="list"?this.setAttribute("data-density","-2"):this.removeAttribute("data-density")),this.style.setProperty("--scb-card-media-fit",this.mediaFit||"cover"),this.style.setProperty("--scb-card-media-position",this.mediaPosition||"center"),(e.has("spacing")||e.has("spacingTop")||e.has("spacingBottom"))&&
|
|
123
|
+
`)}}updated(e){super.updated(e),e.has("width")&&(this.width?this.style.inlineSize=this.width:this.style.removeProperty("inline-size")),e.has("maxWidth")&&(this.maxWidth?this.style.maxInlineSize=this.maxWidth:this.style.removeProperty("max-inline-size")),e.has("height")&&(this.height?this.style.blockSize=this.height:this.style.removeProperty("block-size")),e.has("maxHeight")&&(this.maxHeight?this.style.maxBlockSize=this.maxHeight:this.style.removeProperty("max-block-size")),e.has("type")&&(this.type==="list"?this.setAttribute("data-density","-2"):this.removeAttribute("data-density")),this.style.setProperty("--scb-card-media-fit",this.mediaFit||"cover"),this.style.setProperty("--scb-card-media-position",this.mediaPosition||"center"),(e.has("spacing")||e.has("spacingTop")||e.has("spacingBottom"))&&g(this,u,b).call(this)}async firstUpdated(e){i.__iconLoaded||(await v(()=>import("../../vendor/vendor-material.js").then(t=>t.i),__vite__mapDeps([0,1]),import.meta.url),i.__iconLoaded=!0),i.__rippleLoaded||(await v(()=>import("../../vendor/vendor-material.js").then(t=>t.r),__vite__mapDeps([0,1]),import.meta.url),i.__rippleLoaded=!0),g(this,u,b).call(this)}};u=new WeakSet;b=function(){const e=this.mapSpacingToken(this.spacing),t=this.mapSpacingToken(this.spacingTop)??e,s=this.mapSpacingToken(this.spacingBottom)??e;t?this.style.setProperty("--scb-card-spacing-block-start",t):this.style.removeProperty("--scb-card-spacing-block-start"),s?this.style.setProperty("--scb-card-spacing-block-end",s):this.style.removeProperty("--scb-card-spacing-block-end")};i.__iconLoaded=!1;i.__rippleLoaded=!1;i.styles=x`
|
|
130
124
|
:host {
|
|
131
125
|
display: block;
|
|
132
126
|
box-sizing: border-box;
|
|
@@ -445,4 +439,4 @@ import{_ as v}from"../../vendor/preload-helper.js";import{a as x,n as o,i as $,x
|
|
|
445
439
|
.scb-card.filled .content.list ::slotted(scb-list) {
|
|
446
440
|
--scb-list-bg: var(--md-sys-color-surface-dim);
|
|
447
441
|
}
|
|
448
|
-
`;r([o({type:String,reflect:!0})],i.prototype,"type",2);r([o({type:String,reflect:!0})],i.prototype,"variant",2);r([o({type:String,reflect:!0})],i.prototype,"direction",2);r([o({type:String,attribute:"media-type"})],i.prototype,"mediaType",2);r([o({type:String,attribute:"media-href"})],i.prototype,"mediaHref",2);r([o({type:String,attribute:"media-alt"})],i.prototype,"mediaAlt",2);r([o({type:String,attribute:"media-srcset"})],i.prototype,"mediaSrcset",2);r([o({type:String,attribute:"media-sizes"})],i.prototype,"mediaSizes",2);r([o({type:String,attribute:"media-loading"})],i.prototype,"mediaLoading",2);r([o({type:String,attribute:"media-decoding"})],i.prototype,"mediaDecoding",2);r([o({type:String,attribute:"media-fetchpriority"})],i.prototype,"mediaFetchPriority",2);r([o({type:String,attribute:"media-fit"})],i.prototype,"mediaFit",2);r([o({type:String,attribute:"media-position"})],i.prototype,"mediaPosition",2);r([o({type:String,attribute:"media-width"})],i.prototype,"mediaWidth",2);r([o({type:String,attribute:"media-height"})],i.prototype,"mediaHeight",2);r([o({type:String,attribute:"media-aspect"})],i.prototype,"mediaAspect",2);r([o({type:Boolean,attribute:"media-placeholder"})],i.prototype,"mediaPlaceholder",2);r([o({type:String,attribute:"card-href",reflect:!0})],i.prototype,"cardHref",2);r([o({type:String,reflect:!0})],i.prototype,"title",2);r([o({type:String,reflect:!0})],i.prototype,"subtitle",2);r([o({type:String,attribute:"supporting-text",reflect:!0})],i.prototype,"supportingText",2);r([o({type:Date,reflect:!0})],i.prototype,"date",2);r([o({type:String,attribute:"social-comments-text",reflect:!0})],i.prototype,"commentsText",2);r([o({type:Number,attribute:"social-comments",reflect:!0})],i.prototype,"comments",2);r([o({type:String,attribute:"social-comments-href",reflect:!0})],i.prototype,"commentsHref",2);r([o({type:String,attribute:"social-likes-text",reflect:!0})],i.prototype,"likesText",2);r([o({type:Number,attribute:"social-likes",reflect:!0})],i.prototype,"likes",2);r([o({type:String,reflect:!0})],i.prototype,"sizing",2);r([o({type:String,reflect:!0})],i.prototype,"width",2);r([o({type:String,reflect:!0,attribute:"max-width"})],i.prototype,"maxWidth",2);r([o({type:String,reflect:!0})],i.prototype,"height",2);r([o({type:String,reflect:!0,attribute:"max-height"})],i.prototype,"maxHeight",2);r([o({type:String,reflect:!0})],i.prototype,"spacing",2);r([o({type:String,attribute:"spacing-top",reflect:!0})],i.prototype,"spacingTop",2);r([o({type:String,attribute:"spacing-bottom",reflect:!0})],i.prototype,"spacingBottom",2);i=r([
|
|
442
|
+
`;r([o({type:String,reflect:!0})],i.prototype,"type",2);r([o({type:String,reflect:!0})],i.prototype,"variant",2);r([o({type:String,reflect:!0})],i.prototype,"direction",2);r([o({type:String,attribute:"media-type"})],i.prototype,"mediaType",2);r([o({type:String,attribute:"media-href"})],i.prototype,"mediaHref",2);r([o({type:String,attribute:"media-alt"})],i.prototype,"mediaAlt",2);r([o({type:String,attribute:"media-srcset"})],i.prototype,"mediaSrcset",2);r([o({type:String,attribute:"media-sizes"})],i.prototype,"mediaSizes",2);r([o({type:String,attribute:"media-loading"})],i.prototype,"mediaLoading",2);r([o({type:String,attribute:"media-decoding"})],i.prototype,"mediaDecoding",2);r([o({type:String,attribute:"media-fetchpriority"})],i.prototype,"mediaFetchPriority",2);r([o({type:String,attribute:"media-fit"})],i.prototype,"mediaFit",2);r([o({type:String,attribute:"media-position"})],i.prototype,"mediaPosition",2);r([o({type:String,attribute:"media-width"})],i.prototype,"mediaWidth",2);r([o({type:String,attribute:"media-height"})],i.prototype,"mediaHeight",2);r([o({type:String,attribute:"media-aspect"})],i.prototype,"mediaAspect",2);r([o({type:Boolean,attribute:"media-placeholder"})],i.prototype,"mediaPlaceholder",2);r([o({type:String,attribute:"card-href",reflect:!0})],i.prototype,"cardHref",2);r([o({type:String,reflect:!0})],i.prototype,"title",2);r([o({type:String,reflect:!0})],i.prototype,"subtitle",2);r([o({type:String,attribute:"supporting-text",reflect:!0})],i.prototype,"supportingText",2);r([o({type:Date,reflect:!0})],i.prototype,"date",2);r([o({type:String,attribute:"social-comments-text",reflect:!0})],i.prototype,"commentsText",2);r([o({type:Number,attribute:"social-comments",reflect:!0})],i.prototype,"comments",2);r([o({type:String,attribute:"social-comments-href",reflect:!0})],i.prototype,"commentsHref",2);r([o({type:String,attribute:"social-likes-text",reflect:!0})],i.prototype,"likesText",2);r([o({type:Number,attribute:"social-likes",reflect:!0})],i.prototype,"likes",2);r([o({type:Boolean,attribute:"social-has-liked",reflect:!0})],i.prototype,"hasLiked",2);r([o({type:Boolean,attribute:"social-likes-interactive",reflect:!0})],i.prototype,"likesInteractive",2);r([o({type:String,reflect:!0})],i.prototype,"sizing",2);r([o({type:String,reflect:!0})],i.prototype,"width",2);r([o({type:String,reflect:!0,attribute:"max-width"})],i.prototype,"maxWidth",2);r([o({type:String,reflect:!0})],i.prototype,"height",2);r([o({type:String,reflect:!0,attribute:"max-height"})],i.prototype,"maxHeight",2);r([o({type:String,reflect:!0})],i.prototype,"spacing",2);r([o({type:String,attribute:"spacing-top",reflect:!0})],i.prototype,"spacingTop",2);r([o({type:String,attribute:"spacing-bottom",reflect:!0})],i.prototype,"spacingBottom",2);i=r([k("scb-card")],i);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as c,n as u,i as d,x as p,t as _}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,n,e){try{customElements.get(t)||r(t,n,e)}catch(i){var s=String(i||"");if(s.indexOf("already been used")===-1&&s.indexOf("NotSupportedError")===-1)throw i}}}}catch{}})();var f=Object.defineProperty,b=Object.getOwnPropertyDescriptor,l=(a,r,t,n)=>{for(var e=n>1?void 0:n?b(r,t):r,s=a.length-1,i;s>=0;s--)(i=a[s])&&(e=(n?i(r,t,e):i(e))||e);return n&&e&&f(r,t,e),e};let o=class extends d{constructor(){super(...arguments),this.label="",this.href="",this.menuId=""}render(){return p`<slot></slot>`}};o.styles=c`
|
|
2
2
|
:host {
|
|
3
3
|
display: none !important;
|
|
4
4
|
}
|
|
5
|
-
`;l([
|
|
5
|
+
`;l([u({type:String})],o.prototype,"label",2);l([u({type:String})],o.prototype,"href",2);l([u({type:String,attribute:"menu-id"})],o.prototype,"menuId",2);o=l([_("scb-header-tab")],o);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as w,n as h,r as g,i as x,x as d,E as u,t as S}from"../../vendor/vendor.js";import"../../vendor/vendor-material.js";import"../scb-grid/scb-grid-item.js";import"../scb-grid/scb-grid.js";import"../scb-link/scb-link.js";import"../scb-icon-button/scb-icon-button.js";import"../scb-button/scb-button.js";import"../scb-search/scb-search.js";import"../scb-drawer/scb-drawer.js";import"../scb-grid/scb-stack.js";import"../../vendor/preload-helper.js";import"../scb-list/scb-list.js";import"../scb-list/scb-list-item.js";import"../scb-divider/scb-divider.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,n,i){try{customElements.get(s)||t(s,n,i)}catch(c){var o=String(c||"");if(o.indexOf("already been used")===-1&&o.indexOf("NotSupportedError")===-1)throw c}}}}catch{}})();var C=Object.defineProperty,k=Object.getOwnPropertyDescriptor,a=(e,t,s,n)=>{for(var i=n>1?void 0:n?k(t,s):t,o=e.length-1,c;o>=0;o--)(c=e[o])&&(i=(n?c(t,s,i):c(i))||i);return n&&i&&C(t,s,i),i};const v={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="",this.logoHref="/",this.banner=!1,this.tabs=[],this.activeTab=0,this.utilityItems=[],this.showDrawer=!0,this.showSearch=!0,this.includeUtilityInDrawer=!1,this.drawerOverlay=!0,this.searchText="",this._drawerId="main-drawer",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=[],n=[],i=[];let o=-1;const c=l=>({label:l.getAttribute("label")??"",href:l.getAttribute("href")??void 0,icon:l.getAttribute("icon")??void 0});for(const l of t){const p=l.tagName.toLowerCase();if(p==="scb-header-tab"){const _=l.getAttribute("label")??"",b=l.getAttribute("href"),m=b&&b.trim()!==""?b:void 0;(l.hasAttribute("selected")||l.getAttribute("selected")==="true"||l.getAttribute("active")==="true"||l.getAttribute("aria-current")==="page")&&o===-1&&(o=s.length),s.push({label:_,href:m});continue}if(p==="scb-header-utility"){n.push({label:l.getAttribute("label")??"",href:l.getAttribute("href")??"#",target:l.getAttribute("target")??void 0});continue}if(p==="scb-header-drawer-group"){const _={label:l.getAttribute("label")??"",icon:l.getAttribute("icon")??void 0,children:[]};l.querySelectorAll("scb-header-drawer-item").forEach(m=>_.children.push(c(m))),i.push(_);continue}p==="scb-header-drawer-item"&&i.push(c(l))}this._slotTabs=s,this._slotUtils=n,this._slotMenu=i,!this.hasAttribute("active-tab")&&o>=0&&(this.activeTab=o),queueMicrotask(()=>{this.updateComplete.then(()=>{this._scheduleMeasure()})})},this._measure=()=>{const e=this._top,t=this._logoGroup;if(!e||!t)return;const s=window.innerWidth,n=e.clientWidth,i=this._overflows(this._util),o=this._overflows(this._tabsNav),c=s<this.BP_MD||i||o;this._collapsed?!c&&n>=this._unlockAtWidth&&this._setCollapsed(!1):c&&(this._unlockAtWidth=n+this._HYST,this._setCollapsed(!0));let l=!1;if(this.showSearch&&s>=this.BP_SM&&s<this.BP_MD&&this._searchWrap){const b=getComputedStyle(this._searchWrap),m=Math.max(this._num(b.minWidth,this._tokenPx("--scb-header-search-min",320)),this._tokenPx("--scb-header-search-min",320)),f=this._num(getComputedStyle(e).gap,this._tokenPx("--spacing-7",24)),y=this.showDrawer&&(s<this.BP_MD||this._collapsed)?this._menuBtn?.getBoundingClientRect().width||this._tokenPx("--icon-size-large",48):0;l=t.getBoundingClientRect().width+f+m+f+y+8>n+.5}this._setHideSearch(l);let p=!1;if(this.showDrawer&&(s<this.BP_MD||this._collapsed)&&!this._visible(this._util)&&!this._visible(this._searchWrap)){const b=this._num(getComputedStyle(e).gap,this._tokenPx("--spacing-7",24)),m=this._menuBtn?.getBoundingClientRect().width||this._tokenPx("--icon-size-large",48),f=(this._logoGroup?.getBoundingClientRect().width||0)+b+m;this._hideLogoText?p=!(n>=this._logoTextUnlockAt):f>n+.5&&(p=!0,this._logoTextUnlockAt=n+this._HYST)}else p=!1,this._logoTextUnlockAt=0;this._setHideLogoText(p)},this._onMenuClick=async e=>{e.preventDefault(),e.stopPropagation(),this.showDrawer&&(this.dispatchEvent(new CustomEvent("menu-click",{bubbles:!0,composed:!0})),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??"";this.searchText=s,this.dispatchEvent(new CustomEvent("search-click",{detail:{value:s},bubbles:!0,composed:!0})),t?.focus?.()},this._onTabClick=e=>{const t=e.currentTarget;if(!t)return;const s=t.tagName.toLowerCase()==="a";if(s&&(e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey))return;const n=t.getAttribute("data-index"),i=n!=null?Number(n):0;this.activeTab=i;const l=((this._slotTabs.length?this._slotTabs:this.tabs)[i]??{}).href??"",p=new CustomEvent("tab-change",{detail:{index:i,href:l},bubbles:!0,composed:!0,cancelable:!0});!this.dispatchEvent(p)&&s&&e.preventDefault()},this._onTabsKeydown=e=>{const t=e.key;if(t!=="ArrowLeft"&&t!=="ArrowRight"&&t!=="Home"&&t!=="End")return;const s=Array.from(this.renderRoot.querySelectorAll(".tab-link"));if(!s.length)return;const n=e.target;let i=s.indexOf(n??s[0]);i===-1&&(i=0),t==="ArrowRight"?i=(i+1)%s.length:t==="ArrowLeft"?i=(i-1+s.length)%s.length:t==="Home"?i=0:t==="End"&&(i=s.length-1),e.preventDefault();const o=s[i];o.focus();const c=o.getAttribute("data-index"),l=c!=null?Number(c):i;this.activeTab=l},this._onSearchInput=e=>{this.searchText=e.detail?.value??"",this.dispatchEvent(new CustomEvent("search-input",{detail:{value:this.searchText},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("search-text-change",{detail:{value:this.searchText},bubbles:!0,composed:!0}))},this._onSearchSubmit=e=>{this.searchText=e.detail?.value??"",this.dispatchEvent(new CustomEvent("search-change",{detail:{value:this.searchText,active:e.detail?.active},bubbles:!0,composed:!0}))},this._onSearchClear=()=>{this.searchText="",this.dispatchEvent(new CustomEvent("search-text-change",{detail:{value:""},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 _logoGroup(){return this.renderRoot.querySelector(".logo-wrap")||this.renderRoot.querySelector(".logo-group")}get _searchWrap(){return this.renderRoot.querySelector(".search")}get _menuBtn(){return this.renderRoot.querySelector(".menu-trigger")}get _searchEl(){return this.renderRoot.querySelector(`#${this._searchId}`)}get _tabsNav(){return this.renderRoot.querySelector(".tabs-nav")}_attachSlotObservers(){this._slotMo?.disconnect();const e=new MutationObserver(t=>{this._scheduleHarvest()});this._slotMo=e,e.observe(this,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["label","href","icon","target","selected","aria-current","active"]})}_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})}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()})}disconnectedCallback(){this._ro?.disconnect(),this._slotMo?.disconnect(),window.removeEventListener("resize",this._onWindowResize),super.disconnectedCallback()}_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))}_renderDrawerNodes(e){return!e||e.length===0?d``:d`${e.map(t=>{const s=Array.isArray(t.children)&&t.children.length>0;return d`
|
|
1
|
+
import{a as x,n as h,r as m,i as S,x as d,E as u,t as C}from"../../vendor/vendor.js";import"../../vendor/vendor-material.js";import"../scb-grid/scb-grid-item.js";import"../scb-grid/scb-grid.js";import"../scb-link/scb-link.js";import"../scb-icon-button/scb-icon-button.js";import"../scb-button/scb-button.js";import"../scb-search/scb-search.js";import"../scb-drawer/scb-drawer.js";import"../scb-grid/scb-stack.js";import"../../vendor/preload-helper.js";import"../scb-list/scb-list.js";import"../scb-list/scb-list-item.js";import"../scb-divider/scb-divider.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,n,a){try{customElements.get(s)||t(s,n,a)}catch(c){var i=String(c||"");if(i.indexOf("already been used")===-1&&i.indexOf("NotSupportedError")===-1)throw c}}}}catch{}})();var k=Object.defineProperty,$=Object.getOwnPropertyDescriptor,o=(e,t,s,n)=>{for(var a=n>1?void 0:n?$(t,s):t,i=e.length-1,c;i>=0;i--)(c=e[i])&&(a=(n?c(t,s,a):c(a))||a);return n&&a&&k(t,s,a),a};const v={fromAttribute:e=>e==null?!0:!/^(false|0|off|no)$/i.test(e),toAttribute:e=>String(!!e)};let r=class extends S{constructor(){super(...arguments),this.maxWidth="1440px",this.logoText="",this.logoHref="/",this.banner=!1,this.tabs=[],this.activeTab=0,this.utilityItems=[],this.showDrawer=!0,this.showSearch=!0,this.includeUtilityInDrawer=!1,this.drawerOverlay=!0,this.searchText="",this._drawerId="main-drawer",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=[],n=[],a=[];let i=-1;const c=l=>({label:l.getAttribute("label")??"",href:l.getAttribute("href")??void 0,icon:l.getAttribute("icon")??void 0});for(const l of t){const p=l.tagName.toLowerCase();if(p==="scb-header-tab"){const _=l.getAttribute("label")??"",b=l.getAttribute("href"),f=b&&b.trim()!==""?b:void 0,g=l.getAttribute("menu-id"),y=g&&g.trim()!==""?g:void 0;(l.hasAttribute("selected")||l.getAttribute("selected")==="true"||l.getAttribute("active")==="true"||l.getAttribute("aria-current")==="page")&&i===-1&&(i=s.length),s.push({label:_,href:f,menuId:y});continue}if(p==="scb-header-utility"){n.push({label:l.getAttribute("label")??"",href:l.getAttribute("href")??"#",target:l.getAttribute("target")??void 0});continue}if(p==="scb-header-drawer-group"){const _={label:l.getAttribute("label")??"",icon:l.getAttribute("icon")??void 0,children:[]};l.querySelectorAll("scb-header-drawer-item").forEach(f=>_.children.push(c(f))),a.push(_);continue}p==="scb-header-drawer-item"&&a.push(c(l))}this._slotTabs=s,this._slotUtils=n,this._slotMenu=a,!this.hasAttribute("active-tab")&&i>=0&&(this.activeTab=i),queueMicrotask(()=>{this.updateComplete.then(()=>{this._scheduleMeasure()})})},this._measure=()=>{const e=this._top,t=this._logoGroup;if(!e||!t)return;const s=window.innerWidth,n=e.clientWidth,a=this._overflows(this._util),i=this._overflows(this._tabsNav),c=s<this.BP_MD||a||i;this._collapsed?!c&&n>=this._unlockAtWidth&&this._setCollapsed(!1):c&&(this._unlockAtWidth=n+this._HYST,this._setCollapsed(!0));let l=!1;if(this.showSearch&&s>=this.BP_SM&&s<this.BP_MD&&this._searchWrap){const b=getComputedStyle(this._searchWrap),f=Math.max(this._num(b.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)),y=this.showDrawer&&(s<this.BP_MD||this._collapsed)?this._menuBtn?.getBoundingClientRect().width||this._tokenPx("--icon-size-large",48):0;l=t.getBoundingClientRect().width+g+f+g+y+8>n+.5}this._setHideSearch(l);let p=!1;if(this.showDrawer&&(s<this.BP_MD||this._collapsed)&&!this._visible(this._util)&&!this._visible(this._searchWrap)){const b=this._num(getComputedStyle(e).gap,this._tokenPx("--spacing-7",24)),f=this._menuBtn?.getBoundingClientRect().width||this._tokenPx("--icon-size-large",48),g=(this._logoGroup?.getBoundingClientRect().width||0)+b+f;this._hideLogoText?p=!(n>=this._logoTextUnlockAt):g>n+.5&&(p=!0,this._logoTextUnlockAt=n+this._HYST)}else p=!1,this._logoTextUnlockAt=0;this._setHideLogoText(p)},this._onMenuClick=async e=>{e.preventDefault(),e.stopPropagation(),this.showDrawer&&(this.dispatchEvent(new CustomEvent("menu-click",{bubbles:!0,composed:!0})),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??"";this.searchText=s,this.dispatchEvent(new CustomEvent("search-click",{detail:{value:s},bubbles:!0,composed:!0})),t?.focus?.()},this._onTabClick=e=>{const t=e.currentTarget;if(!t)return;const s=t.tagName.toLowerCase()==="a";if(s&&(e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey))return;const n=t.getAttribute("data-index"),a=n!=null?Number(n):0;this.activeTab=a;const c=(this._slotTabs.length?this._slotTabs:this.tabs)[a]??{},l=c.href??"",p=c.menuId??"",_=new CustomEvent("tab-change",{detail:{index:a,href:l,menuId:p},bubbles:!0,composed:!0,cancelable:!0});!this.dispatchEvent(_)&&s&&e.preventDefault()},this._onTabsKeydown=e=>{const t=e.key;if(t!=="ArrowLeft"&&t!=="ArrowRight"&&t!=="Home"&&t!=="End")return;const s=Array.from(this.renderRoot.querySelectorAll(".tab-link"));if(!s.length)return;const n=e.target;let a=s.indexOf(n??s[0]);a===-1&&(a=0),t==="ArrowRight"?a=(a+1)%s.length:t==="ArrowLeft"?a=(a-1+s.length)%s.length:t==="Home"?a=0:t==="End"&&(a=s.length-1),e.preventDefault();const i=s[a];i.focus();const c=i.getAttribute("data-index"),l=c!=null?Number(c):a;this.activeTab=l},this._onSearchInput=e=>{this.searchText=e.detail?.value??"",this.dispatchEvent(new CustomEvent("search-input",{detail:{value:this.searchText},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("search-text-change",{detail:{value:this.searchText},bubbles:!0,composed:!0}))},this._onSearchSubmit=e=>{this.searchText=e.detail?.value??"",this.dispatchEvent(new CustomEvent("search-change",{detail:{value:this.searchText,active:e.detail?.active},bubbles:!0,composed:!0}))},this._onSearchClear=()=>{this.searchText="",this.dispatchEvent(new CustomEvent("search-text-change",{detail:{value:""},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 _logoGroup(){return this.renderRoot.querySelector(".logo-wrap")||this.renderRoot.querySelector(".logo-group")}get _searchWrap(){return this.renderRoot.querySelector(".search")}get _menuBtn(){return this.renderRoot.querySelector(".menu-trigger")}get _searchEl(){return this.renderRoot.querySelector(`#${this._searchId}`)}get _tabsNav(){return this.renderRoot.querySelector(".tabs-nav")}_attachSlotObservers(){this._slotMo?.disconnect();const e=new MutationObserver(t=>{this._scheduleHarvest()});this._slotMo=e,e.observe(this,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["label","href","menu-id","icon","target","selected","aria-current","active"]})}_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})}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()})}disconnectedCallback(){this._ro?.disconnect(),this._slotMo?.disconnect(),window.removeEventListener("resize",this._onWindowResize),super.disconnectedCallback()}_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))}_renderDrawerNodes(e){return!e||e.length===0?d``:d`${e.map(t=>{const s=Array.isArray(t.children)&&t.children.length>0;return d`
|
|
2
2
|
<scb-drawer-item
|
|
3
3
|
label=${t.label}
|
|
4
4
|
?selected=${!1}
|
|
@@ -17,7 +17,7 @@ import{a as w,n as h,r as g,i as x,x as d,E as u,t as S}from"../../vendor/vendor
|
|
|
17
17
|
</scb-sub-drawer>
|
|
18
18
|
`:u}
|
|
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??[];this._syncFlags(t.length===0,!this.showSearch);const n=this.searchHeight&&this.searchHeight.trim()?`--scb-search-height:${this.searchHeight.trim()}`:u,
|
|
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 n=this.searchHeight&&this.searchHeight.trim()?`--scb-search-height:${this.searchHeight.trim()}`:u,a=e.length>0;return d`
|
|
21
21
|
<slot
|
|
22
22
|
id="data-slot"
|
|
23
23
|
@slotchange=${()=>{this._harvest(),this._attachSlotObservers()}}
|
|
@@ -56,11 +56,11 @@ import{a as w,n as h,r as g,i as x,x as d,E as u,t as S}from"../../vendor/vendor
|
|
|
56
56
|
|
|
57
57
|
<div class="actions">
|
|
58
58
|
<nav class="utility" aria-label="Funktionslänkar">
|
|
59
|
-
${t.map(
|
|
59
|
+
${t.map(i=>d`
|
|
60
60
|
<scb-link
|
|
61
|
-
.href=${
|
|
62
|
-
.target=${
|
|
63
|
-
>${
|
|
61
|
+
.href=${i.href}
|
|
62
|
+
.target=${i.target??void 0}
|
|
63
|
+
>${i.label}</scb-link
|
|
64
64
|
>
|
|
65
65
|
`)}
|
|
66
66
|
</nav>
|
|
@@ -108,23 +108,40 @@ import{a as w,n as h,r as g,i as x,x as d,E as u,t as S}from"../../vendor/vendor
|
|
|
108
108
|
col-span-medium="8"
|
|
109
109
|
col-span-expanded="12"
|
|
110
110
|
>
|
|
111
|
-
${
|
|
111
|
+
${a?d`
|
|
112
112
|
<div class="tabs-inset">
|
|
113
113
|
<nav
|
|
114
114
|
class="tabs-nav"
|
|
115
115
|
aria-label="Huvudnavigering"
|
|
116
116
|
@keydown=${this._onTabsKeydown}
|
|
117
117
|
>
|
|
118
|
-
${e.map((
|
|
118
|
+
${e.map((i,c)=>i.menuId?d`
|
|
119
|
+
<div class="tab-wrap">
|
|
120
|
+
<button
|
|
121
|
+
type="button"
|
|
122
|
+
class="tab-link"
|
|
123
|
+
data-index=${c}
|
|
124
|
+
aria-controls=${i.menuId}
|
|
125
|
+
aria-haspopup="menu"
|
|
126
|
+
aria-expanded="false"
|
|
127
|
+
data-menu-toggle=${i.menuId}
|
|
128
|
+
aria-current=${c===this.activeTab?"page":u}
|
|
129
|
+
@click=${this._onTabClick}
|
|
130
|
+
>
|
|
131
|
+
${i.label}
|
|
132
|
+
</button>
|
|
133
|
+
<md-focus-ring></md-focus-ring>
|
|
134
|
+
</div>
|
|
135
|
+
`:i.href?d`
|
|
119
136
|
<div class="tab-wrap">
|
|
120
137
|
<a
|
|
121
138
|
class="tab-link"
|
|
122
|
-
href=${
|
|
139
|
+
href=${i.href}
|
|
123
140
|
data-index=${c}
|
|
124
141
|
aria-current=${c===this.activeTab?"page":u}
|
|
125
142
|
@click=${this._onTabClick}
|
|
126
143
|
>
|
|
127
|
-
${
|
|
144
|
+
${i.label}
|
|
128
145
|
</a>
|
|
129
146
|
<md-focus-ring></md-focus-ring>
|
|
130
147
|
</div>
|
|
@@ -137,7 +154,7 @@ import{a as w,n as h,r as g,i as x,x as d,E as u,t as S}from"../../vendor/vendor
|
|
|
137
154
|
aria-current=${c===this.activeTab?"page":u}
|
|
138
155
|
@click=${this._onTabClick}
|
|
139
156
|
>
|
|
140
|
-
${
|
|
157
|
+
${i.label}
|
|
141
158
|
</button>
|
|
142
159
|
<md-focus-ring></md-focus-ring>
|
|
143
160
|
</div>
|
|
@@ -179,10 +196,10 @@ import{a as w,n as h,r as g,i as x,x as d,E as u,t as S}from"../../vendor/vendor
|
|
|
179
196
|
|
|
180
197
|
${this.includeUtilityInDrawer&&(t?.length??0)>0?d`
|
|
181
198
|
<scb-drawer-section label=''></scb-drawer-section>
|
|
182
|
-
${t.map(
|
|
199
|
+
${t.map(i=>d`
|
|
183
200
|
<scb-drawer-item
|
|
184
|
-
label=${
|
|
185
|
-
item-href=${
|
|
201
|
+
label=${i.label}
|
|
202
|
+
item-href=${i.href}
|
|
186
203
|
></scb-drawer-item>
|
|
187
204
|
`)}
|
|
188
205
|
`:u}
|
|
@@ -222,7 +239,7 @@ import{a as w,n as h,r as g,i as x,x as d,E as u,t as S}from"../../vendor/vendor
|
|
|
222
239
|
</clipPath>
|
|
223
240
|
</defs>
|
|
224
241
|
</svg>
|
|
225
|
-
`}};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=
|
|
242
|
+
`}};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=x`
|
|
226
243
|
:host {
|
|
227
244
|
display: block;
|
|
228
245
|
background: var(--scb-header-background, transparent);
|
|
@@ -486,4 +503,4 @@ import{a as w,n as h,r as g,i as x,x as d,E as u,t as S}from"../../vendor/vendor
|
|
|
486
503
|
:host([data-hide-logo-text]) .logo-text {
|
|
487
504
|
display: none;
|
|
488
505
|
}
|
|
489
|
-
`;r._nextFrame=()=>new Promise(e=>requestAnimationFrame(()=>e()));
|
|
506
|
+
`;r._nextFrame=()=>new Promise(e=>requestAnimationFrame(()=>e()));o([h({type:String,attribute:"max-width"})],r.prototype,"maxWidth",2);o([h({type:String,attribute:"logo-text"})],r.prototype,"logoText",2);o([h({type:String,attribute:"logo-href"})],r.prototype,"logoHref",2);o([h({type:Boolean,reflect:!0})],r.prototype,"banner",2);o([h({type:String,attribute:"banner-label"})],r.prototype,"bannerLabel",2);o([h({attribute:"tabs",converter:r._JSON_ARRAY})],r.prototype,"tabs",2);o([h({type:Number,attribute:"active-tab"})],r.prototype,"activeTab",2);o([h({attribute:"utility-items",converter:r._JSON_ARRAY})],r.prototype,"utilityItems",2);o([h({type:String,attribute:"search-placeholder"})],r.prototype,"searchPlaceholder",2);o([h({type:String,attribute:"drawer-label"})],r.prototype,"drawerLabel",2);o([h({type:String,attribute:"drawer-sub-label"})],r.prototype,"drawerSubLabel",2);o([h({type:String,attribute:"drawer-section-label"})],r.prototype,"drawerSectionLabel",2);o([h({type:String,attribute:"drawer-search-placeholder"})],r.prototype,"drawerSearchPlaceholder",2);o([h({attribute:"menu-data",converter:r._JSON_ARRAY})],r.prototype,"menuData",2);o([h({attribute:"show-drawer",reflect:!0,converter:v})],r.prototype,"showDrawer",2);o([h({attribute:"show-search",reflect:!0,converter:v})],r.prototype,"showSearch",2);o([h({attribute:"include-utility-in-drawer",reflect:!0,converter:v})],r.prototype,"includeUtilityInDrawer",2);o([h({attribute:"drawer-overlay",reflect:!0,converter:v})],r.prototype,"drawerOverlay",2);o([h({type:String,attribute:"search-max"})],r.prototype,"searchMax",2);o([h({type:String,attribute:"search-min"})],r.prototype,"searchMin",2);o([h({type:String,attribute:"search-height"})],r.prototype,"searchHeight",2);o([h({type:String,attribute:"search-text",reflect:!0})],r.prototype,"searchText",2);o([m()],r.prototype,"_drawerId",2);o([m()],r.prototype,"_drawerExpanded",2);o([m()],r.prototype,"_searchId",2);o([m()],r.prototype,"_slotTabs",2);o([m()],r.prototype,"_slotUtils",2);o([m()],r.prototype,"_slotMenu",2);o([m()],r.prototype,"_collapsed",2);o([m()],r.prototype,"_hideLogoText",2);r=o([C("scb-header")],r);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as f,n as m,i as b,x as v,t as E}from"../../vendor/vendor.js";import"./scb-menu-item.js";import"./scb-sub-menu.js";import"../scb-divider/scb-divider.js";import"../../vendor/vendor-material.js";(function(){try{var t=typeof globalThis<"u"?globalThis:window;if(!t.__scb_ce_guard_installed__){t.__scb_ce_guard_installed__=!0;var i=customElements.define.bind(customElements);customElements.define=function(e,s,o){try{customElements.get(e)||i(e,s,o)}catch(n){var r=String(n||"");if(r.indexOf("already been used")===-1&&r.indexOf("NotSupportedError")===-1)throw n}}}}catch{}})();var w=Object.defineProperty,y=Object.getOwnPropertyDescriptor,u=(t,i,e,s)=>{for(var o=s>1?void 0:s?y(i,e):i,r=t.length-1,n;r>=0;r--)(n=t[r])&&(o=(s?n(i,e,o):n(o))||o);return s&&o&&w(i,e,o),o};let c=class extends b{constructor(){super(...arguments),this.open=!1,this.inSb=!1,this.__lastTriggerEl=null,this.__onViewportChange=()=>{this.open&&this.__positionToTrigger()},this.__onDocumentClick=t=>{const i=this.__getActionFromEvent(t);if(i){i==="open"&&(this.__setOpen(!0),this.dispatchEvent(new CustomEvent("open",{bubbles:!0,composed:!0}))),i==="close"&&(this.__setOpen(!1),this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0}))),i==="toggle"&&(this.__setOpen(!this.open),this.dispatchEvent(new CustomEvent("toggle",{bubbles:!0,composed:!0}))),t.stopPropagation();return}if(!this.inSb&&this.open&&!this.isClickInScbMenu(t)){this.__setOpen(!1);return}},this.__onDocumentKeydown=t=>{if(this.open&&t.key==="Escape"){this.__setOpen(!1);return}}}render(){return v`
|
|
2
2
|
<div
|
|
3
3
|
role="menu"
|
|
4
4
|
class="scb-menu-panel${this.open?" open":""}"
|
|
5
5
|
>
|
|
6
6
|
<slot></slot>
|
|
7
7
|
</div>
|
|
8
|
-
`}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this.__onDocumentClick,!1),document.addEventListener("keydown",this.__onDocumentKeydown,!0)}disconnectedCallback(){document.removeEventListener("click",this.__onDocumentClick,!1),document.removeEventListener("keydown",this.__onDocumentKeydown,!0),super.disconnectedCallback()}__setOpen(t){this.open=t}__getActionFromEvent(t){if(!this.id)return null;const
|
|
8
|
+
`}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this.__onDocumentClick,!1),document.addEventListener("keydown",this.__onDocumentKeydown,!0),window.addEventListener("resize",this.__onViewportChange,{passive:!0}),window.addEventListener("scroll",this.__onViewportChange,{passive:!0,capture:!0})}disconnectedCallback(){document.removeEventListener("click",this.__onDocumentClick,!1),document.removeEventListener("keydown",this.__onDocumentKeydown,!0),window.removeEventListener("resize",this.__onViewportChange),window.removeEventListener("scroll",this.__onViewportChange,!0),super.disconnectedCallback()}__setOpen(t){this.open=t}__getActionFromEvent(t){if(!this.id)return null;const i=t.composedPath();for(const e of i)if(e instanceof Element){if(e.getAttribute("data-menu-open")===this.id)return this.__lastTriggerEl=e,"open";if(e.getAttribute("data-menu-close")===this.id)return this.__lastTriggerEl=e,"close";if(e.getAttribute("data-menu-toggle")===this.id)return this.__lastTriggerEl=e,"toggle";if(e.getAttribute("aria-controls")===this.id)return this.__lastTriggerEl=e,"toggle"}return null}isClickInScbMenu(t){return t.composedPath().some(e=>e instanceof Element&&(e.tagName==="SCB-MENU"||e.tagName==="SCB-SUB-MENU"))}updated(t){t.has("open")&&(this.__applyOpenSideEffects(),this.open?this.dispatchEvent(new CustomEvent("open",{bubbles:!0,composed:!0})):this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0})))}__applyOpenSideEffects(){this.__updateTriggersExpanded(),this.open?this.__positionToTrigger():this.__restoreFocusToTrigger()}__positionToTrigger(){if(!this.open||!this.__lastTriggerEl)return;const t=this.__lastTriggerEl,i=this.shadowRoot?.querySelector(".scb-menu-panel");i&&requestAnimationFrame(()=>{if(!this.open)return;const e=t.getBoundingClientRect(),s=i.getBoundingClientRect(),o=window.innerWidth,r=window.innerHeight,n=8,p=4;let a=e.left,l=e.bottom+p;const h=s.width,d=s.height;a+h>o-n&&(a=Math.max(n,o-n-h)),a<n&&(a=n);let _="top";if(l+d>r-n){const g=e.top-p-d;g>=n&&(l=g,_="bottom")}this.style.position="fixed",this.style.left=`${Math.round(a)}px`,this.style.top=`${Math.round(l)}px`,this.style.setProperty("--scb-menu-transform-origin",_)})}__restoreFocusToTrigger(){this.__lastTriggerEl&&requestAnimationFrame(()=>{this.__lastTriggerEl?.focus?.()})}__updateTriggersExpanded(){if(!this.id)return;const t=String(this.open),i=s=>{s.getAttribute("aria-controls")===this.id&&s.setAttribute("aria-expanded",t)};this.__lastTriggerEl&&i(this.__lastTriggerEl),document.querySelectorAll(`[aria-controls="${this.id}"], [data-menu-open="${this.id}"], [data-menu-close="${this.id}"], [data-menu-toggle="${this.id}"]`).forEach(i)}};c.styles=f`
|
|
9
9
|
:host {
|
|
10
10
|
position: absolute;
|
|
11
11
|
display: block;
|
|
@@ -25,7 +25,7 @@ import{a as u,n as l,i as p,x as d,t as h}from"../../vendor/vendor.js";import"./
|
|
|
25
25
|
opacity: 0;
|
|
26
26
|
max-height: 0;
|
|
27
27
|
transform: scaleY(0.8);
|
|
28
|
-
transform-origin: top;
|
|
28
|
+
transform-origin: var(--scb-menu-transform-origin, top);
|
|
29
29
|
transition:
|
|
30
30
|
opacity 0.25s cubic-bezier(0.23, 1, 0.32, 1),
|
|
31
31
|
transform 0.32s cubic-bezier(0.23, 1, 0.32, 1);
|
|
@@ -43,4 +43,4 @@ import{a as u,n as l,i as p,x as d,t as h}from"../../vendor/vendor.js";import"./
|
|
|
43
43
|
opacity 0.25s cubic-bezier(0.23, 1, 0.32, 1),
|
|
44
44
|
transform 0.32s cubic-bezier(0.23, 1, 0.32, 1);
|
|
45
45
|
}
|
|
46
|
-
`;
|
|
46
|
+
`;u([m({type:Boolean,reflect:!0})],c.prototype,"open",2);u([m({type:Boolean,attribute:!1})],c.prototype,"inSb",2);c=u([E("scb-menu")],c);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "scb-wc-test",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.144",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "index.js",
|
|
@@ -365,5 +365,5 @@
|
|
|
365
365
|
},
|
|
366
366
|
"./mvc/*": "./mvc/*"
|
|
367
367
|
},
|
|
368
|
-
"buildHash": "
|
|
368
|
+
"buildHash": "5930BC5AB9243AFF27B8A09412CBB364B8EA8415FC7F7657D4B98B5CEE77CE32"
|
|
369
369
|
}
|
package/scb-card/scb-card.d.ts
CHANGED
|
@@ -31,6 +31,8 @@ export declare class ScbCard extends LitElement {
|
|
|
31
31
|
commentsHref: string;
|
|
32
32
|
likesText: string;
|
|
33
33
|
likes: number;
|
|
34
|
+
hasLiked: boolean;
|
|
35
|
+
likesInteractive: boolean;
|
|
34
36
|
sizing: 'stretch' | 'content-width' | 'content-height';
|
|
35
37
|
width: string;
|
|
36
38
|
maxWidth: string;
|