scb-wc-test 0.1.141 → 0.1.142
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 +53 -25
- package/package.json +2 -2
- package/scb-card/scb-card.d.ts +1 -0
- package/scb-card/scb-card.js +169 -131
- package/scb-wc-test.bundle.js +44 -16
|
@@ -1,12 +1,12 @@
|
|
|
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 v}from"../../vendor/preload-helper.js";import{a as x,n as o,i as $,x as a,t as _}from"../../vendor/vendor.js";import"../../vendor/vendor-material.js";import"../scb-list/scb-list.js";import"../scb-button/scb-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 k=Object.defineProperty,z=Object.getOwnPropertyDescriptor,f=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&&k(t,s,n),n},w=(e,t,s)=>t.has(e)||f("Cannot "+s),S=(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),y=(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.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
|
|
9
|
-
<div class="media ${l}" style="${
|
|
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",m=this.mediaPosition||"center";return a`
|
|
9
|
+
<div class="media ${l}" style="${n}">
|
|
10
10
|
<slot name="media-sources"></slot>
|
|
11
11
|
<img
|
|
12
12
|
src="${this.mediaHref||""}"
|
|
@@ -16,15 +16,15 @@ import{_ as g}from"../../vendor/preload-helper.js";import{a as y,n,i as f,x as a
|
|
|
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:${m};"
|
|
20
20
|
width="${t}"
|
|
21
21
|
height="${s}"
|
|
22
22
|
@load=${this.__onImgLoad}
|
|
23
23
|
/>
|
|
24
24
|
</div>
|
|
25
|
-
`}return null}mapSpacingToken(
|
|
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(),m=p=>a`
|
|
26
26
|
<div
|
|
27
|
-
class="scb-card ${
|
|
27
|
+
class="scb-card ${e} ${t} ${c}"
|
|
28
28
|
@click=${s?this.__handleHrefNavigation:null}
|
|
29
29
|
@keydown=${s?this.__onKeyDown:null}
|
|
30
30
|
style="cursor:${s?"pointer":"default"};"
|
|
@@ -34,85 +34,99 @@ import{_ as g}from"../../vendor/preload-helper.js";import{a as y,n,i as f,x as a
|
|
|
34
34
|
>
|
|
35
35
|
${s?a`<md-ripple></md-ripple>`:""}
|
|
36
36
|
${d()}
|
|
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 m(a`
|
|
41
41
|
<div class="full-content">
|
|
42
42
|
<div class="top-content">
|
|
43
43
|
${this.title?a`<div class="header">${l(s)}</div>`:""}
|
|
44
44
|
${this.subtitle?a`<div class="sub-label">${this.subtitle}</div>`:""}
|
|
45
45
|
${this.supportingText?a`<div class="supporting-text">${this.supportingText}</div>`:""}
|
|
46
|
-
${
|
|
46
|
+
${n?a`<div class="date">${n}</div>`:""}
|
|
47
47
|
</div>
|
|
48
48
|
</div>
|
|
49
|
-
`);case"list":return
|
|
49
|
+
`);case"list":return m(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>`:""}
|
|
53
53
|
${this.subtitle?a`<div class="sub-label">${this.subtitle}</div>`:""}
|
|
54
54
|
${this.supportingText?a`<div class="supporting-text">${this.supportingText}</div>`:""}
|
|
55
|
-
${
|
|
55
|
+
${n?a`<div class="date">${n}</div>`:""}
|
|
56
56
|
</div>
|
|
57
57
|
<div class="content list">
|
|
58
58
|
<slot></slot>
|
|
59
59
|
</div>
|
|
60
60
|
</div>
|
|
61
|
-
`);case"social":
|
|
61
|
+
`);case"social":const p=this.commentsHref,g=h=>{h.stopPropagation()};return m(a`
|
|
62
62
|
<div class="full-content">
|
|
63
63
|
<div class="top-content">
|
|
64
64
|
${this.title?a`<div class="header">${l(s)}</div>`:""}
|
|
65
65
|
${this.subtitle?a`<div class="sub-label">${this.subtitle}</div>`:""}
|
|
66
66
|
${this.supportingText?a`<div class="supporting-text">${this.supportingText}</div>`:""}
|
|
67
|
-
${
|
|
67
|
+
${n?a`<div class="date">${n}</div>`:""}
|
|
68
68
|
</div>
|
|
69
69
|
<div class="content">
|
|
70
70
|
<div class="social-metrics">
|
|
71
|
-
|
|
71
|
+
${p!==""?a`
|
|
72
|
+
<a class="comments" href="${p}" tabindex="0" @click=${g}
|
|
72
73
|
><md-icon>mode_comment</md-icon>
|
|
73
|
-
<span>${this.commentsText}: ${this.comments}</span></
|
|
74
|
+
<span>${this.commentsText}: ${this.comments}</span></a
|
|
74
75
|
>
|
|
76
|
+
`:a`
|
|
77
|
+
<span class="comments" href="${p}" tabindex="0" @click=${g}
|
|
78
|
+
><md-icon>mode_comment</md-icon>
|
|
79
|
+
<span>${this.commentsText}: ${this.comments}</span></span
|
|
80
|
+
>`}
|
|
81
|
+
|
|
75
82
|
<span class="likes"
|
|
76
|
-
|
|
77
|
-
|
|
83
|
+
style="cursor:pointer;"
|
|
84
|
+
tabindex="0"
|
|
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"}"
|
|
78
89
|
>
|
|
90
|
+
<md-icon>thumb_up</md-icon>
|
|
91
|
+
<span>${this.likesText}: ${this.likes}</span>
|
|
92
|
+
</span>
|
|
79
93
|
</div>
|
|
80
94
|
</div>
|
|
81
95
|
</div>
|
|
82
|
-
`);case"link":return
|
|
96
|
+
`);case"link":return m(a`
|
|
83
97
|
<div class="full-content">
|
|
84
98
|
<div class="top-content">
|
|
85
99
|
${this.title?a`<div class="header"><span class="title">${this.title}</span></div>`:""}
|
|
86
100
|
${this.subtitle?a`<div class="sub-label">${this.subtitle}</div>`:""}
|
|
87
101
|
${this.supportingText?a`<div class="supporting-text">${this.supportingText}</div>`:""}
|
|
88
|
-
${
|
|
102
|
+
${n?a`<div class="date">${n}</div>`:""}
|
|
89
103
|
</div>
|
|
90
104
|
<div class="content links">
|
|
91
105
|
<slot></slot>
|
|
92
106
|
</div>
|
|
93
107
|
</div>
|
|
94
|
-
`);case"action":return
|
|
108
|
+
`);case"action":return m(a`
|
|
95
109
|
<div class="full-content">
|
|
96
110
|
<div class="top-content">
|
|
97
111
|
${this.title?a`<div class="header"><span class="title">${this.title}</span></div>`:""}
|
|
98
112
|
${this.subtitle?a`<div class="sub-label">${this.subtitle}</div>`:""}
|
|
99
113
|
${this.supportingText?a`<div class="supporting-text">${this.supportingText}</div>`:""}
|
|
100
|
-
${
|
|
114
|
+
${n?a`<div class="date">${n}</div>`:""}
|
|
101
115
|
</div>
|
|
102
116
|
<div class="content actions">
|
|
103
117
|
<slot></slot>
|
|
104
118
|
</div>
|
|
105
119
|
</div>
|
|
106
|
-
`);default:return
|
|
120
|
+
`);default:return m(a`
|
|
107
121
|
<div class="full-content">
|
|
108
122
|
<div class="top-content">
|
|
109
123
|
${this.title?a`<div class="header">${l(s)}</div>`:""}
|
|
110
124
|
${this.subtitle?a`<div class="sub-label">${this.subtitle}</div>`:""}
|
|
111
125
|
${this.supportingText?a`<div class="supporting-text">${this.supportingText}</div>`:""}
|
|
112
|
-
${
|
|
126
|
+
${n?a`<div class="date">${n}</div>`:""}
|
|
113
127
|
</div>
|
|
114
128
|
</div>
|
|
115
|
-
`)}}updated(
|
|
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"))&&y(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),y(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`
|
|
116
130
|
:host {
|
|
117
131
|
display: block;
|
|
118
132
|
box-sizing: border-box;
|
|
@@ -218,6 +232,20 @@ import{_ as g}from"../../vendor/preload-helper.js";import{a as y,n,i as f,x as a
|
|
|
218
232
|
.scb-card.clickable {
|
|
219
233
|
cursor: pointer;
|
|
220
234
|
}
|
|
235
|
+
.social-metrics a.comments {
|
|
236
|
+
color: var(--md-sys-color-primary);
|
|
237
|
+
text-decoration: none;
|
|
238
|
+
border-radius: 4px;
|
|
239
|
+
cursor: pointer;
|
|
240
|
+
outline: none;
|
|
241
|
+
}
|
|
242
|
+
.social-metrics a.comments:hover,
|
|
243
|
+
.social-metrics a.comments:focus {
|
|
244
|
+
color: var(--md-sys-color-primary);
|
|
245
|
+
text-decoration: var(--scb-link-decoration, underline);
|
|
246
|
+
text-underline-offset: var(--scb-link-underline-offset, .22em);
|
|
247
|
+
text-decoration-thickness: var(--scb-link-underline-thickness, 1px);
|
|
248
|
+
}
|
|
221
249
|
|
|
222
250
|
md-ripple {
|
|
223
251
|
position: absolute;
|
|
@@ -417,4 +445,4 @@ import{_ as g}from"../../vendor/preload-helper.js";import{a as y,n,i as f,x as a
|
|
|
417
445
|
.scb-card.filled .content.list ::slotted(scb-list) {
|
|
418
446
|
--scb-list-bg: var(--md-sys-color-surface-dim);
|
|
419
447
|
}
|
|
420
|
-
`;r([
|
|
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([_("scb-card")],i);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "scb-wc-test",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.142",
|
|
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": "CBB24AFEA7148EBB66D22C2771E26F54DF4F09651EDBB24B8776E7E253EC3348"
|
|
369
369
|
}
|
package/scb-card/scb-card.d.ts
CHANGED
package/scb-card/scb-card.js
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import { css as
|
|
2
|
-
import { property as
|
|
1
|
+
import { css as f, LitElement as x, html as a } from "lit";
|
|
2
|
+
import { property as o, customElement as $ } from "lit/decorators.js";
|
|
3
3
|
import "@material/web/focus/md-focus-ring.js";
|
|
4
4
|
import "../scb-list/scb-list.js";
|
|
5
5
|
import "../scb-button/scb-button.js";
|
|
6
6
|
import "../scb-link/scb-link.js";
|
|
7
7
|
import "../scb-avatar/scb-avatar.js";
|
|
8
|
-
var
|
|
9
|
-
throw TypeError(
|
|
10
|
-
}, r = (
|
|
11
|
-
for (var
|
|
12
|
-
(
|
|
13
|
-
return c &&
|
|
14
|
-
},
|
|
15
|
-
let
|
|
8
|
+
var k = Object.defineProperty, z = Object.getOwnPropertyDescriptor, y = (e) => {
|
|
9
|
+
throw TypeError(e);
|
|
10
|
+
}, r = (e, t, s, c) => {
|
|
11
|
+
for (var n = c > 1 ? void 0 : c ? z(t, s) : t, l = e.length - 1, h; l >= 0; l--)
|
|
12
|
+
(h = e[l]) && (n = (c ? h(t, s, n) : h(n)) || n);
|
|
13
|
+
return c && n && k(t, s, n), n;
|
|
14
|
+
}, w = (e, t, s) => t.has(e) || y("Cannot " + 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), v = (e, t, s) => (w(e, t, "access private method"), s), u, b;
|
|
15
|
+
let i = class extends x {
|
|
16
16
|
constructor() {
|
|
17
|
-
super(...arguments),
|
|
18
|
-
const t =
|
|
17
|
+
super(...arguments), _(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.sizing = "stretch", this.width = "", this.maxWidth = "", this.height = "", this.maxHeight = "", this.spacing = "", this.spacingTop = "", this.spacingBottom = "", this.__onImgLoad = (e) => {
|
|
18
|
+
const t = e.currentTarget.closest(".media");
|
|
19
19
|
t && t.classList.add("is-loaded");
|
|
20
|
-
}, this.__onKeyDown = (
|
|
20
|
+
}, this.__onKeyDown = (e) => {
|
|
21
21
|
const t = (this.cardHref || "").trim();
|
|
22
|
-
t && (
|
|
23
|
-
}, this.__handleHrefNavigation = (
|
|
22
|
+
t && (e.key === "Enter" || e.key === " ") && (e.preventDefault(), window.location.assign(t));
|
|
23
|
+
}, this.__handleHrefNavigation = (e) => {
|
|
24
24
|
const t = (this.cardHref || "").trim();
|
|
25
|
-
if (!t ||
|
|
26
|
-
const s =
|
|
25
|
+
if (!t || e.button !== 0 || e.metaKey || e.ctrlKey || e.altKey || e.shiftKey) return;
|
|
26
|
+
const s = e.target;
|
|
27
27
|
s != null && s.closest("a, button, input, select, textarea, summary") || window.location.assign(t);
|
|
28
28
|
};
|
|
29
29
|
}
|
|
@@ -34,13 +34,13 @@ let e = class extends y {
|
|
|
34
34
|
return t === "standard" || t === "social";
|
|
35
35
|
}
|
|
36
36
|
/* Beräkna fallback-mått från media-aspect. Används endast om width/height saknas. */
|
|
37
|
-
__calcAspectWH(
|
|
38
|
-
const t = (
|
|
37
|
+
__calcAspectWH(e) {
|
|
38
|
+
const t = (e || "").trim();
|
|
39
39
|
if (!t) return { w: 640, h: 360 };
|
|
40
40
|
const s = t.includes("/") ? t.split("/") : t.includes(":") ? t.split(":") : t.includes("x") ? t.split("x") : null;
|
|
41
41
|
if (s && s.length === 2) {
|
|
42
|
-
const
|
|
43
|
-
if (
|
|
42
|
+
const n = Number(s[0]), l = Number(s[1]);
|
|
43
|
+
if (n > 0 && l > 0) return { w: n, h: l };
|
|
44
44
|
}
|
|
45
45
|
const c = Number(t);
|
|
46
46
|
return isFinite(c) && c > 0 ? { w: 1e3, h: Math.round(1e3 / c) } : { w: 640, h: 360 };
|
|
@@ -58,12 +58,12 @@ let e = class extends y {
|
|
|
58
58
|
let t = Number(this.mediaWidth) || 0, s = Number(this.mediaHeight) || 0;
|
|
59
59
|
const c = (this.mediaAspect || "").trim();
|
|
60
60
|
if (!t || !s) {
|
|
61
|
-
const
|
|
62
|
-
t || (t =
|
|
61
|
+
const d = this.__calcAspectWH(c || "16/9");
|
|
62
|
+
t || (t = d.w), s || (s = d.h);
|
|
63
63
|
}
|
|
64
|
-
const
|
|
64
|
+
const n = `aspect-ratio:${c || `${t}/${s}`};`, l = this.mediaPlaceholder ? "has-ph" : "", h = this.mediaFit || "cover", p = this.mediaPosition || "center";
|
|
65
65
|
return a`
|
|
66
|
-
<div class="media ${l}" style="${
|
|
66
|
+
<div class="media ${l}" style="${n}">
|
|
67
67
|
<slot name="media-sources"></slot>
|
|
68
68
|
<img
|
|
69
69
|
src="${this.mediaHref || ""}"
|
|
@@ -73,7 +73,7 @@ let e = class extends y {
|
|
|
73
73
|
loading="${this.mediaLoading}"
|
|
74
74
|
decoding="${this.mediaDecoding}"
|
|
75
75
|
fetchpriority="${this.mediaFetchPriority}"
|
|
76
|
-
style="object-fit:${
|
|
76
|
+
style="object-fit:${h};object-position:${p};"
|
|
77
77
|
width="${t}"
|
|
78
78
|
height="${s}"
|
|
79
79
|
@load=${this.__onImgLoad}
|
|
@@ -83,16 +83,16 @@ let e = class extends y {
|
|
|
83
83
|
}
|
|
84
84
|
return null;
|
|
85
85
|
}
|
|
86
|
-
mapSpacingToken(
|
|
87
|
-
if (!
|
|
88
|
-
const t = String(
|
|
86
|
+
mapSpacingToken(e) {
|
|
87
|
+
if (!e) return;
|
|
88
|
+
const t = String(e).trim();
|
|
89
89
|
if (t)
|
|
90
90
|
return /^\d+$/.test(t) ? `var(--spacing-${Math.max(0, Math.min(14, parseInt(t, 10)))})` : t;
|
|
91
91
|
}
|
|
92
92
|
render() {
|
|
93
|
-
const
|
|
93
|
+
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 = (d = !1) => d ? a`<span class="title">${this.title}</span><md-icon>arrow_forward</md-icon>` : a`<span class="title">${this.title}</span>`, h = () => this.__mediaTemplate(), p = (d) => a`
|
|
94
94
|
<div
|
|
95
|
-
class="scb-card ${
|
|
95
|
+
class="scb-card ${e} ${t} ${c}"
|
|
96
96
|
@click=${s ? this.__handleHrefNavigation : null}
|
|
97
97
|
@keydown=${s ? this.__onKeyDown : null}
|
|
98
98
|
style="cursor:${s ? "pointer" : "default"};"
|
|
@@ -101,31 +101,31 @@ let e = class extends y {
|
|
|
101
101
|
aria-label=${this.title || "Kort"}
|
|
102
102
|
>
|
|
103
103
|
${s ? a`<md-ripple></md-ripple>` : ""}
|
|
104
|
-
${
|
|
105
|
-
${
|
|
104
|
+
${h()}
|
|
105
|
+
${d}
|
|
106
106
|
</div>
|
|
107
107
|
${s ? a`<md-focus-ring></md-focus-ring>` : ""}
|
|
108
108
|
`;
|
|
109
109
|
switch (this.type) {
|
|
110
110
|
case "standard":
|
|
111
|
-
return
|
|
111
|
+
return p(a`
|
|
112
112
|
<div class="full-content">
|
|
113
113
|
<div class="top-content">
|
|
114
114
|
${this.title ? a`<div class="header">${l(s)}</div>` : ""}
|
|
115
115
|
${this.subtitle ? a`<div class="sub-label">${this.subtitle}</div>` : ""}
|
|
116
116
|
${this.supportingText ? a`<div class="supporting-text">${this.supportingText}</div>` : ""}
|
|
117
|
-
${
|
|
117
|
+
${n ? a`<div class="date">${n}</div>` : ""}
|
|
118
118
|
</div>
|
|
119
119
|
</div>
|
|
120
120
|
`);
|
|
121
121
|
case "list":
|
|
122
|
-
return
|
|
122
|
+
return p(a`
|
|
123
123
|
<div class="full-content">
|
|
124
124
|
<div class="top-content">
|
|
125
125
|
${this.title ? a`<div class="header"><span class="title">${this.title}</span></div>` : ""}
|
|
126
126
|
${this.subtitle ? a`<div class="sub-label">${this.subtitle}</div>` : ""}
|
|
127
127
|
${this.supportingText ? a`<div class="supporting-text">${this.supportingText}</div>` : ""}
|
|
128
|
-
${
|
|
128
|
+
${n ? a`<div class="date">${n}</div>` : ""}
|
|
129
129
|
</div>
|
|
130
130
|
<div class="content list">
|
|
131
131
|
<slot></slot>
|
|
@@ -133,36 +133,57 @@ let e = class extends y {
|
|
|
133
133
|
</div>
|
|
134
134
|
`);
|
|
135
135
|
case "social":
|
|
136
|
-
|
|
136
|
+
const d = this.commentsHref, g = (m) => {
|
|
137
|
+
m.stopPropagation();
|
|
138
|
+
};
|
|
139
|
+
return p(a`
|
|
137
140
|
<div class="full-content">
|
|
138
141
|
<div class="top-content">
|
|
139
142
|
${this.title ? a`<div class="header">${l(s)}</div>` : ""}
|
|
140
143
|
${this.subtitle ? a`<div class="sub-label">${this.subtitle}</div>` : ""}
|
|
141
144
|
${this.supportingText ? a`<div class="supporting-text">${this.supportingText}</div>` : ""}
|
|
142
|
-
${
|
|
145
|
+
${n ? a`<div class="date">${n}</div>` : ""}
|
|
143
146
|
</div>
|
|
144
147
|
<div class="content">
|
|
145
148
|
<div class="social-metrics">
|
|
146
|
-
|
|
149
|
+
${d !== "" ? a`
|
|
150
|
+
<a class="comments" href="${d}" tabindex="0" @click=${g}
|
|
147
151
|
><md-icon>mode_comment</md-icon>
|
|
148
|
-
<span>${this.commentsText}: ${this.comments}</span></
|
|
152
|
+
<span>${this.commentsText}: ${this.comments}</span></a
|
|
149
153
|
>
|
|
154
|
+
` : a`
|
|
155
|
+
<span class="comments" href="${d}" tabindex="0" @click=${g}
|
|
156
|
+
><md-icon>mode_comment</md-icon>
|
|
157
|
+
<span>${this.commentsText}: ${this.comments}</span></span
|
|
158
|
+
>`}
|
|
159
|
+
|
|
150
160
|
<span class="likes"
|
|
151
|
-
|
|
152
|
-
|
|
161
|
+
style="cursor:pointer;"
|
|
162
|
+
tabindex="0"
|
|
163
|
+
@click=${(m) => {
|
|
164
|
+
m.stopPropagation(), this.dispatchEvent(new CustomEvent("like-click", { bubbles: !0, composed: !0 }));
|
|
165
|
+
}}
|
|
166
|
+
@keydown=${(m) => {
|
|
167
|
+
(m.key === "Enter" || m.key === " ") && (m.preventDefault(), m.stopPropagation(), this.dispatchEvent(new CustomEvent("like-click", { bubbles: !0, composed: !0 })));
|
|
168
|
+
}}
|
|
169
|
+
role="button"
|
|
170
|
+
aria-label="${this.likesText || "Like"}"
|
|
153
171
|
>
|
|
172
|
+
<md-icon>thumb_up</md-icon>
|
|
173
|
+
<span>${this.likesText}: ${this.likes}</span>
|
|
174
|
+
</span>
|
|
154
175
|
</div>
|
|
155
176
|
</div>
|
|
156
177
|
</div>
|
|
157
178
|
`);
|
|
158
179
|
case "link":
|
|
159
|
-
return
|
|
180
|
+
return p(a`
|
|
160
181
|
<div class="full-content">
|
|
161
182
|
<div class="top-content">
|
|
162
183
|
${this.title ? a`<div class="header"><span class="title">${this.title}</span></div>` : ""}
|
|
163
184
|
${this.subtitle ? a`<div class="sub-label">${this.subtitle}</div>` : ""}
|
|
164
185
|
${this.supportingText ? a`<div class="supporting-text">${this.supportingText}</div>` : ""}
|
|
165
|
-
${
|
|
186
|
+
${n ? a`<div class="date">${n}</div>` : ""}
|
|
166
187
|
</div>
|
|
167
188
|
<div class="content links">
|
|
168
189
|
<slot></slot>
|
|
@@ -170,13 +191,13 @@ let e = class extends y {
|
|
|
170
191
|
</div>
|
|
171
192
|
`);
|
|
172
193
|
case "action":
|
|
173
|
-
return
|
|
194
|
+
return p(a`
|
|
174
195
|
<div class="full-content">
|
|
175
196
|
<div class="top-content">
|
|
176
197
|
${this.title ? a`<div class="header"><span class="title">${this.title}</span></div>` : ""}
|
|
177
198
|
${this.subtitle ? a`<div class="sub-label">${this.subtitle}</div>` : ""}
|
|
178
199
|
${this.supportingText ? a`<div class="supporting-text">${this.supportingText}</div>` : ""}
|
|
179
|
-
${
|
|
200
|
+
${n ? a`<div class="date">${n}</div>` : ""}
|
|
180
201
|
</div>
|
|
181
202
|
<div class="content actions">
|
|
182
203
|
<slot></slot>
|
|
@@ -184,33 +205,33 @@ let e = class extends y {
|
|
|
184
205
|
</div>
|
|
185
206
|
`);
|
|
186
207
|
default:
|
|
187
|
-
return
|
|
208
|
+
return p(a`
|
|
188
209
|
<div class="full-content">
|
|
189
210
|
<div class="top-content">
|
|
190
211
|
${this.title ? a`<div class="header">${l(s)}</div>` : ""}
|
|
191
212
|
${this.subtitle ? a`<div class="sub-label">${this.subtitle}</div>` : ""}
|
|
192
213
|
${this.supportingText ? a`<div class="supporting-text">${this.supportingText}</div>` : ""}
|
|
193
|
-
${
|
|
214
|
+
${n ? a`<div class="date">${n}</div>` : ""}
|
|
194
215
|
</div>
|
|
195
216
|
</div>
|
|
196
217
|
`);
|
|
197
218
|
}
|
|
198
219
|
}
|
|
199
|
-
updated(
|
|
200
|
-
super.updated(
|
|
220
|
+
updated(e) {
|
|
221
|
+
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")) && v(this, u, b).call(this);
|
|
201
222
|
}
|
|
202
|
-
async firstUpdated(
|
|
203
|
-
|
|
223
|
+
async firstUpdated(e) {
|
|
224
|
+
i.__iconLoaded || (await import("@material/web/icon/icon.js"), i.__iconLoaded = !0), i.__rippleLoaded || (await import("@material/web/ripple/ripple.js"), i.__rippleLoaded = !0), v(this, u, b).call(this);
|
|
204
225
|
}
|
|
205
226
|
};
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
const
|
|
227
|
+
u = /* @__PURE__ */ new WeakSet();
|
|
228
|
+
b = function() {
|
|
229
|
+
const e = this.mapSpacingToken(this.spacing), t = this.mapSpacingToken(this.spacingTop) ?? e, s = this.mapSpacingToken(this.spacingBottom) ?? e;
|
|
209
230
|
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");
|
|
210
231
|
};
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
232
|
+
i.__iconLoaded = !1;
|
|
233
|
+
i.__rippleLoaded = !1;
|
|
234
|
+
i.styles = f`
|
|
214
235
|
:host {
|
|
215
236
|
display: block;
|
|
216
237
|
box-sizing: border-box;
|
|
@@ -316,6 +337,20 @@ e.styles = v`
|
|
|
316
337
|
.scb-card.clickable {
|
|
317
338
|
cursor: pointer;
|
|
318
339
|
}
|
|
340
|
+
.social-metrics a.comments {
|
|
341
|
+
color: var(--md-sys-color-primary);
|
|
342
|
+
text-decoration: none;
|
|
343
|
+
border-radius: 4px;
|
|
344
|
+
cursor: pointer;
|
|
345
|
+
outline: none;
|
|
346
|
+
}
|
|
347
|
+
.social-metrics a.comments:hover,
|
|
348
|
+
.social-metrics a.comments:focus {
|
|
349
|
+
color: var(--md-sys-color-primary);
|
|
350
|
+
text-decoration: var(--scb-link-decoration, underline);
|
|
351
|
+
text-underline-offset: var(--scb-link-underline-offset, .22em);
|
|
352
|
+
text-decoration-thickness: var(--scb-link-underline-thickness, 1px);
|
|
353
|
+
}
|
|
319
354
|
|
|
320
355
|
md-ripple {
|
|
321
356
|
position: absolute;
|
|
@@ -517,110 +552,113 @@ e.styles = v`
|
|
|
517
552
|
}
|
|
518
553
|
`;
|
|
519
554
|
r([
|
|
520
|
-
|
|
521
|
-
],
|
|
555
|
+
o({ type: String, reflect: !0 })
|
|
556
|
+
], i.prototype, "type", 2);
|
|
557
|
+
r([
|
|
558
|
+
o({ type: String, reflect: !0 })
|
|
559
|
+
], i.prototype, "variant", 2);
|
|
522
560
|
r([
|
|
523
|
-
|
|
524
|
-
],
|
|
561
|
+
o({ type: String, reflect: !0 })
|
|
562
|
+
], i.prototype, "direction", 2);
|
|
525
563
|
r([
|
|
526
|
-
|
|
527
|
-
],
|
|
564
|
+
o({ type: String, attribute: "media-type" })
|
|
565
|
+
], i.prototype, "mediaType", 2);
|
|
528
566
|
r([
|
|
529
|
-
|
|
530
|
-
],
|
|
567
|
+
o({ type: String, attribute: "media-href" })
|
|
568
|
+
], i.prototype, "mediaHref", 2);
|
|
531
569
|
r([
|
|
532
|
-
|
|
533
|
-
],
|
|
570
|
+
o({ type: String, attribute: "media-alt" })
|
|
571
|
+
], i.prototype, "mediaAlt", 2);
|
|
534
572
|
r([
|
|
535
|
-
|
|
536
|
-
],
|
|
573
|
+
o({ type: String, attribute: "media-srcset" })
|
|
574
|
+
], i.prototype, "mediaSrcset", 2);
|
|
537
575
|
r([
|
|
538
|
-
|
|
539
|
-
],
|
|
576
|
+
o({ type: String, attribute: "media-sizes" })
|
|
577
|
+
], i.prototype, "mediaSizes", 2);
|
|
540
578
|
r([
|
|
541
|
-
|
|
542
|
-
],
|
|
579
|
+
o({ type: String, attribute: "media-loading" })
|
|
580
|
+
], i.prototype, "mediaLoading", 2);
|
|
543
581
|
r([
|
|
544
|
-
|
|
545
|
-
],
|
|
582
|
+
o({ type: String, attribute: "media-decoding" })
|
|
583
|
+
], i.prototype, "mediaDecoding", 2);
|
|
546
584
|
r([
|
|
547
|
-
|
|
548
|
-
],
|
|
585
|
+
o({ type: String, attribute: "media-fetchpriority" })
|
|
586
|
+
], i.prototype, "mediaFetchPriority", 2);
|
|
549
587
|
r([
|
|
550
|
-
|
|
551
|
-
],
|
|
588
|
+
o({ type: String, attribute: "media-fit" })
|
|
589
|
+
], i.prototype, "mediaFit", 2);
|
|
552
590
|
r([
|
|
553
|
-
|
|
554
|
-
],
|
|
591
|
+
o({ type: String, attribute: "media-position" })
|
|
592
|
+
], i.prototype, "mediaPosition", 2);
|
|
555
593
|
r([
|
|
556
|
-
|
|
557
|
-
],
|
|
594
|
+
o({ type: String, attribute: "media-width" })
|
|
595
|
+
], i.prototype, "mediaWidth", 2);
|
|
558
596
|
r([
|
|
559
|
-
|
|
560
|
-
],
|
|
597
|
+
o({ type: String, attribute: "media-height" })
|
|
598
|
+
], i.prototype, "mediaHeight", 2);
|
|
561
599
|
r([
|
|
562
|
-
|
|
563
|
-
],
|
|
600
|
+
o({ type: String, attribute: "media-aspect" })
|
|
601
|
+
], i.prototype, "mediaAspect", 2);
|
|
564
602
|
r([
|
|
565
|
-
|
|
566
|
-
],
|
|
603
|
+
o({ type: Boolean, attribute: "media-placeholder" })
|
|
604
|
+
], i.prototype, "mediaPlaceholder", 2);
|
|
567
605
|
r([
|
|
568
|
-
|
|
569
|
-
],
|
|
606
|
+
o({ type: String, attribute: "card-href", reflect: !0 })
|
|
607
|
+
], i.prototype, "cardHref", 2);
|
|
570
608
|
r([
|
|
571
|
-
|
|
572
|
-
],
|
|
609
|
+
o({ type: String, reflect: !0 })
|
|
610
|
+
], i.prototype, "title", 2);
|
|
573
611
|
r([
|
|
574
|
-
|
|
575
|
-
],
|
|
612
|
+
o({ type: String, reflect: !0 })
|
|
613
|
+
], i.prototype, "subtitle", 2);
|
|
576
614
|
r([
|
|
577
|
-
|
|
578
|
-
],
|
|
615
|
+
o({ type: String, attribute: "supporting-text", reflect: !0 })
|
|
616
|
+
], i.prototype, "supportingText", 2);
|
|
579
617
|
r([
|
|
580
|
-
|
|
581
|
-
],
|
|
618
|
+
o({ type: Date, reflect: !0 })
|
|
619
|
+
], i.prototype, "date", 2);
|
|
582
620
|
r([
|
|
583
|
-
|
|
584
|
-
],
|
|
621
|
+
o({ type: String, attribute: "social-comments-text", reflect: !0 })
|
|
622
|
+
], i.prototype, "commentsText", 2);
|
|
585
623
|
r([
|
|
586
|
-
|
|
587
|
-
],
|
|
624
|
+
o({ type: Number, attribute: "social-comments", reflect: !0 })
|
|
625
|
+
], i.prototype, "comments", 2);
|
|
588
626
|
r([
|
|
589
|
-
|
|
590
|
-
],
|
|
627
|
+
o({ type: String, attribute: "social-comments-href", reflect: !0 })
|
|
628
|
+
], i.prototype, "commentsHref", 2);
|
|
591
629
|
r([
|
|
592
|
-
|
|
593
|
-
],
|
|
630
|
+
o({ type: String, attribute: "social-likes-text", reflect: !0 })
|
|
631
|
+
], i.prototype, "likesText", 2);
|
|
594
632
|
r([
|
|
595
|
-
|
|
596
|
-
],
|
|
633
|
+
o({ type: Number, attribute: "social-likes", reflect: !0 })
|
|
634
|
+
], i.prototype, "likes", 2);
|
|
597
635
|
r([
|
|
598
|
-
|
|
599
|
-
],
|
|
636
|
+
o({ type: String, reflect: !0 })
|
|
637
|
+
], i.prototype, "sizing", 2);
|
|
600
638
|
r([
|
|
601
|
-
|
|
602
|
-
],
|
|
639
|
+
o({ type: String, reflect: !0 })
|
|
640
|
+
], i.prototype, "width", 2);
|
|
603
641
|
r([
|
|
604
|
-
|
|
605
|
-
],
|
|
642
|
+
o({ type: String, reflect: !0, attribute: "max-width" })
|
|
643
|
+
], i.prototype, "maxWidth", 2);
|
|
606
644
|
r([
|
|
607
|
-
|
|
608
|
-
],
|
|
645
|
+
o({ type: String, reflect: !0 })
|
|
646
|
+
], i.prototype, "height", 2);
|
|
609
647
|
r([
|
|
610
|
-
|
|
611
|
-
],
|
|
648
|
+
o({ type: String, reflect: !0, attribute: "max-height" })
|
|
649
|
+
], i.prototype, "maxHeight", 2);
|
|
612
650
|
r([
|
|
613
|
-
|
|
614
|
-
],
|
|
651
|
+
o({ type: String, reflect: !0 })
|
|
652
|
+
], i.prototype, "spacing", 2);
|
|
615
653
|
r([
|
|
616
|
-
|
|
617
|
-
],
|
|
654
|
+
o({ type: String, attribute: "spacing-top", reflect: !0 })
|
|
655
|
+
], i.prototype, "spacingTop", 2);
|
|
618
656
|
r([
|
|
619
|
-
|
|
620
|
-
],
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
],
|
|
657
|
+
o({ type: String, attribute: "spacing-bottom", reflect: !0 })
|
|
658
|
+
], i.prototype, "spacingBottom", 2);
|
|
659
|
+
i = r([
|
|
660
|
+
$("scb-card")
|
|
661
|
+
], i);
|
|
624
662
|
export {
|
|
625
|
-
|
|
663
|
+
i as ScbCard
|
|
626
664
|
};
|
package/scb-wc-test.bundle.js
CHANGED
|
@@ -555,7 +555,7 @@ var ScbWcTest=function(o){"use strict";var Bl;function p(a,e,t,i){var r=argument
|
|
|
555
555
|
</div>
|
|
556
556
|
${i?r:v}
|
|
557
557
|
</dialog>
|
|
558
|
-
`}firstUpdated(){this.intersectionObserver=new IntersectionObserver(e=>{for(const t of e)this.handleAnchorIntersection(t)},{root:this.scroller}),this.intersectionObserver.observe(this.topAnchor),this.intersectionObserver.observe(this.bottomAnchor)}handleDialogClick(){if(this.nextClickIsFromContent){this.nextClickIsFromContent=!1;return}this.dispatchEvent(new Event("cancel",{cancelable:!0}))&&this.close()}handleContentClick(){this.nextClickIsFromContent=!0}handleSubmit(e){const t=e.target,{submitter:i}=e;t.method!=="dialog"||!i||this.close(i.getAttribute("value")??this.returnValue)}handleCancel(e){if(e.target!==this.dialog)return;this.escapePressedWithoutCancel=!1;const t=!pt(this,e);e.preventDefault(),!t&&this.close()}handleClose(){var e;this.escapePressedWithoutCancel&&(this.escapePressedWithoutCancel=!1,(e=this.dialog)==null||e.dispatchEvent(new Event("cancel",{cancelable:!0})))}handleKeydown(e){e.key==="Escape"&&(this.escapePressedWithoutCancel=!0,setTimeout(()=>{this.escapePressedWithoutCancel=!1}))}async animateDialog(e){var S;if((S=this.cancelAnimations)==null||S.abort(),this.cancelAnimations=new AbortController,this.quick)return;const{dialog:t,scrim:i,container:r,headline:s,content:n,actions:d}=this;if(!t||!i||!r||!s||!n||!d)return;const{container:h,dialog:u,scrim:m,headline:b,content:x,actions:g}=e,w=[[t,u??[]],[i,m??[]],[r,h??[]],[s,b??[]],[n,x??[]],[d,g??[]]],k=[];for(const[$,C]of w)for(const
|
|
558
|
+
`}firstUpdated(){this.intersectionObserver=new IntersectionObserver(e=>{for(const t of e)this.handleAnchorIntersection(t)},{root:this.scroller}),this.intersectionObserver.observe(this.topAnchor),this.intersectionObserver.observe(this.bottomAnchor)}handleDialogClick(){if(this.nextClickIsFromContent){this.nextClickIsFromContent=!1;return}this.dispatchEvent(new Event("cancel",{cancelable:!0}))&&this.close()}handleContentClick(){this.nextClickIsFromContent=!0}handleSubmit(e){const t=e.target,{submitter:i}=e;t.method!=="dialog"||!i||this.close(i.getAttribute("value")??this.returnValue)}handleCancel(e){if(e.target!==this.dialog)return;this.escapePressedWithoutCancel=!1;const t=!pt(this,e);e.preventDefault(),!t&&this.close()}handleClose(){var e;this.escapePressedWithoutCancel&&(this.escapePressedWithoutCancel=!1,(e=this.dialog)==null||e.dispatchEvent(new Event("cancel",{cancelable:!0})))}handleKeydown(e){e.key==="Escape"&&(this.escapePressedWithoutCancel=!0,setTimeout(()=>{this.escapePressedWithoutCancel=!1}))}async animateDialog(e){var S;if((S=this.cancelAnimations)==null||S.abort(),this.cancelAnimations=new AbortController,this.quick)return;const{dialog:t,scrim:i,container:r,headline:s,content:n,actions:d}=this;if(!t||!i||!r||!s||!n||!d)return;const{container:h,dialog:u,scrim:m,headline:b,content:x,actions:g}=e,w=[[t,u??[]],[i,m??[]],[r,h??[]],[s,b??[]],[n,x??[]],[d,g??[]]],k=[];for(const[$,C]of w)for(const D of C){const P=$.animate(...D);this.cancelAnimations.signal.addEventListener("abort",()=>{P.cancel()}),k.push(P)}await Promise.all(k.map($=>$.finished.catch(()=>{})))}handleHeadlineChange(e){const t=e.target;this.hasHeadline=t.assignedElements().length>0}handleActionsChange(e){const t=e.target;this.hasActions=t.assignedElements().length>0}handleIconChange(e){const t=e.target;this.hasIcon=t.assignedElements().length>0}handleAnchorIntersection(e){const{target:t,isIntersecting:i}=e;t===this.topAnchor&&(this.isAtScrollTop=i),t===this.bottomAnchor&&(this.isAtScrollBottom=i)}getIsConnectedPromise(){return new Promise(e=>{this.isConnectedPromiseResolve=e})}handleFocusTrapFocus(e){var b;const[t,i]=this.getFirstAndLastFocusableChildren();if(!t||!i){(b=this.dialog)==null||b.focus();return}const r=e.target===this.firstFocusTrap,s=!r,n=e.relatedTarget===t,d=e.relatedTarget===i,h=!n&&!d;if(s&&d||r&&h){t.focus();return}if(r&&n||s&&h){i.focus();return}}getFirstAndLastFocusableChildren(){let e=null,t=null;for(this.treewalker.currentNode=this.treewalker.root;this.treewalker.nextNode();){const i=this.treewalker.currentNode;Xc(i)&&(e||(e=i),t=i)}return[e,t]}}ce(V),p([l({type:Boolean})],V.prototype,"open",null),p([l({type:Boolean})],V.prototype,"quick",void 0),p([l({attribute:!1})],V.prototype,"returnValue",void 0),p([l()],V.prototype,"type",void 0),p([l({type:Boolean,attribute:"no-focus-trap"})],V.prototype,"noFocusTrap",void 0),p([A("dialog")],V.prototype,"dialog",void 0),p([A(".scrim")],V.prototype,"scrim",void 0),p([A(".container")],V.prototype,"container",void 0),p([A(".headline")],V.prototype,"headline",void 0),p([A(".content")],V.prototype,"content",void 0),p([A(".actions")],V.prototype,"actions",void 0),p([E()],V.prototype,"isAtScrollTop",void 0),p([E()],V.prototype,"isAtScrollBottom",void 0),p([A(".scroller")],V.prototype,"scroller",void 0),p([A(".top.anchor")],V.prototype,"topAnchor",void 0),p([A(".bottom.anchor")],V.prototype,"bottomAnchor",void 0),p([A(".focus-trap")],V.prototype,"firstFocusTrap",void 0),p([E()],V.prototype,"hasHeadline",void 0),p([E()],V.prototype,"hasActions",void 0),p([E()],V.prototype,"hasIcon",void 0);function Xc(a){var s;const e=":is(button,input,select,textarea,object,:is(a,area)[href],[tabindex],[contenteditable=true])",t=":not(:disabled,[disabled])";return a.matches(e+t+':not([tabindex^="-"])')?!0:!a.localName.includes("-")||!a.matches(t)?!1:((s=a.shadowRoot)==null?void 0:s.delegatesFocus)??!1}/**
|
|
559
559
|
* @license
|
|
560
560
|
* Copyright 2024 Google LLC
|
|
561
561
|
* SPDX-License-Identifier: Apache-2.0
|
|
@@ -909,7 +909,7 @@ var ScbWcTest=function(o){"use strict";var Bl;function p(a,e,t,i){var r=argument
|
|
|
909
909
|
* @license
|
|
910
910
|
* Copyright 2023 Google LLC
|
|
911
911
|
* SPDX-License-Identifier: Apache-2.0
|
|
912
|
-
*/const zr={END_START:"end-start",START_START:"start-start",START_END:"start-end"};class Id{constructor(e,t){this.host=e,this.getProperties=t,this.surfaceStylesInternal={display:"none"},this.lastValues={isOpen:!1},this.host.addController(this)}get surfaceStyles(){return this.surfaceStylesInternal}async position(){const{surfaceEl:e,anchorEl:t,anchorCorner:i,surfaceCorner:r,positioning:s,xOffset:n,yOffset:d,repositionStrategy:h}=this.getProperties(),u=i.toLowerCase().trim(),m=r.toLowerCase().trim();if(!e||!t)return;const b=window.innerWidth,x=window.innerHeight,g=document.createElement("div");g.style.opacity="0",g.style.position="fixed",g.style.display="block",g.style.inset="0",document.body.appendChild(g);const w=g.getBoundingClientRect();g.remove();const k=window.innerHeight-w.bottom,S=window.innerWidth-w.right;this.surfaceStylesInternal={display:"block",opacity:"0"},this.host.requestUpdate(),await this.host.updateComplete,e.popover&&e.isConnected&&e.showPopover();const $=e.getSurfacePositionClientRect?e.getSurfacePositionClientRect():e.getBoundingClientRect(),C=t.getSurfacePositionClientRect?t.getSurfacePositionClientRect():t.getBoundingClientRect(),[
|
|
912
|
+
*/const zr={END_START:"end-start",START_START:"start-start",START_END:"start-end"};class Id{constructor(e,t){this.host=e,this.getProperties=t,this.surfaceStylesInternal={display:"none"},this.lastValues={isOpen:!1},this.host.addController(this)}get surfaceStyles(){return this.surfaceStylesInternal}async position(){const{surfaceEl:e,anchorEl:t,anchorCorner:i,surfaceCorner:r,positioning:s,xOffset:n,yOffset:d,repositionStrategy:h}=this.getProperties(),u=i.toLowerCase().trim(),m=r.toLowerCase().trim();if(!e||!t)return;const b=window.innerWidth,x=window.innerHeight,g=document.createElement("div");g.style.opacity="0",g.style.position="fixed",g.style.display="block",g.style.inset="0",document.body.appendChild(g);const w=g.getBoundingClientRect();g.remove();const k=window.innerHeight-w.bottom,S=window.innerWidth-w.right;this.surfaceStylesInternal={display:"block",opacity:"0"},this.host.requestUpdate(),await this.host.updateComplete,e.popover&&e.isConnected&&e.showPopover();const $=e.getSurfacePositionClientRect?e.getSurfacePositionClientRect():e.getBoundingClientRect(),C=t.getSurfacePositionClientRect?t.getSurfacePositionClientRect():t.getBoundingClientRect(),[D,P]=m.split("-"),[z,ye]=u.split("-"),Ae=getComputedStyle(e).direction==="ltr";let{blockInset:j,blockOutOfBoundsCorrection:L,surfaceBlockProperty:nt}=this.calculateBlock({surfaceRect:$,anchorRect:C,anchorBlock:z,surfaceBlock:D,yOffset:d,positioning:s,windowInnerHeight:x,blockScrollbarHeight:k});if(L){const _e=D==="start"?"end":"start",He=z==="start"?"end":"start",ve=this.calculateBlock({surfaceRect:$,anchorRect:C,anchorBlock:He,surfaceBlock:_e,yOffset:d,positioning:s,windowInnerHeight:x,blockScrollbarHeight:k});L>ve.blockOutOfBoundsCorrection&&(j=ve.blockInset,L=ve.blockOutOfBoundsCorrection,nt=ve.surfaceBlockProperty)}let{inlineInset:T,inlineOutOfBoundsCorrection:N,surfaceInlineProperty:Ie}=this.calculateInline({surfaceRect:$,anchorRect:C,anchorInline:ye,surfaceInline:P,xOffset:n,positioning:s,isLTR:Ae,windowInnerWidth:b,inlineScrollbarWidth:S});if(N){const _e=P==="start"?"end":"start",He=ye==="start"?"end":"start",ve=this.calculateInline({surfaceRect:$,anchorRect:C,anchorInline:He,surfaceInline:_e,xOffset:n,positioning:s,isLTR:Ae,windowInnerWidth:b,inlineScrollbarWidth:S});Math.abs(N)>Math.abs(ve.inlineOutOfBoundsCorrection)&&(T=ve.inlineInset,N=ve.inlineOutOfBoundsCorrection,Ie=ve.surfaceInlineProperty)}h==="move"&&(j=j-L,T=T-N),this.surfaceStylesInternal={display:"block",opacity:"1",[nt]:`${j}px`,[Ie]:`${T}px`},h==="resize"&&(L&&(this.surfaceStylesInternal.height=`${$.height-L}px`),N&&(this.surfaceStylesInternal.width=`${$.width-N}px`)),this.host.requestUpdate()}calculateBlock(e){const{surfaceRect:t,anchorRect:i,anchorBlock:r,surfaceBlock:s,yOffset:n,positioning:d,windowInnerHeight:h,blockScrollbarHeight:u}=e,m=d==="fixed"||d==="document"?1:0,b=d==="document"?1:0,x=s==="start"?1:0,g=s==="end"?1:0,k=(r!==s?1:0)*i.height+n,S=x*i.top+g*(h-i.bottom-u),$=x*window.scrollY-g*window.scrollY,C=Math.abs(Math.min(0,h-S-k-t.height));return{blockInset:m*S+b*$+k,blockOutOfBoundsCorrection:C,surfaceBlockProperty:s==="start"?"inset-block-start":"inset-block-end"}}calculateInline(e){const{isLTR:t,surfaceInline:i,anchorInline:r,anchorRect:s,surfaceRect:n,xOffset:d,positioning:h,windowInnerWidth:u,inlineScrollbarWidth:m}=e,b=h==="fixed"||h==="document"?1:0,x=h==="document"?1:0,g=t?1:0,w=t?0:1,k=i==="start"?1:0,S=i==="end"?1:0,C=(r!==i?1:0)*s.width+d,D=k*s.left+S*(u-s.right-m),P=k*(u-s.right-m)+S*s.left,z=g*D+w*P,ye=k*window.scrollX-S*window.scrollX,Ae=S*window.scrollX-k*window.scrollX,j=g*ye+w*Ae,L=Math.abs(Math.min(0,u-z-C-n.width)),nt=b*z+C+x*j;let T=i==="start"?"inset-inline-start":"inset-inline-end";return(h==="document"||h==="fixed")&&(i==="start"&&t||i==="end"&&!t?T="left":T="right"),{inlineInset:nt,inlineOutOfBoundsCorrection:L,surfaceInlineProperty:T}}hostUpdate(){this.onUpdate()}hostUpdated(){this.onUpdate()}async onUpdate(){const e=this.getProperties();let t=!1;for(const[n,d]of Object.entries(e))if(t=t||d!==this.lastValues[n],t)break;const i=this.lastValues.isOpen!==e.isOpen,r=!!e.anchorEl,s=!!e.surfaceEl;t&&r&&s&&(this.lastValues.isOpen=e.isOpen,e.isOpen?(this.lastValues=e,await this.position(),e.onOpen()):i&&(await e.beforeClose(),this.close(),e.onClose()))}close(){this.surfaceStylesInternal={display:"none"},this.host.requestUpdate();const e=this.getProperties().surfaceEl;e!=null&&e.popover&&(e!=null&&e.isConnected)&&e.hidePopover()}}/**
|
|
913
913
|
* @license
|
|
914
914
|
* Copyright 2023 Google LLC
|
|
915
915
|
* SPDX-License-Identifier: Apache-2.0
|
|
@@ -935,7 +935,7 @@ var ScbWcTest=function(o){"use strict";var Bl;function p(a,e,t,i){var r=argument
|
|
|
935
935
|
@activate-typeahead=${this.handleActivateTypeahead}
|
|
936
936
|
@stay-open-on-focusout=${this.handleStayOpenOnFocusout}
|
|
937
937
|
@close-on-focusout=${this.handleCloseOnFocusout}
|
|
938
|
-
@slotchange=${this.listController.onSlotchange}></slot>`}renderElevation(){return c`<md-elevation part="elevation"></md-elevation>`}getSurfaceClasses(){return{open:this.open,fixed:this.positioning==="fixed","has-overflow":this.hasOverflow}}captureKeydown(e){e.target===this&&!e.defaultPrevented&&pn(e.code)&&(e.preventDefault(),this.close()),this.typeaheadController.onKeydown(e)}async animateOpen(){const e=this.surfaceEl,t=this.slotEl;if(!e||!t)return!0;const i=this.openDirection;this.dispatchEvent(new Event("opening")),e.classList.toggle("animating",!0);const r=this.openCloseAnimationSignal.start(),s=e.offsetHeight,n=i==="UP",d=this.items,h=500,u=50,m=250,b=(h-m)/d.length,x=e.animate([{height:"0px"},{height:`${s}px`}],{duration:h,easing:ze.EMPHASIZED}),g=t.animate([{transform:n?`translateY(-${s}px)`:""},{transform:""}],{duration:h,easing:ze.EMPHASIZED}),w=e.animate([{opacity:0},{opacity:1}],u),k=[];for(let C=0;C<d.length;C++){const
|
|
938
|
+
@slotchange=${this.listController.onSlotchange}></slot>`}renderElevation(){return c`<md-elevation part="elevation"></md-elevation>`}getSurfaceClasses(){return{open:this.open,fixed:this.positioning==="fixed","has-overflow":this.hasOverflow}}captureKeydown(e){e.target===this&&!e.defaultPrevented&&pn(e.code)&&(e.preventDefault(),this.close()),this.typeaheadController.onKeydown(e)}async animateOpen(){const e=this.surfaceEl,t=this.slotEl;if(!e||!t)return!0;const i=this.openDirection;this.dispatchEvent(new Event("opening")),e.classList.toggle("animating",!0);const r=this.openCloseAnimationSignal.start(),s=e.offsetHeight,n=i==="UP",d=this.items,h=500,u=50,m=250,b=(h-m)/d.length,x=e.animate([{height:"0px"},{height:`${s}px`}],{duration:h,easing:ze.EMPHASIZED}),g=t.animate([{transform:n?`translateY(-${s}px)`:""},{transform:""}],{duration:h,easing:ze.EMPHASIZED}),w=e.animate([{opacity:0},{opacity:1}],u),k=[];for(let C=0;C<d.length;C++){const D=n?d.length-1-C:C,P=d[D],z=P.animate([{opacity:0},{opacity:1}],{duration:m,delay:b*C});P.classList.toggle("md-menu-hidden",!0),z.addEventListener("finish",()=>{P.classList.toggle("md-menu-hidden",!1)}),k.push([P,z])}let S=C=>{};const $=new Promise(C=>{S=C});return r.addEventListener("abort",()=>{x.cancel(),g.cancel(),w.cancel(),k.forEach(([C,D])=>{C.classList.toggle("md-menu-hidden",!1),D.cancel()}),S(!0)}),x.addEventListener("finish",()=>{e.classList.toggle("animating",!1),this.openCloseAnimationSignal.finish(),S(!1)}),await $}animateClose(){let e;const t=new Promise(z=>{e=z}),i=this.surfaceEl,r=this.slotEl;if(!i||!r)return e(!1),t;const n=this.openDirection==="UP";this.dispatchEvent(new Event("closing")),i.classList.toggle("animating",!0);const d=this.openCloseAnimationSignal.start(),h=i.offsetHeight,u=this.items,m=150,b=50,x=m-b,g=50,w=50,k=.35,S=(m-w-g)/u.length,$=i.animate([{height:`${h}px`},{height:`${h*k}px`}],{duration:m,easing:ze.EMPHASIZED_ACCELERATE}),C=r.animate([{transform:""},{transform:n?`translateY(-${h*(1-k)}px)`:""}],{duration:m,easing:ze.EMPHASIZED_ACCELERATE}),D=i.animate([{opacity:1},{opacity:0}],{duration:b,delay:x}),P=[];for(let z=0;z<u.length;z++){const ye=n?z:u.length-1-z,Ae=u[ye],j=Ae.animate([{opacity:1},{opacity:0}],{duration:g,delay:w+S*z});j.addEventListener("finish",()=>{Ae.classList.toggle("md-menu-hidden",!0)}),P.push([Ae,j])}return d.addEventListener("abort",()=>{$.cancel(),C.cancel(),D.cancel(),P.forEach(([z,ye])=>{ye.cancel(),z.classList.toggle("md-menu-hidden",!1)}),e(!1)}),$.addEventListener("finish",()=>{i.classList.toggle("animating",!1),P.forEach(([z])=>{z.classList.toggle("md-menu-hidden",!1)}),this.openCloseAnimationSignal.finish(),this.dispatchEvent(new Event("closed")),e(!0)}),t}handleKeydown(e){this.pointerPath=[],this.listController.handleKeydown(e)}setUpGlobalEventListeners(){document.addEventListener("click",this.onDocumentClick,{capture:!0}),window.addEventListener("pointerdown",this.onWindowPointerdown),document.addEventListener("resize",this.onWindowResize,{passive:!0}),window.addEventListener("resize",this.onWindowResize,{passive:!0})}cleanUpGlobalEventListeners(){document.removeEventListener("click",this.onDocumentClick,{capture:!0}),window.removeEventListener("pointerdown",this.onWindowPointerdown),document.removeEventListener("resize",this.onWindowResize),window.removeEventListener("resize",this.onWindowResize)}onCloseMenu(){this.close()}onDeactivateItems(e){e.stopPropagation(),this.listController.onDeactivateItems()}onRequestActivation(e){e.stopPropagation(),this.listController.onRequestActivation(e)}handleDeactivateTypeahead(e){e.stopPropagation(),this.typeaheadActive=!1}handleActivateTypeahead(e){e.stopPropagation(),this.typeaheadActive=!0}handleStayOpenOnFocusout(e){e.stopPropagation(),this.stayOpenOnFocusout=!0}handleCloseOnFocusout(e){e.stopPropagation(),this.stayOpenOnFocusout=!1}close(){this.open=!1,this.slotItems.forEach(t=>{var i;(i=t.close)==null||i.call(t)})}show(){this.open=!0}activateNextItem(){return this.listController.activateNextItem()??null}activatePreviousItem(){return this.listController.activatePreviousItem()??null}reposition(){this.open&&this.menuPositionController.position()}}p([A(".menu")],K.prototype,"surfaceEl",void 0),p([A("slot")],K.prototype,"slotEl",void 0),p([l()],K.prototype,"anchor",void 0),p([l()],K.prototype,"positioning",void 0),p([l({type:Boolean})],K.prototype,"quick",void 0),p([l({type:Boolean,attribute:"has-overflow"})],K.prototype,"hasOverflow",void 0),p([l({type:Boolean,reflect:!0})],K.prototype,"open",void 0),p([l({type:Number,attribute:"x-offset"})],K.prototype,"xOffset",void 0),p([l({type:Number,attribute:"y-offset"})],K.prototype,"yOffset",void 0),p([l({type:Number,attribute:"typeahead-delay"})],K.prototype,"typeaheadDelay",void 0),p([l({attribute:"anchor-corner"})],K.prototype,"anchorCorner",void 0),p([l({attribute:"menu-corner"})],K.prototype,"menuCorner",void 0),p([l({type:Boolean,attribute:"stay-open-on-outside-click"})],K.prototype,"stayOpenOnOutsideClick",void 0),p([l({type:Boolean,attribute:"stay-open-on-focusout"})],K.prototype,"stayOpenOnFocusout",void 0),p([l({type:Boolean,attribute:"skip-restore-focus"})],K.prototype,"skipRestoreFocus",void 0),p([l({attribute:"default-focus"})],K.prototype,"defaultFocus",void 0),p([l({type:Boolean,attribute:"no-navigation-wrap"})],K.prototype,"noNavigationWrap",void 0),p([ie({flatten:!0})],K.prototype,"slotItems",void 0),p([E()],K.prototype,"typeaheadActive",void 0);/**
|
|
939
939
|
* @license
|
|
940
940
|
* Copyright 2024 Google LLC
|
|
941
941
|
* SPDX-License-Identifier: Apache-2.0
|
|
@@ -4375,13 +4375,13 @@ ${this.value}</textarea
|
|
|
4375
4375
|
to { opacity: 0; }
|
|
4376
4376
|
}
|
|
4377
4377
|
|
|
4378
|
-
`,J([l({type:Boolean,reflect:!0})],o.ScbDialog.prototype,"open",2),J([l({type:Boolean,attribute:!1})],o.ScbDialog.prototype,"inSb",2),J([l({type:Boolean,attribute:"scrim-close"})],o.ScbDialog.prototype,"scrimClose",2),J([l({type:String})],o.ScbDialog.prototype,"variant",2),J([l({type:String})],o.ScbDialog.prototype,"label",2),J([l({type:String})],o.ScbDialog.prototype,"icon",2),J([l({type:String,attribute:"supporting-text"})],o.ScbDialog.prototype,"supportingText",2),J([l({type:String,attribute:"ok-button"})],o.ScbDialog.prototype,"okButton",2),J([l({type:String,attribute:"cancel-button"})],o.ScbDialog.prototype,"cancelButton",2),J([l({type:String,attribute:"delete-button"})],o.ScbDialog.prototype,"deleteButton",2),J([l({type:String,attribute:"confirm-button"})],o.ScbDialog.prototype,"confirmButton",2),J([l({type:String,attribute:"deny-button"})],o.ScbDialog.prototype,"denyButton",2),J([l({type:String,attribute:"reset-button"})],o.ScbDialog.prototype,"resetButton",2),J([l({type:String,attribute:"submit-button"})],o.ScbDialog.prototype,"submitButton",2),J([l({type:String,attribute:"form-id"})],o.ScbDialog.prototype,"formId",2),J([l({type:String,attribute:"form-action"})],o.ScbDialog.prototype,"formAction",2),J([l({type:String,attribute:"form-method"})],o.ScbDialog.prototype,"formMethod",2),o.ScbDialog=J([y("scb-dialog")],o.ScbDialog);var Xp=Object.defineProperty,Zp=Object.getOwnPropertyDescriptor,Ft=(a,e,t,i)=>{for(var r=i>1?void 0:i?Zp(e,t):e,s=a.length-1,n;s>=0;s--)(n=a[s])&&(r=(i?n(e,t,r):n(r))||r);return i&&r&&Xp(e,t,r),r};o.ScbCalendar=class extends _{constructor(){super(...arguments),this._lastActiveDay=null,this.lang="sv",this.disableWeekend=!1,this.publicHolidays=!0,this.displayYear=new Date().getFullYear(),this.displayMonth=new Date().getMonth()+1,this.selectedDate="",this._mutationObserver=null,this._syncingDisplay=!1,this._onCalendarKeyDown=e=>{var u,m;const i=Array.from(((u=this.shadowRoot)==null?void 0:u.querySelectorAll(".calendar-day.has-event"))??[]),r=(m=this.shadowRoot)==null?void 0:m.activeElement,s=r&&i.includes(r)?r:document.activeElement,n=i.indexOf(s);if(n===-1)return;let d=n;const h=this.disableWeekend?5:7;switch(e.key){case"ArrowRight":d=n+1<i.length?n+1:n;break;case"ArrowLeft":d=n-1>=0?n-1:n;break;case"ArrowDown":d=n+h<i.length?n+h:n;break;case"ArrowUp":d=n-h>=0?n-h:n;break;default:return}d!==n&&(e.preventDefault(),i[d].focus())},this._onEventChanged=()=>{this.requestUpdate()},this._today=new Date,this._current=new Date,this._popupEvent=null,this._restoreDayFocus=()=>{this._lastActiveDay&&setTimeout(()=>{var e;(e=this._lastActiveDay)==null||e.focus(),this._lastActiveDay=null},0)},this._easterDateCalculated={}}connectedCallback(){super.connectedCallback();const e=Number(this.displayYear),t=Number(this.displayMonth);!Number.isNaN(e)&&!Number.isNaN(t)&&t>=1&&t<=12&&(this._current=new Date(e,t-1,1)),this._syncDisplayFromCurrent(!1),this.addEventListener("change",this._onEventChanged),this._mutationObserver=new MutationObserver(()=>{this.requestUpdate()}),this._mutationObserver.observe(this,{childList:!0}),this.addEventListener("keydown",this._onCalendarKeyDown)}disconnectedCallback(){this.removeEventListener("change",this._onEventChanged),super.disconnectedCallback(),this._mutationObserver&&(this._mutationObserver.disconnect(),this._mutationObserver=null),this.removeEventListener("keydown",this._onCalendarKeyDown)}updated(e){var t;if((t=super.updated)==null||t.call(this,e),!this._syncingDisplay&&(e.has("displayYear")||e.has("displayMonth"))){const i=Number(this.displayYear),r=Number(this.displayMonth);if(!Number.isNaN(i)&&!Number.isNaN(r)&&r>=1&&r<=12){const s=this._current.getFullYear(),n=this._current.getMonth()+1;(s!==i||n!==r)&&(this._current=new Date(i,r-1,1),this.dispatchEvent(new CustomEvent("scb-calendar-month-change",{bubbles:!0,composed:!0,detail:{displayYear:i,displayMonth:r}})),this.requestUpdate())}}}_syncDisplayFromCurrent(e=!0){const t=this._current.getFullYear(),i=this._current.getMonth()+1;this._syncingDisplay=!0;try{this.displayYear=t,this.displayMonth=i}finally{this._syncingDisplay=!1}e&&this.dispatchEvent(new CustomEvent("scb-calendar-month-change",{bubbles:!0,composed:!0,detail:{displayYear:t,displayMonth:i}}))}_daysInMonth(e,t){return new Date(e,t+1,0).getDate()}_firstDayOfWeek(e,t){const i=new Date(e,t,1).getDay();return i===0?6:i-1}_prevMonth(){this._current=new Date(this._current.getFullYear(),this._current.getMonth()-1,1),this.selectedDate="",this._popupEvent=null,this._syncDisplayFromCurrent(),this.requestUpdate()}_nextMonth(){this._current=new Date(this._current.getFullYear(),this._current.getMonth()+1,1),this.selectedDate="",this._popupEvent=null,this._syncDisplayFromCurrent(),this.requestUpdate()}_showEventPopup(e){var t;this._popupEvent=e,this.selectedDate=e.date,this.dispatchEvent(new CustomEvent("scb-calendar-select",{bubbles:!0,composed:!0,detail:{selectedDate:e.date}})),this._lastActiveDay=((t=this.shadowRoot)==null?void 0:t.activeElement)||document.activeElement,this.requestUpdate(),this.updateComplete.then(()=>{var s;const i=(s=this.shadowRoot)==null?void 0:s.querySelector("scb-dialog");i&&(document.activeElement&&(i.__lastTriggerEl=document.activeElement),requestAnimationFrame(()=>{requestAnimationFrame(()=>{i.open=!0})}),i.addEventListener("close",this._restoreDayFocus,{once:!0}));const r=n=>{var d;(d=n.target)!=null&&d.closest(".event-popup")||this._closePopup()};window.addEventListener("mousedown",r,{once:!0})})}_closePopup(){var t;const e=(t=this.shadowRoot)==null?void 0:t.querySelector("scb-dialog");e&&e.removeAttribute("open"),this._popupEvent=null,this.requestUpdate()}_addDays(e,t){const i=new Date(e.valueOf());return i.setDate(i.getDate()+t),i}_easterDay(e){if(typeof this._easterDateCalculated["Ar"+e]<"u")return new Date(this._easterDateCalculated["Ar"+e]);let t=e;t<100&&(t=t+1900),t<1950&&(t=t+100);const i=t%19,r=t%4,s=t%7,n=(19*i+24)%30,d=(2*r+4*s+6*n+5)%7;let h=22+n+d,u=0;h==57&&(h-=7),h==56&&n==28&&d==6&&i>10&&(h-=7),h>31?(h-=31,u=4):u=3;const m=new Date(t,u-1,h);return this._easterDateCalculated["Ar"+e]=m,new Date(this._easterDateCalculated["Ar"+e])}_swedishHolidayName(e){const t=e.getMonth();if(t===1||t===6||t===7||t===8)return null;const i=e.getMonth()+1,r=e.getDate(),s=e.getFullYear(),n=this._easterDay(s),d=this.lang==="en",h=[["Nyårsdagen","New Year's Day",i===1&&r===1],["Trettondedag jul","Epiphany",i===1&&r===6],["Långfredag","Good Friday",+e==+this._addDays(n,-2)],["Påskdagen","Easter Sunday",+e==+n],["Annandag påsk","Easter Monday",+e==+this._addDays(n,1)],["Kristi himmelsfärdsdag","Ascension Day",+e==+this._addDays(n,39)],["Pingstdagen","Pentecost",+e==+this._addDays(n,50)&&s<2005],["Första maj","May Day",i===5&&r===1],["Nationaldagen","National Day",i===6&&r===6&&s>=2005],["Midsommarafton","Midsummer's Eve",i===6&&r>=19&&r<=25&&e.getDay()===5],["Midsommardagen","Midsummer's Day",i===6&&r>=20&&r<=26&&e.getDay()===6],["Julafton","Christmas Eve",i===12&&r===24],["Juldagen","Christmas Day",i===12&&r===25],["Annandag jul","Boxing Day",i===12&&r===26],["Alla helgons dag","All Saints' Day",i===10&&r>=31&&e.getDay()===6||i===11&&r<=6&&e.getDay()===6]];for(const u of h){const[m,b,x]=u;if(x)return d?b:m}return null}render(){const e=this._current.getFullYear(),t=this._current.getMonth(),i=this._daysInMonth(e,t),r=this._firstDayOfWeek(e,t),s=this._today,n=this.lang==="en",d=n?["January","February","March","April","May","June","July","August","September","October","November","December"]:["Januari","Februari","Mars","April","Maj","Juni","Juli","Augusti","September","Oktober","November","December"];let h=n?["Mon","Tue","Wed","Thu","Fri","Sat","Sun"]:["Mån","Tis","Ons","Tor","Fre","Lör","Sön"];this.disableWeekend&&(h=h.slice(0,5));const u=Array.from(this.querySelectorAll("scb-calendar-event")),m=new Map;for(const g of u){const w=g.getAttribute("start-date")||"",k=g.getAttribute("end-date")||"";if(w&&k){const S=new Date(w),$=new Date(k);for(let C=new Date(S);C<=$;C.setDate(C.getDate()+1)){const
|
|
4378
|
+
`,J([l({type:Boolean,reflect:!0})],o.ScbDialog.prototype,"open",2),J([l({type:Boolean,attribute:!1})],o.ScbDialog.prototype,"inSb",2),J([l({type:Boolean,attribute:"scrim-close"})],o.ScbDialog.prototype,"scrimClose",2),J([l({type:String})],o.ScbDialog.prototype,"variant",2),J([l({type:String})],o.ScbDialog.prototype,"label",2),J([l({type:String})],o.ScbDialog.prototype,"icon",2),J([l({type:String,attribute:"supporting-text"})],o.ScbDialog.prototype,"supportingText",2),J([l({type:String,attribute:"ok-button"})],o.ScbDialog.prototype,"okButton",2),J([l({type:String,attribute:"cancel-button"})],o.ScbDialog.prototype,"cancelButton",2),J([l({type:String,attribute:"delete-button"})],o.ScbDialog.prototype,"deleteButton",2),J([l({type:String,attribute:"confirm-button"})],o.ScbDialog.prototype,"confirmButton",2),J([l({type:String,attribute:"deny-button"})],o.ScbDialog.prototype,"denyButton",2),J([l({type:String,attribute:"reset-button"})],o.ScbDialog.prototype,"resetButton",2),J([l({type:String,attribute:"submit-button"})],o.ScbDialog.prototype,"submitButton",2),J([l({type:String,attribute:"form-id"})],o.ScbDialog.prototype,"formId",2),J([l({type:String,attribute:"form-action"})],o.ScbDialog.prototype,"formAction",2),J([l({type:String,attribute:"form-method"})],o.ScbDialog.prototype,"formMethod",2),o.ScbDialog=J([y("scb-dialog")],o.ScbDialog);var Xp=Object.defineProperty,Zp=Object.getOwnPropertyDescriptor,Ft=(a,e,t,i)=>{for(var r=i>1?void 0:i?Zp(e,t):e,s=a.length-1,n;s>=0;s--)(n=a[s])&&(r=(i?n(e,t,r):n(r))||r);return i&&r&&Xp(e,t,r),r};o.ScbCalendar=class extends _{constructor(){super(...arguments),this._lastActiveDay=null,this.lang="sv",this.disableWeekend=!1,this.publicHolidays=!0,this.displayYear=new Date().getFullYear(),this.displayMonth=new Date().getMonth()+1,this.selectedDate="",this._mutationObserver=null,this._syncingDisplay=!1,this._onCalendarKeyDown=e=>{var u,m;const i=Array.from(((u=this.shadowRoot)==null?void 0:u.querySelectorAll(".calendar-day.has-event"))??[]),r=(m=this.shadowRoot)==null?void 0:m.activeElement,s=r&&i.includes(r)?r:document.activeElement,n=i.indexOf(s);if(n===-1)return;let d=n;const h=this.disableWeekend?5:7;switch(e.key){case"ArrowRight":d=n+1<i.length?n+1:n;break;case"ArrowLeft":d=n-1>=0?n-1:n;break;case"ArrowDown":d=n+h<i.length?n+h:n;break;case"ArrowUp":d=n-h>=0?n-h:n;break;default:return}d!==n&&(e.preventDefault(),i[d].focus())},this._onEventChanged=()=>{this.requestUpdate()},this._today=new Date,this._current=new Date,this._popupEvent=null,this._restoreDayFocus=()=>{this._lastActiveDay&&setTimeout(()=>{var e;(e=this._lastActiveDay)==null||e.focus(),this._lastActiveDay=null},0)},this._easterDateCalculated={}}connectedCallback(){super.connectedCallback();const e=Number(this.displayYear),t=Number(this.displayMonth);!Number.isNaN(e)&&!Number.isNaN(t)&&t>=1&&t<=12&&(this._current=new Date(e,t-1,1)),this._syncDisplayFromCurrent(!1),this.addEventListener("change",this._onEventChanged),this._mutationObserver=new MutationObserver(()=>{this.requestUpdate()}),this._mutationObserver.observe(this,{childList:!0}),this.addEventListener("keydown",this._onCalendarKeyDown)}disconnectedCallback(){this.removeEventListener("change",this._onEventChanged),super.disconnectedCallback(),this._mutationObserver&&(this._mutationObserver.disconnect(),this._mutationObserver=null),this.removeEventListener("keydown",this._onCalendarKeyDown)}updated(e){var t;if((t=super.updated)==null||t.call(this,e),!this._syncingDisplay&&(e.has("displayYear")||e.has("displayMonth"))){const i=Number(this.displayYear),r=Number(this.displayMonth);if(!Number.isNaN(i)&&!Number.isNaN(r)&&r>=1&&r<=12){const s=this._current.getFullYear(),n=this._current.getMonth()+1;(s!==i||n!==r)&&(this._current=new Date(i,r-1,1),this.dispatchEvent(new CustomEvent("scb-calendar-month-change",{bubbles:!0,composed:!0,detail:{displayYear:i,displayMonth:r}})),this.requestUpdate())}}}_syncDisplayFromCurrent(e=!0){const t=this._current.getFullYear(),i=this._current.getMonth()+1;this._syncingDisplay=!0;try{this.displayYear=t,this.displayMonth=i}finally{this._syncingDisplay=!1}e&&this.dispatchEvent(new CustomEvent("scb-calendar-month-change",{bubbles:!0,composed:!0,detail:{displayYear:t,displayMonth:i}}))}_daysInMonth(e,t){return new Date(e,t+1,0).getDate()}_firstDayOfWeek(e,t){const i=new Date(e,t,1).getDay();return i===0?6:i-1}_prevMonth(){this._current=new Date(this._current.getFullYear(),this._current.getMonth()-1,1),this.selectedDate="",this._popupEvent=null,this._syncDisplayFromCurrent(),this.requestUpdate()}_nextMonth(){this._current=new Date(this._current.getFullYear(),this._current.getMonth()+1,1),this.selectedDate="",this._popupEvent=null,this._syncDisplayFromCurrent(),this.requestUpdate()}_showEventPopup(e){var t;this._popupEvent=e,this.selectedDate=e.date,this.dispatchEvent(new CustomEvent("scb-calendar-select",{bubbles:!0,composed:!0,detail:{selectedDate:e.date}})),this._lastActiveDay=((t=this.shadowRoot)==null?void 0:t.activeElement)||document.activeElement,this.requestUpdate(),this.updateComplete.then(()=>{var s;const i=(s=this.shadowRoot)==null?void 0:s.querySelector("scb-dialog");i&&(document.activeElement&&(i.__lastTriggerEl=document.activeElement),requestAnimationFrame(()=>{requestAnimationFrame(()=>{i.open=!0})}),i.addEventListener("close",this._restoreDayFocus,{once:!0}));const r=n=>{var d;(d=n.target)!=null&&d.closest(".event-popup")||this._closePopup()};window.addEventListener("mousedown",r,{once:!0})})}_closePopup(){var t;const e=(t=this.shadowRoot)==null?void 0:t.querySelector("scb-dialog");e&&e.removeAttribute("open"),this._popupEvent=null,this.requestUpdate()}_addDays(e,t){const i=new Date(e.valueOf());return i.setDate(i.getDate()+t),i}_easterDay(e){if(typeof this._easterDateCalculated["Ar"+e]<"u")return new Date(this._easterDateCalculated["Ar"+e]);let t=e;t<100&&(t=t+1900),t<1950&&(t=t+100);const i=t%19,r=t%4,s=t%7,n=(19*i+24)%30,d=(2*r+4*s+6*n+5)%7;let h=22+n+d,u=0;h==57&&(h-=7),h==56&&n==28&&d==6&&i>10&&(h-=7),h>31?(h-=31,u=4):u=3;const m=new Date(t,u-1,h);return this._easterDateCalculated["Ar"+e]=m,new Date(this._easterDateCalculated["Ar"+e])}_swedishHolidayName(e){const t=e.getMonth();if(t===1||t===6||t===7||t===8)return null;const i=e.getMonth()+1,r=e.getDate(),s=e.getFullYear(),n=this._easterDay(s),d=this.lang==="en",h=[["Nyårsdagen","New Year's Day",i===1&&r===1],["Trettondedag jul","Epiphany",i===1&&r===6],["Långfredag","Good Friday",+e==+this._addDays(n,-2)],["Påskdagen","Easter Sunday",+e==+n],["Annandag påsk","Easter Monday",+e==+this._addDays(n,1)],["Kristi himmelsfärdsdag","Ascension Day",+e==+this._addDays(n,39)],["Pingstdagen","Pentecost",+e==+this._addDays(n,50)&&s<2005],["Första maj","May Day",i===5&&r===1],["Nationaldagen","National Day",i===6&&r===6&&s>=2005],["Midsommarafton","Midsummer's Eve",i===6&&r>=19&&r<=25&&e.getDay()===5],["Midsommardagen","Midsummer's Day",i===6&&r>=20&&r<=26&&e.getDay()===6],["Julafton","Christmas Eve",i===12&&r===24],["Juldagen","Christmas Day",i===12&&r===25],["Annandag jul","Boxing Day",i===12&&r===26],["Alla helgons dag","All Saints' Day",i===10&&r>=31&&e.getDay()===6||i===11&&r<=6&&e.getDay()===6]];for(const u of h){const[m,b,x]=u;if(x)return d?b:m}return null}render(){const e=this._current.getFullYear(),t=this._current.getMonth(),i=this._daysInMonth(e,t),r=this._firstDayOfWeek(e,t),s=this._today,n=this.lang==="en",d=n?["January","February","March","April","May","June","July","August","September","October","November","December"]:["Januari","Februari","Mars","April","Maj","Juni","Juli","Augusti","September","Oktober","November","December"];let h=n?["Mon","Tue","Wed","Thu","Fri","Sat","Sun"]:["Mån","Tis","Ons","Tor","Fre","Lör","Sön"];this.disableWeekend&&(h=h.slice(0,5));const u=Array.from(this.querySelectorAll("scb-calendar-event")),m=new Map;for(const g of u){const w=g.getAttribute("start-date")||"",k=g.getAttribute("end-date")||"";if(w&&k){const S=new Date(w),$=new Date(k);for(let C=new Date(S);C<=$;C.setDate(C.getDate()+1)){const D=C.toISOString().split("T")[0],P=m.get(D)||[];P.push({title:g.title,description:g.description,start:w,end:k}),m.set(D,P)}}else if(w&&g.title){const S=w.split("T")[0],$=m.get(S)||[];$.push({title:g.title,description:g.description,start:w}),m.set(S,$)}}const b=[];let x=1;for(let g=0;g<6;g++){const w=[],k=this.disableWeekend?[0,1,2,3,4]:[0,1,2,3,4,5,6];let S=x;for(let $=0;$<k.length;$++){const C=k[$];if(g===0&&C<r){if(!this.disableWeekend||C<5){const D=t===0?11:t-1,P=t===0?e-1:e,ye=this._daysInMonth(P,D)-(r-C-1);w.push(c`
|
|
4379
4379
|
<div class="calendar-day calendar-day--other">
|
|
4380
4380
|
<span class="calendar-day-number">${ye}</span>
|
|
4381
4381
|
</div>
|
|
4382
|
-
`)}}else if(S>i)w.push(c`<div></div>`);else{let
|
|
4382
|
+
`)}}else if(S>i)w.push(c`<div></div>`);else{let D=new Date(e,t,S);if(this.disableWeekend)for(;D.getDay()===0||D.getDay()===6;)S++,D=new Date(e,t,S);if(S>i){w.push(c`<div></div>`);continue}const P=s.getFullYear()===e&&s.getMonth()===t&&s.getDate()===S,z=`${e}-${String(t+1).padStart(2,"0")}-${String(S).padStart(2,"0")}`,ye=new Date(e,t,S);let Ae=!1,j=null;this.publicHolidays&&(j=this._swedishHolidayName(ye),Ae=!!j);let L=m.get(z)||[];L=[...L].sort((T,N)=>{const Ie=T.start&&z===T.start.split("T")[0]?T.start:T.end&&z===T.end.split("T")[0]?T.end:"",_e=N.start&&z===N.start.split("T")[0]?N.start:N.end&&N.end.split("T")[0]?N.end:"",He=Ie&&Ie.includes("T"),ve=_e&&_e.includes("T");return He&&ve?Ie.localeCompare(_e):He?-1:ve?1:T.title.localeCompare(N.title)});const nt=[...L].map(T=>{let N="",Ie="";if(T.start&&T.end){const _e=T.start.split("T")[0],He=T.end.split("T")[0];z===_e&&z===He&&T.start.includes("T")&&T.end.includes("T")?N=T.start.split("T")[1].substring(0,5)+"–"+T.end.split("T")[1].substring(0,5):z===_e&&T.start.includes("T")?N=T.start.split("T")[1].substring(0,5):z===He&&T.end.includes("T")?(N=T.end.split("T")[1].substring(0,5),Ie=n?"cont. ":"fort. "):z!==_e&&(N="",Ie=n?"cont. ":"fort. ")}else T.start&&T.start.includes("T")&&(N=T.start.split("T")[1].substring(0,5));return{...T,time:N,prefix:Ie}});w.push(c`
|
|
4383
4383
|
<div
|
|
4384
|
-
class="calendar-day${
|
|
4384
|
+
class="calendar-day${P?" today":""}${L.length?" has-event":""}${Ae?" calendar-day--holiday":""}"
|
|
4385
4385
|
tabindex=${L.length?"0":void 0}
|
|
4386
4386
|
@click=${L.length?()=>this._showEventPopup({date:z,events:L}):null}
|
|
4387
4387
|
@keydown=${L.length?T=>{(T.key==="Enter"||T.key===" ")&&(T.preventDefault(),this._showEventPopup({date:z,events:L}))}:null}
|
|
@@ -4410,7 +4410,7 @@ ${this.value}</textarea
|
|
|
4410
4410
|
${this._popupEvent&&Array.isArray(this._popupEvent.events)?c`
|
|
4411
4411
|
<scb-dialog variant="floating" open label="${n?"Events":"Händelser"} ${this._popupEvent.date}">
|
|
4412
4412
|
<scb-list>
|
|
4413
|
-
${[...this._popupEvent.events].sort((g,w)=>{const k=g.start&&g.start.includes("T")?g.start:g.end&&g.end.includes("T")?g.end:"",S=w.start&&w.start.includes("T")?w.start:w.end&&w.end.includes("T")?w.end:"",$=k&&k.includes("T"),C=S&&S.includes("T");return $&&C?k.localeCompare(S):$?-1:C?1:g.title.localeCompare(w.title)}).map(g=>{var C;const w=((C=this._popupEvent)==null?void 0:C.date)??"";let k="",S="",$="";if(g.start&&g.end){const
|
|
4413
|
+
${[...this._popupEvent.events].sort((g,w)=>{const k=g.start&&g.start.includes("T")?g.start:g.end&&g.end.includes("T")?g.end:"",S=w.start&&w.start.includes("T")?w.start:w.end&&w.end.includes("T")?w.end:"",$=k&&k.includes("T"),C=S&&S.includes("T");return $&&C?k.localeCompare(S):$?-1:C?1:g.title.localeCompare(w.title)}).map(g=>{var C;const w=((C=this._popupEvent)==null?void 0:C.date)??"";let k="",S="",$="";if(g.start&&g.end){const D=g.start.split("T")[0],P=g.end.split("T")[0];D===P&&g.start.includes("T")&&g.end.includes("T")?k=g.start.split("T")[1].substring(0,5)+" – "+g.end.split("T")[1].substring(0,5):w===D&&g.start.includes("T")&&(k="Start: "+g.start.split("T")[1].substring(0,5)+(n?" (Extended event) ":" (Flerdagsevenemang) ")),w===P&&g.end.includes("T")&&D!==P&&($=(n?"End: ":"Slut: ")+g.end.split("T")[1].substring(0,5)),w!==D&&(S=n?"cont. ":"fort. ")}else g.start&&g.start.includes("T")&&(k=g.start.split("T")[1].substring(0,5));return c`
|
|
4414
4414
|
<scb-list-item label="${S}${g.title}" supporting-text="${g.description?g.description:""}" overline="${k||""}${$||""}">
|
|
4415
4415
|
</scb-list-item>`})}
|
|
4416
4416
|
</scb-list>
|
|
@@ -4766,7 +4766,7 @@ ${this.value}</textarea
|
|
|
4766
4766
|
overflow: visible;
|
|
4767
4767
|
text-overflow: clip;
|
|
4768
4768
|
}
|
|
4769
|
-
`,U([l({type:String,reflect:!0})],o.ScbCalendarCard.prototype,"variant",2),U([l({type:String,reflect:!0})],o.ScbCalendarCard.prototype,"direction",2),U([l({type:String,reflect:!0})],o.ScbCalendarCard.prototype,"title",2),U([l({type:String,reflect:!0})],o.ScbCalendarCard.prototype,"subtitle",2),U([l({type:String,attribute:"supporting-text",reflect:!0})],o.ScbCalendarCard.prototype,"supportingText",2),U([l({type:String,attribute:"card-href"})],o.ScbCalendarCard.prototype,"cardHref",2),U([l({type:String,attribute:"card-href-nav"})],o.ScbCalendarCard.prototype,"cardHrefNav",2),U([l({type:Boolean,reflect:!0,attribute:"show-media"})],o.ScbCalendarCard.prototype,"showMedia",2),U([l({type:String,attribute:"media-width"})],o.ScbCalendarCard.prototype,"mediaWidth",2),U([l({type:String,attribute:"media-height"})],o.ScbCalendarCard.prototype,"mediaHeight",2),U([l({type:String,attribute:"media-aspect"})],o.ScbCalendarCard.prototype,"mediaAspect",2),U([l({type:String,reflect:!0})],o.ScbCalendarCard.prototype,"width",2),U([l({type:String,reflect:!0,attribute:"max-width"})],o.ScbCalendarCard.prototype,"maxWidth",2),U([l({type:String,attribute:"min-width"})],o.ScbCalendarCard.prototype,"minWidth",2),U([l({type:String,reflect:!0})],o.ScbCalendarCard.prototype,"height",2),U([l({type:String,reflect:!0,attribute:"max-height"})],o.ScbCalendarCard.prototype,"maxHeight",2),U([l({type:String,attribute:"min-height"})],o.ScbCalendarCard.prototype,"minHeight",2),U([l({type:String,reflect:!0})],o.ScbCalendarCard.prototype,"sizing",2),U([l({type:String,reflect:!0})],o.ScbCalendarCard.prototype,"spacing",2),U([l({type:String,attribute:"spacing-top",reflect:!0})],o.ScbCalendarCard.prototype,"spacingTop",2),U([l({type:String,attribute:"spacing-bottom",reflect:!0})],o.ScbCalendarCard.prototype,"spacingBottom",2),o.ScbCalendarCard=U([y("scb-calendar-card")],o.ScbCalendarCard);var iu=Object.defineProperty,ru=Object.getOwnPropertyDescriptor,cl=a=>{throw TypeError(a)},
|
|
4769
|
+
`,U([l({type:String,reflect:!0})],o.ScbCalendarCard.prototype,"variant",2),U([l({type:String,reflect:!0})],o.ScbCalendarCard.prototype,"direction",2),U([l({type:String,reflect:!0})],o.ScbCalendarCard.prototype,"title",2),U([l({type:String,reflect:!0})],o.ScbCalendarCard.prototype,"subtitle",2),U([l({type:String,attribute:"supporting-text",reflect:!0})],o.ScbCalendarCard.prototype,"supportingText",2),U([l({type:String,attribute:"card-href"})],o.ScbCalendarCard.prototype,"cardHref",2),U([l({type:String,attribute:"card-href-nav"})],o.ScbCalendarCard.prototype,"cardHrefNav",2),U([l({type:Boolean,reflect:!0,attribute:"show-media"})],o.ScbCalendarCard.prototype,"showMedia",2),U([l({type:String,attribute:"media-width"})],o.ScbCalendarCard.prototype,"mediaWidth",2),U([l({type:String,attribute:"media-height"})],o.ScbCalendarCard.prototype,"mediaHeight",2),U([l({type:String,attribute:"media-aspect"})],o.ScbCalendarCard.prototype,"mediaAspect",2),U([l({type:String,reflect:!0})],o.ScbCalendarCard.prototype,"width",2),U([l({type:String,reflect:!0,attribute:"max-width"})],o.ScbCalendarCard.prototype,"maxWidth",2),U([l({type:String,attribute:"min-width"})],o.ScbCalendarCard.prototype,"minWidth",2),U([l({type:String,reflect:!0})],o.ScbCalendarCard.prototype,"height",2),U([l({type:String,reflect:!0,attribute:"max-height"})],o.ScbCalendarCard.prototype,"maxHeight",2),U([l({type:String,attribute:"min-height"})],o.ScbCalendarCard.prototype,"minHeight",2),U([l({type:String,reflect:!0})],o.ScbCalendarCard.prototype,"sizing",2),U([l({type:String,reflect:!0})],o.ScbCalendarCard.prototype,"spacing",2),U([l({type:String,attribute:"spacing-top",reflect:!0})],o.ScbCalendarCard.prototype,"spacingTop",2),U([l({type:String,attribute:"spacing-bottom",reflect:!0})],o.ScbCalendarCard.prototype,"spacingBottom",2),o.ScbCalendarCard=U([y("scb-calendar-card")],o.ScbCalendarCard);var iu=Object.defineProperty,ru=Object.getOwnPropertyDescriptor,cl=a=>{throw TypeError(a)},O=(a,e,t,i)=>{for(var r=i>1?void 0:i?ru(e,t):e,s=a.length-1,n;s>=0;s--)(n=a[s])&&(r=(i?n(e,t,r):n(r))||r);return i&&r&&iu(e,t,r),r},au=(a,e,t)=>e.has(a)||cl("Cannot "+t),ou=(a,e,t)=>e.has(a)?cl("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(a):e.set(a,t),dl=(a,e,t)=>(au(a,e,"access private method"),t),la,Qo;o.ScbCard=class extends _{constructor(){super(...arguments),ou(this,la),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.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();if(!t||e.button!==0||e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;const i=e.target;i!=null&&i.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 i=t.includes("/")?t.split("/"):t.includes(":")?t.split(":"):t.includes("x")?t.split("x"):null;if(i&&i.length===2){const s=Number(i[0]),n=Number(i[1]);if(s>0&&n>0)return{w:s,h:n}}const r=Number(t);return isFinite(r)&&r>0?{w:1e3,h:Math.round(1e3/r)}:{w:640,h:360}}__mediaTemplate(){if((this.mediaType||"").toLowerCase()==="avatar")return c`
|
|
4770
4770
|
<div class="media">
|
|
4771
4771
|
<slot name="media">
|
|
4772
4772
|
<scb-avatar variant="icon" label="${this.title}" icon-name="person"></scb-avatar>
|
|
@@ -4825,7 +4825,7 @@ ${this.value}</textarea
|
|
|
4825
4825
|
<slot></slot>
|
|
4826
4826
|
</div>
|
|
4827
4827
|
</div>
|
|
4828
|
-
`);case"social":return h(c`
|
|
4828
|
+
`);case"social":const u=this.commentsHref,m=b=>{b.stopPropagation()};return h(c`
|
|
4829
4829
|
<div class="full-content">
|
|
4830
4830
|
<div class="top-content">
|
|
4831
4831
|
${this.title?c`<div class="header">${n(i)}</div>`:""}
|
|
@@ -4835,14 +4835,28 @@ ${this.value}</textarea
|
|
|
4835
4835
|
</div>
|
|
4836
4836
|
<div class="content">
|
|
4837
4837
|
<div class="social-metrics">
|
|
4838
|
-
|
|
4838
|
+
${u!==""?c`
|
|
4839
|
+
<a class="comments" href="${u}" tabindex="0" @click=${m}
|
|
4839
4840
|
><md-icon>mode_comment</md-icon>
|
|
4840
|
-
<span>${this.commentsText}: ${this.comments}</span></
|
|
4841
|
+
<span>${this.commentsText}: ${this.comments}</span></a
|
|
4841
4842
|
>
|
|
4843
|
+
`:c`
|
|
4844
|
+
<span class="comments" href="${u}" tabindex="0" @click=${m}
|
|
4845
|
+
><md-icon>mode_comment</md-icon>
|
|
4846
|
+
<span>${this.commentsText}: ${this.comments}</span></span
|
|
4847
|
+
>`}
|
|
4848
|
+
|
|
4842
4849
|
<span class="likes"
|
|
4843
|
-
|
|
4844
|
-
|
|
4850
|
+
style="cursor:pointer;"
|
|
4851
|
+
tabindex="0"
|
|
4852
|
+
@click=${b=>{b.stopPropagation(),this.dispatchEvent(new CustomEvent("like-click",{bubbles:!0,composed:!0}))}}
|
|
4853
|
+
@keydown=${b=>{(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),b.stopPropagation(),this.dispatchEvent(new CustomEvent("like-click",{bubbles:!0,composed:!0})))}}
|
|
4854
|
+
role="button"
|
|
4855
|
+
aria-label="${this.likesText||"Like"}"
|
|
4845
4856
|
>
|
|
4857
|
+
<md-icon>thumb_up</md-icon>
|
|
4858
|
+
<span>${this.likesText}: ${this.likes}</span>
|
|
4859
|
+
</span>
|
|
4846
4860
|
</div>
|
|
4847
4861
|
</div>
|
|
4848
4862
|
</div>
|
|
@@ -4985,6 +4999,20 @@ ${this.value}</textarea
|
|
|
4985
4999
|
.scb-card.clickable {
|
|
4986
5000
|
cursor: pointer;
|
|
4987
5001
|
}
|
|
5002
|
+
.social-metrics a.comments {
|
|
5003
|
+
color: var(--md-sys-color-primary);
|
|
5004
|
+
text-decoration: none;
|
|
5005
|
+
border-radius: 4px;
|
|
5006
|
+
cursor: pointer;
|
|
5007
|
+
outline: none;
|
|
5008
|
+
}
|
|
5009
|
+
.social-metrics a.comments:hover,
|
|
5010
|
+
.social-metrics a.comments:focus {
|
|
5011
|
+
color: var(--md-sys-color-primary);
|
|
5012
|
+
text-decoration: var(--scb-link-decoration, underline);
|
|
5013
|
+
text-underline-offset: var(--scb-link-underline-offset, .22em);
|
|
5014
|
+
text-decoration-thickness: var(--scb-link-underline-thickness, 1px);
|
|
5015
|
+
}
|
|
4988
5016
|
|
|
4989
5017
|
md-ripple {
|
|
4990
5018
|
position: absolute;
|
|
@@ -5184,7 +5212,7 @@ ${this.value}</textarea
|
|
|
5184
5212
|
.scb-card.filled .content.list ::slotted(scb-list) {
|
|
5185
5213
|
--scb-list-bg: var(--md-sys-color-surface-dim);
|
|
5186
5214
|
}
|
|
5187
|
-
`,
|
|
5215
|
+
`,O([l({type:String,reflect:!0})],o.ScbCard.prototype,"type",2),O([l({type:String,reflect:!0})],o.ScbCard.prototype,"variant",2),O([l({type:String,reflect:!0})],o.ScbCard.prototype,"direction",2),O([l({type:String,attribute:"media-type"})],o.ScbCard.prototype,"mediaType",2),O([l({type:String,attribute:"media-href"})],o.ScbCard.prototype,"mediaHref",2),O([l({type:String,attribute:"media-alt"})],o.ScbCard.prototype,"mediaAlt",2),O([l({type:String,attribute:"media-srcset"})],o.ScbCard.prototype,"mediaSrcset",2),O([l({type:String,attribute:"media-sizes"})],o.ScbCard.prototype,"mediaSizes",2),O([l({type:String,attribute:"media-loading"})],o.ScbCard.prototype,"mediaLoading",2),O([l({type:String,attribute:"media-decoding"})],o.ScbCard.prototype,"mediaDecoding",2),O([l({type:String,attribute:"media-fetchpriority"})],o.ScbCard.prototype,"mediaFetchPriority",2),O([l({type:String,attribute:"media-fit"})],o.ScbCard.prototype,"mediaFit",2),O([l({type:String,attribute:"media-position"})],o.ScbCard.prototype,"mediaPosition",2),O([l({type:String,attribute:"media-width"})],o.ScbCard.prototype,"mediaWidth",2),O([l({type:String,attribute:"media-height"})],o.ScbCard.prototype,"mediaHeight",2),O([l({type:String,attribute:"media-aspect"})],o.ScbCard.prototype,"mediaAspect",2),O([l({type:Boolean,attribute:"media-placeholder"})],o.ScbCard.prototype,"mediaPlaceholder",2),O([l({type:String,attribute:"card-href",reflect:!0})],o.ScbCard.prototype,"cardHref",2),O([l({type:String,reflect:!0})],o.ScbCard.prototype,"title",2),O([l({type:String,reflect:!0})],o.ScbCard.prototype,"subtitle",2),O([l({type:String,attribute:"supporting-text",reflect:!0})],o.ScbCard.prototype,"supportingText",2),O([l({type:Date,reflect:!0})],o.ScbCard.prototype,"date",2),O([l({type:String,attribute:"social-comments-text",reflect:!0})],o.ScbCard.prototype,"commentsText",2),O([l({type:Number,attribute:"social-comments",reflect:!0})],o.ScbCard.prototype,"comments",2),O([l({type:String,attribute:"social-comments-href",reflect:!0})],o.ScbCard.prototype,"commentsHref",2),O([l({type:String,attribute:"social-likes-text",reflect:!0})],o.ScbCard.prototype,"likesText",2),O([l({type:Number,attribute:"social-likes",reflect:!0})],o.ScbCard.prototype,"likes",2),O([l({type:String,reflect:!0})],o.ScbCard.prototype,"sizing",2),O([l({type:String,reflect:!0})],o.ScbCard.prototype,"width",2),O([l({type:String,reflect:!0,attribute:"max-width"})],o.ScbCard.prototype,"maxWidth",2),O([l({type:String,reflect:!0})],o.ScbCard.prototype,"height",2),O([l({type:String,reflect:!0,attribute:"max-height"})],o.ScbCard.prototype,"maxHeight",2),O([l({type:String,reflect:!0})],o.ScbCard.prototype,"spacing",2),O([l({type:String,attribute:"spacing-top",reflect:!0})],o.ScbCard.prototype,"spacingTop",2),O([l({type:String,attribute:"spacing-bottom",reflect:!0})],o.ScbCard.prototype,"spacingBottom",2),o.ScbCard=O([y("scb-card")],o.ScbCard);var su=Object.defineProperty,nu=Object.getOwnPropertyDescriptor,Ht=(a,e,t,i)=>{for(var r=i>1?void 0:i?nu(e,t):e,s=a.length-1,n;s>=0;s--)(n=a[s])&&(r=(i?n(e,t,r):n(r))||r);return i&&r&&su(e,t,r),r};o.ScbCollapse=class extends _{constructor(){super(...arguments),this._contentId=`scb-collapse-content-${Math.random().toString(36).substr(2,9)}`,this.variant="elements",this.collapsedHeight=40,this.visibleElements=1,this.expanded=!1,this._elementCount=0,this.expandButtonLabel="Mer",this.collapseButtonLabel="Mindre",this._contentHeight=0}get _regionLabel(){return`${this.expanded?this.collapseButtonLabel:this.expandButtonLabel} – ${this._contentId}`}toggle(){this.expanded=!this.expanded}firstUpdated(){var t;this._measureContent(),this._countElements();const e=(t=this.shadowRoot)==null?void 0:t.querySelector("slot");e&&e.addEventListener("slotchange",()=>{this._measureContent(),this._countElements()})}updated(e){(e.has("collapsed-height")||e.has("expanded"))&&this._measureContent(),(e.has("visible-elements")||e.has("variant"))&&this._countElements()}_measureContent(){var e;if(this.variant==="height"){const t=(e=this.shadowRoot)==null?void 0:e.querySelector("slot");if(t){const i=t.assignedNodes({flatten:!0});let r=0;i.forEach(s=>{if(s.nodeType===Node.ELEMENT_NODE){const n=s;r+=n.offsetHeight||n.scrollHeight||0}}),this._contentHeight=r,this.requestUpdate()}}}_countElements(){var e;if(this.variant==="elements"){const t=(e=this.shadowRoot)==null?void 0:e.querySelector("slot");if(t){const i=t.assignedNodes({flatten:!0});this._elementCount=i.filter(r=>r.nodeType===Node.ELEMENT_NODE).length,this.requestUpdate()}}}render(){if(this.variant==="height"){const e=this.expanded?`${this._contentHeight}px`:`${this.collapsedHeight}px`,t=this._contentHeight>this.collapsedHeight;return c`
|
|
5188
5216
|
<div
|
|
5189
5217
|
class="collapse-content"
|
|
5190
5218
|
id="${this._contentId}"
|
|
@@ -8119,7 +8147,7 @@ ${this.value}</textarea
|
|
|
8119
8147
|
position: relative;
|
|
8120
8148
|
gap: 0;
|
|
8121
8149
|
}
|
|
8122
|
-
`,ma([l({type:Number,reflect:!0,attribute:"progress-width",hasChanged:(a,e)=>a!==e})],o.ScbProgressStepper.prototype,"progressWidth",2),ma([l({type:String,reflect:!0})],o.ScbProgressStepper.prototype,"height",2),ma([l({type:String,reflect:!0})],o.ScbProgressStepper.prototype,"position",2),o.ScbProgressStepper=ma([y("scb-progress-stepper")],o.ScbProgressStepper);var xv=Object.getOwnPropertyDescriptor,wv=(a,e,t,i)=>{for(var r=i>1?void 0:i?xv(e,t):e,s=a.length-1,n;s>=0;s--)(n=a[s])&&(r=n(r)||r);return r};o.ScbScrollspy=class extends _{constructor(){super(...arguments),this.navSelector="",this.offsetTop=0,this.offsetBottom=0,this.updateHash=!0,this.activeId="",this.layout="",this.sidebarNavWidth="320px",this.sidebarHeight="560px",this.stackHeight="",this.sidebarNavTop="0px",this.contentPadding="0px",this.__navEl=null,this.__contentEl=null,this.__contentShellEl=null,this.__links=[],this.__observer=null,this.__fallbackScrollRoot=null,this.__entries=new Map,this.__rafId=null,this.__scrollRafId=null,this.__hashAllowUpdates=!1,this.__hashBaselineReady=!1,this.__hashBaselinePos=0,this.__hashBaselineRafId=null,this.__hashScrollRoot=null,this.__hashSuspend=!1,this.__hashInitialApplied=!1,this.__onHashScrollBound=()=>this.__onHashScroll(),this.__scrollAnimSeq=0,this.__motionMeasureEl=null,this.__focusableRafId=null,this.__autoOffsetTop=0,this.__autoOffsetRafId=null,this.__navResizeObserver=null,this.__onNavClickBound=e=>this.__onNavClick(e),this.__onScrollFallbackBound=()=>this.__updateActiveFromRects(),this.__onResizeBound=()=>{this.__requestActiveRecalc(),this.__requestAutoOffsetMeasure()},this.__onSlotChange=()=>{const e=this.__navEl;this.__teardown(),this.__resolveSlots(),this.__requestEnsureContentFocusable(),this.__navEl&&this.__navEl.addEventListener("click",this.__onNavClickBound,!0),(e!==this.__navEl||!this.__links.length)&&this.__collectLinks(),this.__requestAutoOffsetMeasure(),this.__rebuildObserver(),this.__attachHashScrollRoot(),this.__applyInitialHashIfAny()}}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.__onResizeBound,{passive:!0})}firstUpdated(){this.__ensureMotionMeasureEl(),this.__resolveInternals(),this.__requestEnsureContentFocusable(),this.__requestAutoOffsetMeasure()}disconnectedCallback(){window.removeEventListener("resize",this.__onResizeBound),this.__teardown(),super.disconnectedCallback()}updated(e){if(e.has("navSelector")){this.__onSlotChange();return}if(e.has("layout")){this.__onSlotChange();return}(e.has("offsetTop")||e.has("offsetBottom"))&&(this.__rebuildObserver(),this.__attachHashScrollRoot()),(e.has("sidebarNavWidth")||e.has("sidebarHeight")||e.has("stackHeight")||e.has("sidebarNavTop")||e.has("contentPadding"))&&(this.__resolveInternals(),this.__requestEnsureContentFocusable(),this.__rebuildObserver())}__teardown(){var e;if(this.__cancelScrollAnimation(),this.__cancelEnsureContentFocusable(),this.__cancelAutoOffsetMeasure(),this.__disconnectAutoOffsetObserver(),this.__disconnectObserver(),this.__navEl&&this.__navEl.removeEventListener("click",this.__onNavClickBound,!0),this.__fallbackScrollRoot){const t=this.__fallbackScrollRoot;(e=t.removeEventListener)==null||e.call(t,"scroll",this.__onScrollFallbackBound)}this.__fallbackScrollRoot=null,this.__entries.clear(),this.__links=[],this.__detachHashScrollRoot(),this.__cancelHashBaseline()}__cancelScrollAnimation(){this.__scrollAnimSeq++,this.__scrollRafId!==null&&(window.cancelAnimationFrame(this.__scrollRafId),this.__scrollRafId=null)}__cancelEnsureContentFocusable(){this.__focusableRafId!==null&&(window.cancelAnimationFrame(this.__focusableRafId),this.__focusableRafId=null)}__requestEnsureContentFocusable(){typeof window>"u"||(this.__cancelEnsureContentFocusable(),this.__focusableRafId=window.requestAnimationFrame(()=>{this.__focusableRafId=null,this.__ensureScrollableContentFocusable()}))}__ensureScrollableContentFocusable(){const e=this.__getScrollContainerEl();!(e instanceof HTMLElement)||e.hasAttribute("tabindex")||!(e.scrollHeight>e.clientHeight+1||e.scrollWidth>e.clientWidth+1)||e.querySelector('a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), summary, [tabindex]:not([tabindex="-1"]), [contenteditable=""], [contenteditable="true"]')||e.setAttribute("tabindex","0")}__ensureMotionMeasureEl(){if(this.__motionMeasureEl)return;const e=document.createElement("span");e.setAttribute("aria-hidden","true"),e.style.position="fixed",e.style.width="0",e.style.height="0",e.style.overflow="hidden",e.style.pointerEvents="none",e.style.visibility="hidden",this.__motionMeasureEl=e,this.renderRoot.appendChild(e)}__disconnectObserver(){this.__observer&&(this.__observer.disconnect(),this.__observer=null)}__resolveInternals(){this.__contentShellEl=this.layout==="sidebar"?this.renderRoot.querySelector(".sidebar-content"):this.layout==="stack"?this.renderRoot.querySelector(".stack-shell"):null}__resolveSlots(){const e=this.renderRoot.querySelector('slot[name="nav"]'),t=this.renderRoot.querySelector('slot[name="content"]'),i=(e==null?void 0:e.assignedElements({flatten:!0}))??[],r=(t==null?void 0:t.assignedElements({flatten:!0}))??[],s=(this.navSelector||"").trim(),n=s?this.__queryExternalNav(s):i[0],d=r[0];this.__navEl=n instanceof HTMLElement?n:null,this.__contentEl=d instanceof HTMLElement?d:null,this.__resolveInternals()}__queryExternalNav(e){var t,i;try{const r=(t=this.getRootNode)==null?void 0:t.call(this);return((i=r==null?void 0:r.querySelector)==null?void 0:i.call(r,e))??document.querySelector(e)}catch{return null}}__getScrollContainerEl(){return this.layout==="sidebar"||this.layout==="stack"?this.__contentShellEl:this.__contentEl}__isOffsetTopExplicit(){return this.hasAttribute("offset-top")}__getEffectiveOffsetTop(){const e=this.__isOffsetTopExplicit()?this.offsetTop:this.__autoOffsetTop;return Math.max(0,e)}__cancelAutoOffsetMeasure(){this.__autoOffsetRafId!==null&&(window.cancelAnimationFrame(this.__autoOffsetRafId),this.__autoOffsetRafId=null)}__disconnectAutoOffsetObserver(){this.__navResizeObserver&&(this.__navResizeObserver.disconnect(),this.__navResizeObserver=null)}__requestAutoOffsetMeasure(){if(!(typeof window>"u")){if(this.__isOffsetTopExplicit()){this.__setAutoOffsetTop(0),this.__disconnectAutoOffsetObserver();return}this.__autoOffsetRafId===null&&(this.__autoOffsetRafId=window.requestAnimationFrame(()=>{this.__autoOffsetRafId=null,this.__measureAutoOffset()}))}}__measureAutoOffset(){const e=this.__navEl;if(this.__isOffsetTopExplicit()){this.__setAutoOffsetTop(0),this.__disconnectAutoOffsetObserver();return}if(!((e==null?void 0:e.tagName)==="SCB-NAV"&&(e.hasAttribute("sticky")||e.sticky===!0))){this.__setAutoOffsetTop(0),this.__disconnectAutoOffsetObserver();return}const i=Math.max(0,Math.round(e.getBoundingClientRect().height));this.__setAutoOffsetTop(i),!this.__navResizeObserver&&"ResizeObserver"in window&&(this.__navResizeObserver=new ResizeObserver(()=>{this.__requestAutoOffsetMeasure()}),this.__navResizeObserver.observe(e))}__setAutoOffsetTop(e){const t=Math.max(0,e);Math.abs(t-this.__autoOffsetTop)<1||(this.__autoOffsetTop=t,this.__rebuildObserver(),this.__requestActiveRecalc())}__rebuildObserver(){this.__disconnectObserver(),this.__entries.clear();const e=this.__getObserverRoot(),t=`-${Math.max(0,this.__getEffectiveOffsetTop())}px 0px -${Math.max(0,this.offsetBottom)}px 0px`;if(!(typeof window>"u")){if("IntersectionObserver"in window){this.__observer=new IntersectionObserver(i=>this.__onIntersect(i),{root:e,rootMargin:t,threshold:[0,.1,.25,.5,.75,1]});for(const i of this.__links)this.__observer.observe(i.targetEl);this.__requestActiveRecalc();return}this.__enableFallbackScrollSpy()}}__enableFallbackScrollSpy(){var i;const t=this.__getObserverRoot()??window;this.__fallbackScrollRoot=t,(i=t.addEventListener)==null||i.call(t,"scroll",this.__onScrollFallbackBound,{passive:!0}),this.__requestActiveRecalc()}__getObserverRoot(){const e=this.__getScrollContainerEl();return e instanceof HTMLElement&&(e.scrollHeight>e.clientHeight+1||e.scrollWidth>e.clientWidth+1)?e:null}__collectLinks(){const e=this.__navEl,t=this.__contentEl;if(!e||!t){this.__links=[];return}const i=Array.from(e.querySelectorAll('scb-drawer-item[item-href^="#"], a[href^="#"], button[data-href^="#"]')),r=[];for(const s of i){const n=this.__getHref(s);if(!n||!n.startsWith("#"))continue;const d=n.slice(1);if(!d)continue;const h=t.querySelector(`#${CSS.escape(d)}`);h&&r.push({id:d,navEl:s,targetEl:h})}this.__links=r}__getHref(e){return e.tagName==="A"?e.getAttribute("href")??"":e.tagName==="SCB-DRAWER-ITEM"?e.itemHref??e.getAttribute("item-href")??"":e.tagName==="BUTTON"?e.getAttribute("data-href")??"":e.getAttribute("href")??""}__onIntersect(e){for(const t of e){const i=t.target.id;i&&this.__entries.set(i,{id:i,isIntersecting:t.isIntersecting,top:t.boundingClientRect.top,ratio:t.intersectionRatio})}this.__requestActiveRecalc()}__requestActiveRecalc(){this.__rafId===null&&(this.__rafId=window.requestAnimationFrame(()=>{this.__rafId=null,this.__updateActiveFromEntries()}))}__updateActiveFromEntries(){if(this.__entries.size===0){this.__updateActiveFromRects();return}const e=Array.from(this.__entries.values()).filter(d=>d.isIntersecting);if(e.length===0)return;const t=this.__getObserverRoot(),i=t?t.getBoundingClientRect():null,r=((i==null?void 0:i.top)??0)+Math.max(0,this.__getEffectiveOffsetTop()),n=e.filter(d=>d.top>=r).sort((d,h)=>d.top-h.top)[0]??e.sort((d,h)=>h.top-d.top)[0];n!=null&&n.id&&this.__setActiveId(n.id,{updateHash:this.updateHash})}__updateActiveFromRects(){if(!this.__contentEl)return;const t=this.__getObserverRoot(),i=t?t.getBoundingClientRect():null,r=((i==null?void 0:i.top)??0)+Math.max(0,this.__getEffectiveOffsetTop()),s=this.__links.map(h=>{const u=h.targetEl.getBoundingClientRect();return{id:h.id,top:u.top-r}}).filter(h=>Number.isFinite(h.top));if(s.length===0)return;const d=s.filter(h=>h.top>=0).sort((h,u)=>h.top-u.top)[0]??s.sort((h,u)=>u.top-h.top)[0];d!=null&&d.id&&this.__setActiveId(d.id,{updateHash:this.updateHash})}__setActiveId(e,t){if(!e||e===this.activeId)return;this.activeId=e;const i=this.__links.find(r=>r.id===e);if(i){const r=this.__navEl;(r==null?void 0:r.tagName)==="SCB-NAV"?r.activeHref=`#${e}`:(this.__applyActiveToNav(i.navEl),this.__expandAncestors(i.navEl))}if(t.updateHash&&this.__hashAllowUpdates&&typeof history<"u")try{history.replaceState(null,"",`#${encodeURIComponent(e)}`)}catch{}this.dispatchEvent(new CustomEvent("scb-scrollspy-active-changed",{bubbles:!0,composed:!0,detail:{id:e}}))}__applyActiveToNav(e){const t=this.__navEl;if(!t)return;const i=Array.from(t.querySelectorAll('scb-drawer-item[item-href^="#"], a[href^="#"], button[data-href^="#"]'));for(const r of i){const s=r===e;if(r.tagName==="SCB-DRAWER-ITEM"){const n=r;typeof n.selected=="boolean"&&(n.selected=s),s&&r.dispatchEvent(new CustomEvent("scb-drawer-select",{bubbles:!0,composed:!0,detail:{item:r}}))}else(r.tagName==="A"||r.tagName==="BUTTON")&&(s?r.setAttribute("aria-current","location"):r.removeAttribute("aria-current"))}}__expandAncestors(e){let t=e;for(;t;){if(t.tagName==="SCB-DRAWER-ITEM"){const i=t;typeof i.expanded=="boolean"&&(i.expanded=!0)}t=t.parentElement}}__scrollToTarget(e){var m,b;const t=typeof window<"u"&&((b=(m=window.matchMedia)==null?void 0:m.call(window,"(prefers-reduced-motion: reduce)"))==null?void 0:b.matches),i=this.__getScrollContainerEl();if(i instanceof HTMLElement&&i.scrollHeight>i.clientHeight+1){const x=this.__getScrollTopInContainer(e,i)-this.__getEffectiveOffsetTop(),g=Math.max(0,i.scrollHeight-i.clientHeight),w=Math.min(g,Math.max(0,x));if(t){i.scrollTop=w;return}this.__animateScroll({get:()=>i.scrollTop,set:k=>{i.scrollTop=k},max:g,to:w});return}if(!(e instanceof HTMLElement))return;const r=e.getBoundingClientRect(),n=(window.scrollY||window.pageYOffset||0)+r.top-this.__getEffectiveOffsetTop(),d=document.documentElement,h=Math.max(0,d.scrollHeight-window.innerHeight),u=Math.min(h,Math.max(0,n));if(t){window.scrollTo(0,u);return}this.__animateScroll({get:()=>window.scrollY||window.pageYOffset||0,set:x=>window.scrollTo(0,x),max:h,to:u})}__getScrollTopInContainer(e,t){const i=t.getBoundingClientRect(),r=e.getBoundingClientRect();return t.scrollTop+(r.top-i.top)}__animateScroll(e){const t=e.get(),i=Math.min(e.max,Math.max(0,e.to));if(!Number.isFinite(t)||!Number.isFinite(i))return;if(Math.abs(i-t)<1){e.set(i);return}this.__cancelScrollAnimation(),this.__ensureMotionMeasureEl();const r=++this.__scrollAnimSeq,s=Math.abs(i-t),n=this.__getScrollDurationMs(s),d=this.__getScrollEasingFn(),h=performance.now(),u=m=>{if(r!==this.__scrollAnimSeq)return;const b=n<=0?1:Math.min(1,(m-h)/n),x=d(b);e.set(t+(i-t)*x),b<1?this.__scrollRafId=window.requestAnimationFrame(u):this.__scrollRafId=null};this.__scrollRafId=window.requestAnimationFrame(u)}__getScrollDurationMs(e){const t=this.__resolveTimeMs("var(--motion-duration-medium, 300ms)")??300,i=this.__resolveTimeMs("var(--motion-duration-long, 500ms)")??500,r=this.__resolveTimeMs("var(--motion-duration-extra-long, 700ms)")??700,s=Math.min(1,Math.max(0,e/1800)),n=t+(i-t)*s;return Math.min(r,Math.max(t,n))}__getScrollEasingFn(){const e=this.__resolveTimingFunction("var(--motion-easing-emphasized-decelerate, var(--motion-easing-emphasized, cubic-bezier(.69,.16,.2,.98)))")??"cubic-bezier(0.05, 0.7, 0.1, 1)";return this.__parseEasingFunction(e)??(i=>i)}__resolveTimeMs(e){var r;const t=this.__motionMeasureEl;if(!t)return null;t.style.transitionDuration=e;const i=((r=getComputedStyle(t).transitionDuration.split(",")[0])==null?void 0:r.trim())??"";return this.__parseTimeToMs(i)}__resolveTimingFunction(e){var i;const t=this.__motionMeasureEl;return t?(t.style.transitionTimingFunction=e,((i=getComputedStyle(t).transitionTimingFunction.split(",")[0])==null?void 0:i.trim())??null):null}__parseTimeToMs(e){const t=e.trim();if(!t)return null;const i=parseFloat(t);return Number.isFinite(i)?t.endsWith("ms")?i:t.endsWith("s")?i*1e3:null:null}__parseEasingFunction(e){const t=e.trim();if(!t)return null;if(t==="linear")return u=>u;const i=t.match(/cubic-bezier\(([^)]+)\)/i);if(!i)return null;const r=i[1].split(",").map(u=>parseFloat(u.trim())).filter(u=>Number.isFinite(u));if(r.length!==4)return null;const[s,n,d,h]=r;return this.__cubicBezier(s,n,d,h)}__cubicBezier(e,t,i,r){const s=3*e,n=3*(i-e)-s,d=1-s-n,h=3*t,u=3*(r-t)-h,m=1-h-u,b=k=>((d*k+n)*k+s)*k,x=k=>((m*k+u)*k+h)*k,g=k=>(3*d*k+2*n)*k+s,w=k=>{let S=k;for(let O=0;O<8;O++){const D=b(S)-k;if(Math.abs(D)<1e-6)return S;const z=g(S);if(Math.abs(z)<1e-6)break;S=S-D/z}let $=0,C=1;for(S=k;$<C;){const D=b(S)-k;if(Math.abs(D)<1e-6)return S;D>0?C=S:$=S,S=(C+$)/2}return S};return k=>{const S=w(Math.min(1,Math.max(0,k)));return x(S)}}__detachHashScrollRoot(){if(!this.__hashScrollRoot)return;const e=this.__hashScrollRoot;try{e instanceof Window?e.removeEventListener("scroll",this.__onHashScrollBound):e.removeEventListener("scroll",this.__onHashScrollBound)}catch{}this.__hashScrollRoot=null}__cancelHashBaseline(){this.__hashBaselineRafId!==null&&(window.cancelAnimationFrame(this.__hashBaselineRafId),this.__hashBaselineRafId=null),this.__hashBaselineReady=!1}__attachHashScrollRoot(){this.__detachHashScrollRoot();const t=this.__getObserverRoot()??window;this.__hashScrollRoot=t;try{t.addEventListener("scroll",this.__onHashScrollBound,{passive:!0})}catch{}this.__hashAllowUpdates=!1,this.__scheduleHashBaseline()}__scheduleHashBaseline(){this.__cancelHashBaseline();const e=()=>{this.__hashBaselinePos=this.__getHashScrollPos(),this.__hashBaselineReady=!0,this.__hashBaselineRafId=null};this.__hashBaselineRafId=window.requestAnimationFrame(()=>{this.__hashBaselineRafId=window.requestAnimationFrame(e)})}__getHashScrollPos(){const e=this.__hashScrollRoot;if(e instanceof Window)return e.scrollY||e.pageYOffset||0;if(e&&"scrollTop"in e){const t=e;return typeof t.scrollTop=="number"?t.scrollTop:0}return 0}__onHashScroll(){if(!this.updateHash||this.__hashSuspend||this.__hashAllowUpdates||!this.__hashBaselineReady)return;const e=this.__getHashScrollPos();Math.abs(e-this.__hashBaselinePos)>2&&(this.__hashAllowUpdates=!0)}__jumpToTarget(e){const t=this.__getScrollContainerEl();if(t instanceof HTMLElement&&t.scrollHeight>t.clientHeight+1){const u=this.__getScrollTopInContainer(e,t)-this.__getEffectiveOffsetTop(),m=Math.max(0,t.scrollHeight-t.clientHeight),b=Math.min(m,Math.max(0,u));t.scrollTop=b;return}if(!(e instanceof HTMLElement))return;const i=e.getBoundingClientRect(),s=(window.scrollY||window.pageYOffset||0)+i.top-this.__getEffectiveOffsetTop(),n=document.documentElement,d=Math.max(0,n.scrollHeight-window.innerHeight),h=Math.min(d,Math.max(0,s));window.scrollTo(0,h)}__applyInitialHashIfAny(){if(this.__hashInitialApplied)return;const e=typeof window<"u"?window.location.hash:"";if(!e||e.length<2)return;let t="";try{t=decodeURIComponent(e.slice(1))}catch{t=e.slice(1)}if(!t)return;const i=this.__links.find(r=>r.id===t);if(i!=null&&i.targetEl){this.__hashInitialApplied=!0,this.__hashSuspend=!0;try{this.__jumpToTarget(i.targetEl),this.__setActiveId(t,{updateHash:!1})}finally{window.requestAnimationFrame(()=>{window.requestAnimationFrame(()=>{this.__hashSuspend=!1})})}}}__onNavClick(e){const t=this.__navEl,i=this.__contentEl;if(!t||!i)return;const s=e.composedPath().find(u=>u instanceof Element&&(u.tagName==="SCB-DRAWER-ITEM"||u.tagName==="A"||u.tagName==="BUTTON"));if(!s)return;const n=this.__getHref(s);if(!n||!n.startsWith("#"))return;const d=n.slice(1);if(!d)return;const h=i.querySelector(`#${CSS.escape(d)}`);h&&(e.preventDefault(),this.__hashAllowUpdates=!0,this.__scrollToTarget(h),this.__setActiveId(d,{updateHash:this.updateHash}))}render(){if(this.layout==="sidebar"){const e=[`--_scb-scrollspy-sidebar-nav-width: ${this.sidebarNavWidth}`,`--_scb-scrollspy-sidebar-height: ${this.sidebarHeight}`,`--_scb-scrollspy-sidebar-nav-top: ${this.sidebarNavTop}`,`--_scb-scrollspy-content-padding: ${this.contentPadding}`].join("; ");return c`
|
|
8150
|
+
`,ma([l({type:Number,reflect:!0,attribute:"progress-width",hasChanged:(a,e)=>a!==e})],o.ScbProgressStepper.prototype,"progressWidth",2),ma([l({type:String,reflect:!0})],o.ScbProgressStepper.prototype,"height",2),ma([l({type:String,reflect:!0})],o.ScbProgressStepper.prototype,"position",2),o.ScbProgressStepper=ma([y("scb-progress-stepper")],o.ScbProgressStepper);var xv=Object.getOwnPropertyDescriptor,wv=(a,e,t,i)=>{for(var r=i>1?void 0:i?xv(e,t):e,s=a.length-1,n;s>=0;s--)(n=a[s])&&(r=n(r)||r);return r};o.ScbScrollspy=class extends _{constructor(){super(...arguments),this.navSelector="",this.offsetTop=0,this.offsetBottom=0,this.updateHash=!0,this.activeId="",this.layout="",this.sidebarNavWidth="320px",this.sidebarHeight="560px",this.stackHeight="",this.sidebarNavTop="0px",this.contentPadding="0px",this.__navEl=null,this.__contentEl=null,this.__contentShellEl=null,this.__links=[],this.__observer=null,this.__fallbackScrollRoot=null,this.__entries=new Map,this.__rafId=null,this.__scrollRafId=null,this.__hashAllowUpdates=!1,this.__hashBaselineReady=!1,this.__hashBaselinePos=0,this.__hashBaselineRafId=null,this.__hashScrollRoot=null,this.__hashSuspend=!1,this.__hashInitialApplied=!1,this.__onHashScrollBound=()=>this.__onHashScroll(),this.__scrollAnimSeq=0,this.__motionMeasureEl=null,this.__focusableRafId=null,this.__autoOffsetTop=0,this.__autoOffsetRafId=null,this.__navResizeObserver=null,this.__onNavClickBound=e=>this.__onNavClick(e),this.__onScrollFallbackBound=()=>this.__updateActiveFromRects(),this.__onResizeBound=()=>{this.__requestActiveRecalc(),this.__requestAutoOffsetMeasure()},this.__onSlotChange=()=>{const e=this.__navEl;this.__teardown(),this.__resolveSlots(),this.__requestEnsureContentFocusable(),this.__navEl&&this.__navEl.addEventListener("click",this.__onNavClickBound,!0),(e!==this.__navEl||!this.__links.length)&&this.__collectLinks(),this.__requestAutoOffsetMeasure(),this.__rebuildObserver(),this.__attachHashScrollRoot(),this.__applyInitialHashIfAny()}}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.__onResizeBound,{passive:!0})}firstUpdated(){this.__ensureMotionMeasureEl(),this.__resolveInternals(),this.__requestEnsureContentFocusable(),this.__requestAutoOffsetMeasure()}disconnectedCallback(){window.removeEventListener("resize",this.__onResizeBound),this.__teardown(),super.disconnectedCallback()}updated(e){if(e.has("navSelector")){this.__onSlotChange();return}if(e.has("layout")){this.__onSlotChange();return}(e.has("offsetTop")||e.has("offsetBottom"))&&(this.__rebuildObserver(),this.__attachHashScrollRoot()),(e.has("sidebarNavWidth")||e.has("sidebarHeight")||e.has("stackHeight")||e.has("sidebarNavTop")||e.has("contentPadding"))&&(this.__resolveInternals(),this.__requestEnsureContentFocusable(),this.__rebuildObserver())}__teardown(){var e;if(this.__cancelScrollAnimation(),this.__cancelEnsureContentFocusable(),this.__cancelAutoOffsetMeasure(),this.__disconnectAutoOffsetObserver(),this.__disconnectObserver(),this.__navEl&&this.__navEl.removeEventListener("click",this.__onNavClickBound,!0),this.__fallbackScrollRoot){const t=this.__fallbackScrollRoot;(e=t.removeEventListener)==null||e.call(t,"scroll",this.__onScrollFallbackBound)}this.__fallbackScrollRoot=null,this.__entries.clear(),this.__links=[],this.__detachHashScrollRoot(),this.__cancelHashBaseline()}__cancelScrollAnimation(){this.__scrollAnimSeq++,this.__scrollRafId!==null&&(window.cancelAnimationFrame(this.__scrollRafId),this.__scrollRafId=null)}__cancelEnsureContentFocusable(){this.__focusableRafId!==null&&(window.cancelAnimationFrame(this.__focusableRafId),this.__focusableRafId=null)}__requestEnsureContentFocusable(){typeof window>"u"||(this.__cancelEnsureContentFocusable(),this.__focusableRafId=window.requestAnimationFrame(()=>{this.__focusableRafId=null,this.__ensureScrollableContentFocusable()}))}__ensureScrollableContentFocusable(){const e=this.__getScrollContainerEl();!(e instanceof HTMLElement)||e.hasAttribute("tabindex")||!(e.scrollHeight>e.clientHeight+1||e.scrollWidth>e.clientWidth+1)||e.querySelector('a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), summary, [tabindex]:not([tabindex="-1"]), [contenteditable=""], [contenteditable="true"]')||e.setAttribute("tabindex","0")}__ensureMotionMeasureEl(){if(this.__motionMeasureEl)return;const e=document.createElement("span");e.setAttribute("aria-hidden","true"),e.style.position="fixed",e.style.width="0",e.style.height="0",e.style.overflow="hidden",e.style.pointerEvents="none",e.style.visibility="hidden",this.__motionMeasureEl=e,this.renderRoot.appendChild(e)}__disconnectObserver(){this.__observer&&(this.__observer.disconnect(),this.__observer=null)}__resolveInternals(){this.__contentShellEl=this.layout==="sidebar"?this.renderRoot.querySelector(".sidebar-content"):this.layout==="stack"?this.renderRoot.querySelector(".stack-shell"):null}__resolveSlots(){const e=this.renderRoot.querySelector('slot[name="nav"]'),t=this.renderRoot.querySelector('slot[name="content"]'),i=(e==null?void 0:e.assignedElements({flatten:!0}))??[],r=(t==null?void 0:t.assignedElements({flatten:!0}))??[],s=(this.navSelector||"").trim(),n=s?this.__queryExternalNav(s):i[0],d=r[0];this.__navEl=n instanceof HTMLElement?n:null,this.__contentEl=d instanceof HTMLElement?d:null,this.__resolveInternals()}__queryExternalNav(e){var t,i;try{const r=(t=this.getRootNode)==null?void 0:t.call(this);return((i=r==null?void 0:r.querySelector)==null?void 0:i.call(r,e))??document.querySelector(e)}catch{return null}}__getScrollContainerEl(){return this.layout==="sidebar"||this.layout==="stack"?this.__contentShellEl:this.__contentEl}__isOffsetTopExplicit(){return this.hasAttribute("offset-top")}__getEffectiveOffsetTop(){const e=this.__isOffsetTopExplicit()?this.offsetTop:this.__autoOffsetTop;return Math.max(0,e)}__cancelAutoOffsetMeasure(){this.__autoOffsetRafId!==null&&(window.cancelAnimationFrame(this.__autoOffsetRafId),this.__autoOffsetRafId=null)}__disconnectAutoOffsetObserver(){this.__navResizeObserver&&(this.__navResizeObserver.disconnect(),this.__navResizeObserver=null)}__requestAutoOffsetMeasure(){if(!(typeof window>"u")){if(this.__isOffsetTopExplicit()){this.__setAutoOffsetTop(0),this.__disconnectAutoOffsetObserver();return}this.__autoOffsetRafId===null&&(this.__autoOffsetRafId=window.requestAnimationFrame(()=>{this.__autoOffsetRafId=null,this.__measureAutoOffset()}))}}__measureAutoOffset(){const e=this.__navEl;if(this.__isOffsetTopExplicit()){this.__setAutoOffsetTop(0),this.__disconnectAutoOffsetObserver();return}if(!((e==null?void 0:e.tagName)==="SCB-NAV"&&(e.hasAttribute("sticky")||e.sticky===!0))){this.__setAutoOffsetTop(0),this.__disconnectAutoOffsetObserver();return}const i=Math.max(0,Math.round(e.getBoundingClientRect().height));this.__setAutoOffsetTop(i),!this.__navResizeObserver&&"ResizeObserver"in window&&(this.__navResizeObserver=new ResizeObserver(()=>{this.__requestAutoOffsetMeasure()}),this.__navResizeObserver.observe(e))}__setAutoOffsetTop(e){const t=Math.max(0,e);Math.abs(t-this.__autoOffsetTop)<1||(this.__autoOffsetTop=t,this.__rebuildObserver(),this.__requestActiveRecalc())}__rebuildObserver(){this.__disconnectObserver(),this.__entries.clear();const e=this.__getObserverRoot(),t=`-${Math.max(0,this.__getEffectiveOffsetTop())}px 0px -${Math.max(0,this.offsetBottom)}px 0px`;if(!(typeof window>"u")){if("IntersectionObserver"in window){this.__observer=new IntersectionObserver(i=>this.__onIntersect(i),{root:e,rootMargin:t,threshold:[0,.1,.25,.5,.75,1]});for(const i of this.__links)this.__observer.observe(i.targetEl);this.__requestActiveRecalc();return}this.__enableFallbackScrollSpy()}}__enableFallbackScrollSpy(){var i;const t=this.__getObserverRoot()??window;this.__fallbackScrollRoot=t,(i=t.addEventListener)==null||i.call(t,"scroll",this.__onScrollFallbackBound,{passive:!0}),this.__requestActiveRecalc()}__getObserverRoot(){const e=this.__getScrollContainerEl();return e instanceof HTMLElement&&(e.scrollHeight>e.clientHeight+1||e.scrollWidth>e.clientWidth+1)?e:null}__collectLinks(){const e=this.__navEl,t=this.__contentEl;if(!e||!t){this.__links=[];return}const i=Array.from(e.querySelectorAll('scb-drawer-item[item-href^="#"], a[href^="#"], button[data-href^="#"]')),r=[];for(const s of i){const n=this.__getHref(s);if(!n||!n.startsWith("#"))continue;const d=n.slice(1);if(!d)continue;const h=t.querySelector(`#${CSS.escape(d)}`);h&&r.push({id:d,navEl:s,targetEl:h})}this.__links=r}__getHref(e){return e.tagName==="A"?e.getAttribute("href")??"":e.tagName==="SCB-DRAWER-ITEM"?e.itemHref??e.getAttribute("item-href")??"":e.tagName==="BUTTON"?e.getAttribute("data-href")??"":e.getAttribute("href")??""}__onIntersect(e){for(const t of e){const i=t.target.id;i&&this.__entries.set(i,{id:i,isIntersecting:t.isIntersecting,top:t.boundingClientRect.top,ratio:t.intersectionRatio})}this.__requestActiveRecalc()}__requestActiveRecalc(){this.__rafId===null&&(this.__rafId=window.requestAnimationFrame(()=>{this.__rafId=null,this.__updateActiveFromEntries()}))}__updateActiveFromEntries(){if(this.__entries.size===0){this.__updateActiveFromRects();return}const e=Array.from(this.__entries.values()).filter(d=>d.isIntersecting);if(e.length===0)return;const t=this.__getObserverRoot(),i=t?t.getBoundingClientRect():null,r=((i==null?void 0:i.top)??0)+Math.max(0,this.__getEffectiveOffsetTop()),n=e.filter(d=>d.top>=r).sort((d,h)=>d.top-h.top)[0]??e.sort((d,h)=>h.top-d.top)[0];n!=null&&n.id&&this.__setActiveId(n.id,{updateHash:this.updateHash})}__updateActiveFromRects(){if(!this.__contentEl)return;const t=this.__getObserverRoot(),i=t?t.getBoundingClientRect():null,r=((i==null?void 0:i.top)??0)+Math.max(0,this.__getEffectiveOffsetTop()),s=this.__links.map(h=>{const u=h.targetEl.getBoundingClientRect();return{id:h.id,top:u.top-r}}).filter(h=>Number.isFinite(h.top));if(s.length===0)return;const d=s.filter(h=>h.top>=0).sort((h,u)=>h.top-u.top)[0]??s.sort((h,u)=>u.top-h.top)[0];d!=null&&d.id&&this.__setActiveId(d.id,{updateHash:this.updateHash})}__setActiveId(e,t){if(!e||e===this.activeId)return;this.activeId=e;const i=this.__links.find(r=>r.id===e);if(i){const r=this.__navEl;(r==null?void 0:r.tagName)==="SCB-NAV"?r.activeHref=`#${e}`:(this.__applyActiveToNav(i.navEl),this.__expandAncestors(i.navEl))}if(t.updateHash&&this.__hashAllowUpdates&&typeof history<"u")try{history.replaceState(null,"",`#${encodeURIComponent(e)}`)}catch{}this.dispatchEvent(new CustomEvent("scb-scrollspy-active-changed",{bubbles:!0,composed:!0,detail:{id:e}}))}__applyActiveToNav(e){const t=this.__navEl;if(!t)return;const i=Array.from(t.querySelectorAll('scb-drawer-item[item-href^="#"], a[href^="#"], button[data-href^="#"]'));for(const r of i){const s=r===e;if(r.tagName==="SCB-DRAWER-ITEM"){const n=r;typeof n.selected=="boolean"&&(n.selected=s),s&&r.dispatchEvent(new CustomEvent("scb-drawer-select",{bubbles:!0,composed:!0,detail:{item:r}}))}else(r.tagName==="A"||r.tagName==="BUTTON")&&(s?r.setAttribute("aria-current","location"):r.removeAttribute("aria-current"))}}__expandAncestors(e){let t=e;for(;t;){if(t.tagName==="SCB-DRAWER-ITEM"){const i=t;typeof i.expanded=="boolean"&&(i.expanded=!0)}t=t.parentElement}}__scrollToTarget(e){var m,b;const t=typeof window<"u"&&((b=(m=window.matchMedia)==null?void 0:m.call(window,"(prefers-reduced-motion: reduce)"))==null?void 0:b.matches),i=this.__getScrollContainerEl();if(i instanceof HTMLElement&&i.scrollHeight>i.clientHeight+1){const x=this.__getScrollTopInContainer(e,i)-this.__getEffectiveOffsetTop(),g=Math.max(0,i.scrollHeight-i.clientHeight),w=Math.min(g,Math.max(0,x));if(t){i.scrollTop=w;return}this.__animateScroll({get:()=>i.scrollTop,set:k=>{i.scrollTop=k},max:g,to:w});return}if(!(e instanceof HTMLElement))return;const r=e.getBoundingClientRect(),n=(window.scrollY||window.pageYOffset||0)+r.top-this.__getEffectiveOffsetTop(),d=document.documentElement,h=Math.max(0,d.scrollHeight-window.innerHeight),u=Math.min(h,Math.max(0,n));if(t){window.scrollTo(0,u);return}this.__animateScroll({get:()=>window.scrollY||window.pageYOffset||0,set:x=>window.scrollTo(0,x),max:h,to:u})}__getScrollTopInContainer(e,t){const i=t.getBoundingClientRect(),r=e.getBoundingClientRect();return t.scrollTop+(r.top-i.top)}__animateScroll(e){const t=e.get(),i=Math.min(e.max,Math.max(0,e.to));if(!Number.isFinite(t)||!Number.isFinite(i))return;if(Math.abs(i-t)<1){e.set(i);return}this.__cancelScrollAnimation(),this.__ensureMotionMeasureEl();const r=++this.__scrollAnimSeq,s=Math.abs(i-t),n=this.__getScrollDurationMs(s),d=this.__getScrollEasingFn(),h=performance.now(),u=m=>{if(r!==this.__scrollAnimSeq)return;const b=n<=0?1:Math.min(1,(m-h)/n),x=d(b);e.set(t+(i-t)*x),b<1?this.__scrollRafId=window.requestAnimationFrame(u):this.__scrollRafId=null};this.__scrollRafId=window.requestAnimationFrame(u)}__getScrollDurationMs(e){const t=this.__resolveTimeMs("var(--motion-duration-medium, 300ms)")??300,i=this.__resolveTimeMs("var(--motion-duration-long, 500ms)")??500,r=this.__resolveTimeMs("var(--motion-duration-extra-long, 700ms)")??700,s=Math.min(1,Math.max(0,e/1800)),n=t+(i-t)*s;return Math.min(r,Math.max(t,n))}__getScrollEasingFn(){const e=this.__resolveTimingFunction("var(--motion-easing-emphasized-decelerate, var(--motion-easing-emphasized, cubic-bezier(.69,.16,.2,.98)))")??"cubic-bezier(0.05, 0.7, 0.1, 1)";return this.__parseEasingFunction(e)??(i=>i)}__resolveTimeMs(e){var r;const t=this.__motionMeasureEl;if(!t)return null;t.style.transitionDuration=e;const i=((r=getComputedStyle(t).transitionDuration.split(",")[0])==null?void 0:r.trim())??"";return this.__parseTimeToMs(i)}__resolveTimingFunction(e){var i;const t=this.__motionMeasureEl;return t?(t.style.transitionTimingFunction=e,((i=getComputedStyle(t).transitionTimingFunction.split(",")[0])==null?void 0:i.trim())??null):null}__parseTimeToMs(e){const t=e.trim();if(!t)return null;const i=parseFloat(t);return Number.isFinite(i)?t.endsWith("ms")?i:t.endsWith("s")?i*1e3:null:null}__parseEasingFunction(e){const t=e.trim();if(!t)return null;if(t==="linear")return u=>u;const i=t.match(/cubic-bezier\(([^)]+)\)/i);if(!i)return null;const r=i[1].split(",").map(u=>parseFloat(u.trim())).filter(u=>Number.isFinite(u));if(r.length!==4)return null;const[s,n,d,h]=r;return this.__cubicBezier(s,n,d,h)}__cubicBezier(e,t,i,r){const s=3*e,n=3*(i-e)-s,d=1-s-n,h=3*t,u=3*(r-t)-h,m=1-h-u,b=k=>((d*k+n)*k+s)*k,x=k=>((m*k+u)*k+h)*k,g=k=>(3*d*k+2*n)*k+s,w=k=>{let S=k;for(let D=0;D<8;D++){const P=b(S)-k;if(Math.abs(P)<1e-6)return S;const z=g(S);if(Math.abs(z)<1e-6)break;S=S-P/z}let $=0,C=1;for(S=k;$<C;){const P=b(S)-k;if(Math.abs(P)<1e-6)return S;P>0?C=S:$=S,S=(C+$)/2}return S};return k=>{const S=w(Math.min(1,Math.max(0,k)));return x(S)}}__detachHashScrollRoot(){if(!this.__hashScrollRoot)return;const e=this.__hashScrollRoot;try{e instanceof Window?e.removeEventListener("scroll",this.__onHashScrollBound):e.removeEventListener("scroll",this.__onHashScrollBound)}catch{}this.__hashScrollRoot=null}__cancelHashBaseline(){this.__hashBaselineRafId!==null&&(window.cancelAnimationFrame(this.__hashBaselineRafId),this.__hashBaselineRafId=null),this.__hashBaselineReady=!1}__attachHashScrollRoot(){this.__detachHashScrollRoot();const t=this.__getObserverRoot()??window;this.__hashScrollRoot=t;try{t.addEventListener("scroll",this.__onHashScrollBound,{passive:!0})}catch{}this.__hashAllowUpdates=!1,this.__scheduleHashBaseline()}__scheduleHashBaseline(){this.__cancelHashBaseline();const e=()=>{this.__hashBaselinePos=this.__getHashScrollPos(),this.__hashBaselineReady=!0,this.__hashBaselineRafId=null};this.__hashBaselineRafId=window.requestAnimationFrame(()=>{this.__hashBaselineRafId=window.requestAnimationFrame(e)})}__getHashScrollPos(){const e=this.__hashScrollRoot;if(e instanceof Window)return e.scrollY||e.pageYOffset||0;if(e&&"scrollTop"in e){const t=e;return typeof t.scrollTop=="number"?t.scrollTop:0}return 0}__onHashScroll(){if(!this.updateHash||this.__hashSuspend||this.__hashAllowUpdates||!this.__hashBaselineReady)return;const e=this.__getHashScrollPos();Math.abs(e-this.__hashBaselinePos)>2&&(this.__hashAllowUpdates=!0)}__jumpToTarget(e){const t=this.__getScrollContainerEl();if(t instanceof HTMLElement&&t.scrollHeight>t.clientHeight+1){const u=this.__getScrollTopInContainer(e,t)-this.__getEffectiveOffsetTop(),m=Math.max(0,t.scrollHeight-t.clientHeight),b=Math.min(m,Math.max(0,u));t.scrollTop=b;return}if(!(e instanceof HTMLElement))return;const i=e.getBoundingClientRect(),s=(window.scrollY||window.pageYOffset||0)+i.top-this.__getEffectiveOffsetTop(),n=document.documentElement,d=Math.max(0,n.scrollHeight-window.innerHeight),h=Math.min(d,Math.max(0,s));window.scrollTo(0,h)}__applyInitialHashIfAny(){if(this.__hashInitialApplied)return;const e=typeof window<"u"?window.location.hash:"";if(!e||e.length<2)return;let t="";try{t=decodeURIComponent(e.slice(1))}catch{t=e.slice(1)}if(!t)return;const i=this.__links.find(r=>r.id===t);if(i!=null&&i.targetEl){this.__hashInitialApplied=!0,this.__hashSuspend=!0;try{this.__jumpToTarget(i.targetEl),this.__setActiveId(t,{updateHash:!1})}finally{window.requestAnimationFrame(()=>{window.requestAnimationFrame(()=>{this.__hashSuspend=!1})})}}}__onNavClick(e){const t=this.__navEl,i=this.__contentEl;if(!t||!i)return;const s=e.composedPath().find(u=>u instanceof Element&&(u.tagName==="SCB-DRAWER-ITEM"||u.tagName==="A"||u.tagName==="BUTTON"));if(!s)return;const n=this.__getHref(s);if(!n||!n.startsWith("#"))return;const d=n.slice(1);if(!d)return;const h=i.querySelector(`#${CSS.escape(d)}`);h&&(e.preventDefault(),this.__hashAllowUpdates=!0,this.__scrollToTarget(h),this.__setActiveId(d,{updateHash:this.updateHash}))}render(){if(this.layout==="sidebar"){const e=[`--_scb-scrollspy-sidebar-nav-width: ${this.sidebarNavWidth}`,`--_scb-scrollspy-sidebar-height: ${this.sidebarHeight}`,`--_scb-scrollspy-sidebar-nav-top: ${this.sidebarNavTop}`,`--_scb-scrollspy-content-padding: ${this.contentPadding}`].join("; ");return c`
|
|
8123
8151
|
<div class="sidebar-layout" style=${e}>
|
|
8124
8152
|
<div class="sidebar-nav">
|
|
8125
8153
|
<slot name="nav" @slotchange=${this.__onSlotChange}></slot>
|
|
@@ -9194,7 +9222,7 @@ ${this.value}</textarea
|
|
|
9194
9222
|
.scb-toc-list {
|
|
9195
9223
|
display: block;
|
|
9196
9224
|
}
|
|
9197
|
-
`],tr([l({type:Boolean,reflect:!0})],o.ScbToc.prototype,"detached",2),tr([l({type:String,reflect:!0})],o.ScbToc.prototype,"spacing",2),tr([l({type:String,attribute:"spacing-top",reflect:!0})],o.ScbToc.prototype,"spacingTop",2),tr([l({type:String,attribute:"spacing-bottom",reflect:!0})],o.ScbToc.prototype,"spacingBottom",2),o.ScbToc=tr([y("scb-toc")],o.ScbToc);var ob=Object.defineProperty,sb=Object.getOwnPropertyDescriptor,Ke=(a,e,t,i)=>{for(var r=i>1?void 0:i?sb(e,t):e,s=a.length-1,n;s>=0;s--)(n=a[s])&&(r=(i?n(e,t,r):n(r))||r);return i&&r&&ob(e,t,r),r};let nb=0;o.ScbTooltip=class extends _{constructor(){super(...arguments),this.variant="plain",this.arrow=null,this.supportingtext="",this.label="",this.trigger="hover",this.position="top",this.open=!1,this.delay=.25,this.offset=0,this._hoverActive=!1,this._clickActive=!1,this._hideTimeout=null,this._triggerEl=null,this._originalPosition="top",this._tooltipId=`scb-tooltip-${++nb}`,this._onTriggerMouseEnter=()=>{this._hoverActive=!0,this.open=!0},this._onTriggerMouseLeave=()=>{this._hoverActive=!1,this._clickActive||(this.open=!1)},this._onTriggerFocus=()=>{this._hoverActive=!0,this.open=!0},this._onTriggerBlur=()=>{this._hoverActive=!1,this._clickActive||(this.open=!1)},this._onTooltipMouseEnter=()=>{(this.trigger==="hover"||this.trigger==="hover-click")&&(this._hoverActive=!0,this.open=!0)},this._onTooltipMouseLeave=()=>{(this.trigger==="hover"||this.trigger==="hover-click")&&(this._hoverActive=!1,this._clickActive||(this.open=!1))},this._onTriggerClick=()=>{this._clickActive=!this._clickActive,this._clickActive?this.open=!0:this._hoverActive||(this.open=!1)}}firstUpdated(){if(this._originalPosition=this.position,this._updateDelayCss(),this._updateTriggerElement(),this._updateTooltipHoverListeners(),this.open){const e=this._getTooltipElement();e&&this._showTooltip(e)}}updated(e){if(e.has("trigger")&&(this._updateTriggerElement(),this._updateTooltipHoverListeners()),e.has("delay")&&this._updateDelayCss(),e.has("open")){const t=this._getTooltipElement();if(!t)return;this.open?this._showTooltip(t):this._hideTooltip(t)}}disconnectedCallback(){super.disconnectedCallback(),this._detachTriggerListeners();const e=this._getTooltipElement();e&&(e.removeEventListener("mouseenter",this._onTooltipMouseEnter),e.removeEventListener("mouseleave",this._onTooltipMouseLeave)),this._hideTimeout!==null&&(window.clearTimeout(this._hideTimeout),this._hideTimeout=null)}_getTooltipElement(){return this.renderRoot.querySelector(".scb-tooltip")}_updateDelayCss(){const e=Number.isFinite(this.delay)?this.delay:.25;this.style.setProperty("--delay",`${e}s`)}_findTriggerElement(){const e=this.querySelector("[scb-tooltip-anchor]:not([slot])");return e||(Array.from(this.children).find(i=>i.nodeType===Node.ELEMENT_NODE)??null)}_updateTriggerElement(){const e=this._triggerEl;e&&(this._detachTriggerListeners(),e.removeAttribute("aria-describedby"));const t=this._findTriggerElement();this._triggerEl=t,t&&(t.setAttribute("aria-describedby",this._tooltipId),(this.trigger==="click"||this.trigger==="hover-click")&&t.addEventListener("click",this._onTriggerClick),(this.trigger==="hover"||this.trigger==="hover-click")&&(t.addEventListener("mouseenter",this._onTriggerMouseEnter),t.addEventListener("mouseleave",this._onTriggerMouseLeave),t.addEventListener("focus",this._onTriggerFocus),t.addEventListener("blur",this._onTriggerBlur)))}_updateTooltipHoverListeners(){const e=this._getTooltipElement();e&&(e.removeEventListener("mouseenter",this._onTooltipMouseEnter),e.removeEventListener("mouseleave",this._onTooltipMouseLeave),(this.trigger==="hover"||this.trigger==="hover-click")&&(e.addEventListener("mouseenter",this._onTooltipMouseEnter),e.addEventListener("mouseleave",this._onTooltipMouseLeave)))}_detachTriggerListeners(){const e=this._triggerEl;e&&(e.removeEventListener("click",this._onTriggerClick),e.removeEventListener("mouseenter",this._onTriggerMouseEnter),e.removeEventListener("mouseleave",this._onTriggerMouseLeave),e.removeEventListener("focus",this._onTriggerFocus),e.removeEventListener("blur",this._onTriggerBlur))}_showTooltip(e){this._hideTimeout!==null&&(window.clearTimeout(this._hideTimeout),this._hideTimeout=null);const t=this._triggerEl;this._resetPosition(),e.classList.remove("hidden"),e.setAttribute("aria-hidden","false"),requestAnimationFrame(()=>{t&&this._positionTooltip(e,t),e.setAttribute("open","")})}_hideTooltip(e){e.removeAttribute("open"),e.setAttribute("aria-hidden","true"),this._scheduleHidden(e)}_scheduleHidden(e){const t=(Number.isFinite(this.delay)?this.delay:.25)*1e3;if(t<=0){e.classList.add("hidden");return}this._hideTimeout=window.setTimeout(()=>{e.classList.add("hidden"),this._hideTimeout=null},t)}_resetPosition(){this.position=this._originalPosition}_positionTooltip(e,t){const i=t.getBoundingClientRect(),r=e.getBoundingClientRect(),s=this.getBoundingClientRect(),h=(this.offset??0)+8,u=8,m=u,b=window.innerHeight-u,x=u,g=window.innerWidth-u,w=G=>G>=m&&G+r.height<=b,k=G=>G>=x&&G+r.width<=g,S=(G,xe,Ne,ar)=>{let vi=0;G<Ne&&(vi+=Ne-G);const Sa=G+xe;return Sa>ar&&(vi+=Sa-ar),vi},$=G=>{let xe=0,Ne=0;switch(G){case"top":xe=i.top-s.top-r.height-h,Ne=i.left-s.left+(i.width-r.width)/2;break;case"bottom":xe=i.bottom-s.top+h,Ne=i.left-s.left+(i.width-r.width)/2;break;case"left":Ne=i.left-s.left-r.width-h,xe=i.top-s.top+(i.height-r.height)/2;break;case"right":Ne=i.right-s.left+h,xe=i.top-s.top+(i.height-r.height)/2;break}const ar=xe+s.top,vi=Ne+s.left,Sa=S(ar,r.height,m,b),pb=S(vi,r.width,x,g);return{pos:G,top:xe,left:Ne,fitsV:w(ar),fitsH:k(vi),totalOverflow:Sa+pb}},C=this.position==="top"||this.position==="bottom",
|
|
9225
|
+
`],tr([l({type:Boolean,reflect:!0})],o.ScbToc.prototype,"detached",2),tr([l({type:String,reflect:!0})],o.ScbToc.prototype,"spacing",2),tr([l({type:String,attribute:"spacing-top",reflect:!0})],o.ScbToc.prototype,"spacingTop",2),tr([l({type:String,attribute:"spacing-bottom",reflect:!0})],o.ScbToc.prototype,"spacingBottom",2),o.ScbToc=tr([y("scb-toc")],o.ScbToc);var ob=Object.defineProperty,sb=Object.getOwnPropertyDescriptor,Ke=(a,e,t,i)=>{for(var r=i>1?void 0:i?sb(e,t):e,s=a.length-1,n;s>=0;s--)(n=a[s])&&(r=(i?n(e,t,r):n(r))||r);return i&&r&&ob(e,t,r),r};let nb=0;o.ScbTooltip=class extends _{constructor(){super(...arguments),this.variant="plain",this.arrow=null,this.supportingtext="",this.label="",this.trigger="hover",this.position="top",this.open=!1,this.delay=.25,this.offset=0,this._hoverActive=!1,this._clickActive=!1,this._hideTimeout=null,this._triggerEl=null,this._originalPosition="top",this._tooltipId=`scb-tooltip-${++nb}`,this._onTriggerMouseEnter=()=>{this._hoverActive=!0,this.open=!0},this._onTriggerMouseLeave=()=>{this._hoverActive=!1,this._clickActive||(this.open=!1)},this._onTriggerFocus=()=>{this._hoverActive=!0,this.open=!0},this._onTriggerBlur=()=>{this._hoverActive=!1,this._clickActive||(this.open=!1)},this._onTooltipMouseEnter=()=>{(this.trigger==="hover"||this.trigger==="hover-click")&&(this._hoverActive=!0,this.open=!0)},this._onTooltipMouseLeave=()=>{(this.trigger==="hover"||this.trigger==="hover-click")&&(this._hoverActive=!1,this._clickActive||(this.open=!1))},this._onTriggerClick=()=>{this._clickActive=!this._clickActive,this._clickActive?this.open=!0:this._hoverActive||(this.open=!1)}}firstUpdated(){if(this._originalPosition=this.position,this._updateDelayCss(),this._updateTriggerElement(),this._updateTooltipHoverListeners(),this.open){const e=this._getTooltipElement();e&&this._showTooltip(e)}}updated(e){if(e.has("trigger")&&(this._updateTriggerElement(),this._updateTooltipHoverListeners()),e.has("delay")&&this._updateDelayCss(),e.has("open")){const t=this._getTooltipElement();if(!t)return;this.open?this._showTooltip(t):this._hideTooltip(t)}}disconnectedCallback(){super.disconnectedCallback(),this._detachTriggerListeners();const e=this._getTooltipElement();e&&(e.removeEventListener("mouseenter",this._onTooltipMouseEnter),e.removeEventListener("mouseleave",this._onTooltipMouseLeave)),this._hideTimeout!==null&&(window.clearTimeout(this._hideTimeout),this._hideTimeout=null)}_getTooltipElement(){return this.renderRoot.querySelector(".scb-tooltip")}_updateDelayCss(){const e=Number.isFinite(this.delay)?this.delay:.25;this.style.setProperty("--delay",`${e}s`)}_findTriggerElement(){const e=this.querySelector("[scb-tooltip-anchor]:not([slot])");return e||(Array.from(this.children).find(i=>i.nodeType===Node.ELEMENT_NODE)??null)}_updateTriggerElement(){const e=this._triggerEl;e&&(this._detachTriggerListeners(),e.removeAttribute("aria-describedby"));const t=this._findTriggerElement();this._triggerEl=t,t&&(t.setAttribute("aria-describedby",this._tooltipId),(this.trigger==="click"||this.trigger==="hover-click")&&t.addEventListener("click",this._onTriggerClick),(this.trigger==="hover"||this.trigger==="hover-click")&&(t.addEventListener("mouseenter",this._onTriggerMouseEnter),t.addEventListener("mouseleave",this._onTriggerMouseLeave),t.addEventListener("focus",this._onTriggerFocus),t.addEventListener("blur",this._onTriggerBlur)))}_updateTooltipHoverListeners(){const e=this._getTooltipElement();e&&(e.removeEventListener("mouseenter",this._onTooltipMouseEnter),e.removeEventListener("mouseleave",this._onTooltipMouseLeave),(this.trigger==="hover"||this.trigger==="hover-click")&&(e.addEventListener("mouseenter",this._onTooltipMouseEnter),e.addEventListener("mouseleave",this._onTooltipMouseLeave)))}_detachTriggerListeners(){const e=this._triggerEl;e&&(e.removeEventListener("click",this._onTriggerClick),e.removeEventListener("mouseenter",this._onTriggerMouseEnter),e.removeEventListener("mouseleave",this._onTriggerMouseLeave),e.removeEventListener("focus",this._onTriggerFocus),e.removeEventListener("blur",this._onTriggerBlur))}_showTooltip(e){this._hideTimeout!==null&&(window.clearTimeout(this._hideTimeout),this._hideTimeout=null);const t=this._triggerEl;this._resetPosition(),e.classList.remove("hidden"),e.setAttribute("aria-hidden","false"),requestAnimationFrame(()=>{t&&this._positionTooltip(e,t),e.setAttribute("open","")})}_hideTooltip(e){e.removeAttribute("open"),e.setAttribute("aria-hidden","true"),this._scheduleHidden(e)}_scheduleHidden(e){const t=(Number.isFinite(this.delay)?this.delay:.25)*1e3;if(t<=0){e.classList.add("hidden");return}this._hideTimeout=window.setTimeout(()=>{e.classList.add("hidden"),this._hideTimeout=null},t)}_resetPosition(){this.position=this._originalPosition}_positionTooltip(e,t){const i=t.getBoundingClientRect(),r=e.getBoundingClientRect(),s=this.getBoundingClientRect(),h=(this.offset??0)+8,u=8,m=u,b=window.innerHeight-u,x=u,g=window.innerWidth-u,w=G=>G>=m&&G+r.height<=b,k=G=>G>=x&&G+r.width<=g,S=(G,xe,Ne,ar)=>{let vi=0;G<Ne&&(vi+=Ne-G);const Sa=G+xe;return Sa>ar&&(vi+=Sa-ar),vi},$=G=>{let xe=0,Ne=0;switch(G){case"top":xe=i.top-s.top-r.height-h,Ne=i.left-s.left+(i.width-r.width)/2;break;case"bottom":xe=i.bottom-s.top+h,Ne=i.left-s.left+(i.width-r.width)/2;break;case"left":Ne=i.left-s.left-r.width-h,xe=i.top-s.top+(i.height-r.height)/2;break;case"right":Ne=i.right-s.left+h,xe=i.top-s.top+(i.height-r.height)/2;break}const ar=xe+s.top,vi=Ne+s.left,Sa=S(ar,r.height,m,b),pb=S(vi,r.width,x,g);return{pos:G,top:xe,left:Ne,fitsV:w(ar),fitsH:k(vi),totalOverflow:Sa+pb}},C=this.position==="top"||this.position==="bottom",D=this.position,P=this._getOppositePosition(D),j=[D,P,C?"left":"top",C?"right":"bottom"].map($);let L=j.find(G=>G.fitsV&&G.fitsH)??j.reduce((G,xe)=>xe.totalOverflow<G.totalOverflow?xe:G);const nt=(G,xe,Ne)=>Math.min(Math.max(G,xe),Ne),T=m-s.top,N=b-r.height-s.top,Ie=x-s.left,_e=g-r.width-s.left,He=nt(L.top,T,N),ve=nt(L.left,Ie,_e);e.style.top=`${He}px`,e.style.left=`${ve}px`,this.position!==L.pos&&(this.position=L.pos)}_getOppositePosition(e){switch(e){case"top":return"bottom";case"bottom":return"top";case"left":return"right";case"right":return"left"}}_onDefaultSlotChange(){this._updateTriggerElement()}render(){const e=this.arrow?c`<svg
|
|
9198
9226
|
class="scb-tooltip-arrow"
|
|
9199
9227
|
xmlns="http://www.w3.org/2000/svg"
|
|
9200
9228
|
width="13"
|