scb-wc-test 0.1.150 → 0.1.152
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-button/scb-button.js +17 -7
- package/mvc/components/scb-card/scb-card.js +57 -55
- package/mvc/components/scb-checkbox/scb-checkbox.js +1 -2
- package/mvc/components/scb-collapse/scb-collapse.js +7 -7
- package/mvc/components/scb-dropdown/scb-dropdown.js +14 -4
- package/mvc/components/scb-icon-button/scb-icon-button.js +24 -6
- package/package.json +2 -2
- package/scb-button/scb-button.d.ts +1 -0
- package/scb-button/scb-button.js +30 -17
- package/scb-card/scb-card.d.ts +0 -1
- package/scb-card/scb-card.js +185 -193
- package/scb-checkbox/scb-checkbox.js +14 -15
- package/scb-collapse/scb-collapse.js +2 -2
- package/scb-dropdown/scb-dropdown.js +14 -4
- package/scb-icon-button/scb-icon-button.d.ts +4 -0
- package/scb-icon-button/scb-icon-button.js +95 -71
- package/scb-wc-test.bundle.js +337 -298
|
@@ -1,10 +1,20 @@
|
|
|
1
|
-
import{n as
|
|
1
|
+
import{n as a,t as I,i as k,a as w,x as h,E as i}from"../../vendor/vendor.js";import"../../vendor/vendor-material.js";(function(){try{var t=typeof globalThis<"u"?globalThis:window;if(!t.__scb_ce_guard_installed__){t.__scb_ce_guard_installed__=!0;var e=customElements.define.bind(customElements);customElements.define=function(r,s,l){try{customElements.get(r)||e(r,s,l)}catch(d){var c=String(d||"");if(c.indexOf("already been used")===-1&&c.indexOf("NotSupportedError")===-1)throw d}}}}catch{}})();var T=Object.defineProperty,B=Object.getOwnPropertyDescriptor,A=t=>{throw TypeError(t)},n=(t,e,r,s)=>{for(var l=s>1?void 0:s?B(e,r):e,c=t.length-1,d;c>=0;c--)(d=t[c])&&(l=(s?d(e,r,l):d(l))||l);return s&&l&&T(e,r,l),l},O=(t,e,r)=>e.has(t)||A("Cannot "+r),L=(t,e,r)=>e.has(t)?A("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),$=(t,e,r)=>(O(t,e,"access private method"),r),m,g;let o=class extends k{constructor(){super(...arguments),L(this,m),this.variant="filled",this.type="button",this.label="Button",this.trailingIcon=!1,this.icon="",this.iconFilled=!1,this.disabled=!1,this.fullWidth=!1,this.href="",this.target="",this.rel="",this.spacing="",this.spacingTop="",this.spacingBottom=""}__getMdHost(){return this.renderRoot.querySelector("md-filled-button, md-outlined-button, md-filled-tonal-button, md-text-button")}__getInnerNativeButton(t){return t?.shadowRoot?.querySelector("button")??null}__syncAriaToInner(){const t=this.__getMdHost(),e=this.__getInnerNativeButton(t);if(!t||!e)return;const r=(this.getAttribute("aria-label")||"").trim(),s=(t.getAttribute("aria-label")||"").trim(),l=this.label.trim()===""?(this.icon||"").trim():"",c=r||s||l;c?e.setAttribute("aria-label",c):e.removeAttribute("aria-label");const d=this.getAttribute("aria-controls");d!==null?e.setAttribute("aria-controls",d):e.removeAttribute("aria-controls");const y=this.getAttribute("aria-expanded");y!==null?e.setAttribute("aria-expanded",y):e.removeAttribute("aria-expanded"),t.removeAttribute("aria-label"),t.removeAttribute("aria-controls"),t.removeAttribute("aria-expanded"),this.removeAttribute("aria-expanded"),this.__ariaObserver?.disconnect(),this.__ariaObserver=new MutationObserver(x=>{const u=this.__getMdHost(),p=this.__getInnerNativeButton(u);if(!(!u||!p)){for(const f of x){if(f.type!=="attributes"||!f.attributeName)continue;const b=f.attributeName,v=this.getAttribute(b);if(b==="aria-label"){const S=(u.getAttribute("aria-label")||"").trim(),_=(v||S||(this.label.trim()===""?(this.icon||"").trim():"")).trim();_?p.setAttribute("aria-label",_):p.removeAttribute("aria-label"),u.removeAttribute("aria-label")}else(b==="aria-controls"||b==="aria-expanded")&&(v===null?p.removeAttribute(b):p.setAttribute(b,v),b==="aria-expanded"&&this.removeAttribute("aria-expanded"))}u.removeAttribute("aria-label"),u.removeAttribute("aria-controls"),u.removeAttribute("aria-expanded")}}),this.__ariaObserver.observe(this,{attributes:!0,attributeFilter:["aria-label","aria-controls","aria-expanded"]})}firstUpdated(){(this.type==="submit"||this.type==="reset")&&this.addEventListener("click",()=>{if(!this.disabled){const t=this.closest("form");t&&(this.type==="submit"&&t.requestSubmit(),this.type==="reset"&&t.reset())}}),this.__syncAriaToInner(),$(this,m,g).call(this)}updated(t){t.has("variant")&&this.__syncAriaToInner(),(t.has("spacing")||t.has("spacingTop")||t.has("spacingBottom"))&&$(this,m,g).call(this)}disconnectedCallback(){this.__ariaObserver?.disconnect(),super.disconnectedCallback()}mapSpacingToken(t){if(!t)return;const e=String(t).trim();if(e)return/^\d+$/.test(e)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(e,10)))})`:e}static get styles(){return w`
|
|
2
2
|
/* Gör hosten stretchbar i t.ex. flex/grid */
|
|
3
3
|
:host {
|
|
4
4
|
display: inline-flex;
|
|
5
5
|
block-size: var(--scb-button-block-size, auto);
|
|
6
6
|
margin-block-start: var(--scb-button-spacing-block-start, 0);
|
|
7
7
|
margin-block-end: var(--scb-button-spacing-block-end, 0);
|
|
8
|
+
--scb-button-font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
:host([icon-filled]) {
|
|
12
|
+
--scb-button-font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
md-icon {
|
|
16
|
+
--md-icon-font-variation-settings: var(--scb-button-font-variation-settings) !important;
|
|
17
|
+
font-variation-settings: var(--scb-button-font-variation-settings) !important;
|
|
8
18
|
}
|
|
9
19
|
|
|
10
20
|
:host([full-width]) {
|
|
@@ -72,13 +82,13 @@ import{n as l,t as I,i as k,a as w,x as h,E as i}from"../../vendor/vendor.js";im
|
|
|
72
82
|
}
|
|
73
83
|
}
|
|
74
84
|
*/
|
|
75
|
-
`}render(){const t=!!this.icon?.trim(),e=t?h`<md-icon slot="icon" part="icon">${this.icon}</md-icon>`:i,r=i,
|
|
85
|
+
`}render(){const t=!!this.icon?.trim(),e=t?h`<md-icon slot="icon" part="icon" ?filled=${this.iconFilled} aria-hidden="true">${this.icon}</md-icon>`:i,r=i,s=this.label.trim()===""?this.icon:void 0;switch(this.variant){case"filled":return h`
|
|
76
86
|
<md-filled-button
|
|
77
87
|
type=${this.type}
|
|
78
88
|
variant=${r}
|
|
79
89
|
?trailing-icon=${this.trailingIcon}
|
|
80
90
|
?disabled=${this.disabled}
|
|
81
|
-
aria-label=${
|
|
91
|
+
aria-label=${s}
|
|
82
92
|
href=${this.href||i}
|
|
83
93
|
target=${this.target||i}
|
|
84
94
|
rel=${this.rel||i}
|
|
@@ -93,7 +103,7 @@ import{n as l,t as I,i as k,a as w,x as h,E as i}from"../../vendor/vendor.js";im
|
|
|
93
103
|
variant=${r}
|
|
94
104
|
?trailing-icon=${this.trailingIcon}
|
|
95
105
|
?disabled=${this.disabled}
|
|
96
|
-
aria-label=${
|
|
106
|
+
aria-label=${s}
|
|
97
107
|
href=${this.href||i}
|
|
98
108
|
target=${this.target||i}
|
|
99
109
|
rel=${this.rel||i}
|
|
@@ -108,7 +118,7 @@ import{n as l,t as I,i as k,a as w,x as h,E as i}from"../../vendor/vendor.js";im
|
|
|
108
118
|
variant=${r}
|
|
109
119
|
?trailing-icon=${this.trailingIcon}
|
|
110
120
|
?disabled=${this.disabled}
|
|
111
|
-
aria-label=${
|
|
121
|
+
aria-label=${s}
|
|
112
122
|
href=${this.href||i}
|
|
113
123
|
target=${this.target||i}
|
|
114
124
|
rel=${this.rel||i}
|
|
@@ -123,7 +133,7 @@ import{n as l,t as I,i as k,a as w,x as h,E as i}from"../../vendor/vendor.js";im
|
|
|
123
133
|
variant=${r}
|
|
124
134
|
?trailing-icon=${this.trailingIcon}
|
|
125
135
|
?disabled=${this.disabled}
|
|
126
|
-
aria-label=${
|
|
136
|
+
aria-label=${s}
|
|
127
137
|
href=${this.href||i}
|
|
128
138
|
target=${this.target||i}
|
|
129
139
|
rel=${this.rel||i}
|
|
@@ -132,4 +142,4 @@ import{n as l,t as I,i as k,a as w,x as h,E as i}from"../../vendor/vendor.js";im
|
|
|
132
142
|
${this.label}
|
|
133
143
|
${t&&this.trailingIcon?e:i}
|
|
134
144
|
</md-text-button>
|
|
135
|
-
`;default:return h``}}};m=new WeakSet;
|
|
145
|
+
`;default:return h``}}};m=new WeakSet;g=function(){const t=this.mapSpacingToken(this.spacing),e=this.mapSpacingToken(this.spacingTop)??t,r=this.mapSpacingToken(this.spacingBottom)??t;e?this.style.setProperty("--scb-button-spacing-block-start",e):this.style.removeProperty("--scb-button-spacing-block-start"),r?this.style.setProperty("--scb-button-spacing-block-end",r):this.style.removeProperty("--scb-button-spacing-block-end")};n([a({type:String,reflect:!0})],o.prototype,"variant",2);n([a({type:String,reflect:!0})],o.prototype,"type",2);n([a({type:String})],o.prototype,"label",2);n([a({type:Boolean,attribute:"trailing-icon"})],o.prototype,"trailingIcon",2);n([a({type:String})],o.prototype,"icon",2);n([a({type:Boolean,attribute:"icon-filled",reflect:!0})],o.prototype,"iconFilled",2);n([a({type:Boolean,reflect:!0})],o.prototype,"disabled",2);n([a({type:Boolean,attribute:"full-width",reflect:!0})],o.prototype,"fullWidth",2);n([a({type:String})],o.prototype,"href",2);n([a({type:String})],o.prototype,"target",2);n([a({type:String})],o.prototype,"rel",2);n([a({type:String,reflect:!0})],o.prototype,"spacing",2);n([a({type:String,attribute:"spacing-top",reflect:!0})],o.prototype,"spacingTop",2);n([a({type:String,attribute:"spacing-bottom",reflect:!0})],o.prototype,"spacingBottom",2);o=n([I("scb-button")],o);
|
|
@@ -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 f}from"../../vendor/preload-helper.js";import{a as
|
|
2
|
+
import{_ as f}from"../../vendor/preload-helper.js";import{a as $,n as r,i as k,x as s,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-icon-button/scb-icon-button.js";import"../scb-link/scb-link.js";import"../scb-avatar/scb-avatar.js";import"../scb-list/scb-list-item.js";(function(){try{var i=typeof globalThis<"u"?globalThis:window;if(!i.__scb_ce_guard_installed__){i.__scb_ce_guard_installed__=!0;var t=customElements.define.bind(customElements);customElements.define=function(o,n,c){try{customElements.get(o)||t(o,n,c)}catch(l){var d=String(l||"");if(d.indexOf("already been used")===-1&&d.indexOf("NotSupportedError")===-1)throw l}}}}catch{}})();var z=Object.defineProperty,w=Object.getOwnPropertyDescriptor,x=i=>{throw TypeError(i)},a=(i,t,o,n)=>{for(var c=n>1?void 0:n?w(t,o):t,d=i.length-1,l;d>=0;d--)(l=i[d])&&(c=(n?l(t,o,c):l(c))||c);return n&&c&&z(t,o,c),c},S=(i,t,o)=>t.has(i)||x("Cannot "+o),T=(i,t,o)=>t.has(i)?x("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(i):t.set(i,o),y=(i,t,o)=>(S(i,t,"access private method"),o),b,g;let e=class extends k{constructor(){super(...arguments),T(this,b),this.type="",this.variant="",this.direction="",this.mediaType="",this.mediaHref="",this.mediaAlt="",this.mediaSrcset="",this.mediaSizes="",this.mediaLoading="auto",this.mediaDecoding="async",this.mediaFetchPriority="auto",this.mediaFit="cover",this.mediaPosition="center",this.mediaWidth="",this.mediaHeight="",this.mediaAspect="",this.mediaPlaceholder=!1,this.cardHref="",this.title="",this.subtitle="",this.supportingText="",this.commentsText="",this.comments=0,this.commentsHref="",this.likesText="",this.likes=0,this.hasLiked=!1,this.likesInteractive=!1,this.sizing="stretch",this.width="",this.maxWidth="",this.height="",this.maxHeight="",this.spacing="",this.spacingTop="",this.spacingBottom="",this.__onImgLoad=i=>{const t=i.currentTarget.closest(".media");t&&t.classList.add("is-loaded")},this.__onKeyDown=i=>{(i.key==="Enter"||i.key===" ")&&this.cardHref&&(i.preventDefault(),window.open(this.cardHref,"_self"))},this.__handleHrefNavigation=i=>{this.cardHref&&(i.target.closest("a")||window.open(this.cardHref,"_self"))}}__calcAspectWH(i){const t=(i||"").trim();if(!t)return{w:640,h:360};const o=t.includes("/")?t.split("/"):t.includes(":")?t.split(":"):t.includes("x")?t.split("x"):null;if(o&&o.length===2){const c=Number(o[0]),d=Number(o[1]);if(c>0&&d>0)return{w:c,h:d}}const n=Number(t);return isFinite(n)&&n>0?{w:1e3,h:Math.round(1e3/n)}:{w:640,h:360}}__mediaTemplate(){if((this.mediaType||"").toLowerCase()==="avatar")return s`
|
|
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,
|
|
9
|
-
<div class="media ${
|
|
8
|
+
`;if(this.mediaHref||this.mediaSrcset){let t=Number(this.mediaWidth)||0,o=Number(this.mediaHeight)||0;const n=(this.mediaAspect||"").trim();if(!t||!o){const m=this.__calcAspectWH(n||"16/9");t||(t=m.w),o||(o=m.h)}const c=`aspect-ratio:${n||`${t}/${o}`};`,d=this.mediaPlaceholder?"has-ph":"",l=this.mediaFit||"cover",h=this.mediaPosition||"center";return s`
|
|
9
|
+
<div class="media ${d}" style="${c}">
|
|
10
10
|
<slot name="media-sources"></slot>
|
|
11
11
|
<img
|
|
12
12
|
src="${this.mediaHref||""}"
|
|
@@ -16,55 +16,57 @@ import{_ as f}from"../../vendor/preload-helper.js";import{a as k,n as o,i as _,x
|
|
|
16
16
|
loading="${this.mediaLoading}"
|
|
17
17
|
decoding="${this.mediaDecoding}"
|
|
18
18
|
fetchpriority="${this.mediaFetchPriority}"
|
|
19
|
-
style="object-fit:${
|
|
19
|
+
style="object-fit:${l};object-position:${h};"
|
|
20
20
|
width="${t}"
|
|
21
|
-
height="${
|
|
21
|
+
height="${o}"
|
|
22
22
|
@load=${this.__onImgLoad}
|
|
23
23
|
/>
|
|
24
24
|
</div>
|
|
25
|
-
`}return null}mapSpacingToken(
|
|
25
|
+
`}return null}mapSpacingToken(i){if(!i)return;const t=String(i).trim();if(t)return/^\d+$/.test(t)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(t,10)))})`:t}render(){const i=this.variant?`${this.variant.toLowerCase()}`:"",t=this.type==="list"?"vertical":this.direction?this.direction.toLowerCase():"",o=this.cardHref?"clickable":"",n=this.date instanceof Date?this.date.toISOString().slice(0,10):this.date||"",c=(h=!1)=>h?s`<a class="title" href="${this.cardHref}" tabindex="0"
|
|
26
|
+
>${this.title}</a
|
|
27
|
+
><md-icon>arrow_forward</md-icon>`:s`<span class="title">${this.title}</span>`,d=()=>this.__mediaTemplate(),l=h=>s`
|
|
26
28
|
<div
|
|
27
|
-
class="scb-card ${
|
|
28
|
-
@click=${
|
|
29
|
-
@keydown=${
|
|
30
|
-
style="cursor:${
|
|
31
|
-
role=${
|
|
32
|
-
tabindex=${
|
|
29
|
+
class="scb-card ${i} ${t} ${o}"
|
|
30
|
+
@click=${this.cardHref?this.__handleHrefNavigation:null}
|
|
31
|
+
@keydown=${this.cardHref?this.__onKeyDown:null}
|
|
32
|
+
style="cursor:${this.cardHref?"pointer":"default"};"
|
|
33
|
+
role=${this.cardHref?"link":"group"}
|
|
34
|
+
tabindex=${this.cardHref?"0":"-1"}
|
|
33
35
|
aria-label=${this.title||"Kort"}
|
|
34
36
|
>
|
|
35
|
-
${s
|
|
36
|
-
${
|
|
37
|
+
${this.cardHref?s`<md-ripple></md-ripple>`:""}
|
|
38
|
+
${d()}
|
|
37
39
|
${h}
|
|
38
40
|
</div>
|
|
39
|
-
|
|
40
|
-
`;switch(this.type){case"standard":return
|
|
41
|
+
<md-focus-ring></md-focus-ring>
|
|
42
|
+
`;switch(this.type){case"standard":return l(s`
|
|
41
43
|
<div class="full-content">
|
|
42
44
|
<div class="top-content">
|
|
43
|
-
${this.title?
|
|
44
|
-
${this.subtitle?
|
|
45
|
-
${this.supportingText?
|
|
46
|
-
${n?
|
|
45
|
+
${this.title?s`<div class="header">${c(!!this.cardHref)}</div>`:""}
|
|
46
|
+
${this.subtitle?s`<div class="sub-label">${this.subtitle}</div>`:""}
|
|
47
|
+
${this.supportingText?s`<div class="supporting-text">${this.supportingText}</div>`:""}
|
|
48
|
+
${n?s`<div class="date">${n}</div>`:""}
|
|
47
49
|
</div>
|
|
48
50
|
</div>
|
|
49
|
-
`);case"list":return
|
|
51
|
+
`);case"list":return l(s`
|
|
50
52
|
<div class="full-content">
|
|
51
53
|
<div class="top-content">
|
|
52
|
-
${this.title?
|
|
53
|
-
${this.subtitle?
|
|
54
|
-
${this.supportingText?
|
|
55
|
-
${n?
|
|
54
|
+
${this.title?s`<div class="header"><span class="title">${this.title}</span></div>`:""}
|
|
55
|
+
${this.subtitle?s`<div class="sub-label">${this.subtitle}</div>`:""}
|
|
56
|
+
${this.supportingText?s`<div class="supporting-text">${this.supportingText}</div>`:""}
|
|
57
|
+
${n?s`<div class="date">${n}</div>`:""}
|
|
56
58
|
</div>
|
|
57
59
|
<div class="content list">
|
|
58
60
|
<slot></slot>
|
|
59
61
|
</div>
|
|
60
62
|
</div>
|
|
61
|
-
`);case"social":const h=this.commentsHref
|
|
63
|
+
`);case"social":const h=this.commentsHref,m=p=>{p.stopPropagation()},u=p=>{const v=this.renderRoot?.querySelector(".scb-card");v&&(p?v.classList.add("no-hover"):v.classList.remove("no-hover"))};return l(s`
|
|
62
64
|
<div class="full-content">
|
|
63
65
|
<div class="top-content">
|
|
64
|
-
${this.title?
|
|
65
|
-
${this.subtitle?
|
|
66
|
-
${this.supportingText?
|
|
67
|
-
${n?
|
|
66
|
+
${this.title?s`<div class="header">${c(!!this.cardHref)}</div>`:""}
|
|
67
|
+
${this.subtitle?s`<div class="sub-label">${this.subtitle}</div>`:""}
|
|
68
|
+
${this.supportingText?s`<div class="supporting-text">${this.supportingText}</div>`:""}
|
|
69
|
+
${n?s`<div class="date">${n}</div>`:""}
|
|
68
70
|
</div>
|
|
69
71
|
<div class="content">
|
|
70
72
|
<div class="social-metrics">
|
|
@@ -72,9 +74,9 @@ import{_ as f}from"../../vendor/preload-helper.js";import{a as k,n as o,i as _,x
|
|
|
72
74
|
@mouseenter=${()=>u(!0)}
|
|
73
75
|
@mouseleave=${()=>u(!1)}
|
|
74
76
|
>
|
|
75
|
-
${h!==""?
|
|
76
|
-
<scb-icon-button href="${h}" tabindex="0" @click=${
|
|
77
|
-
`:
|
|
77
|
+
${h!==""?s`
|
|
78
|
+
<scb-icon-button href="${h}" tabindex="0" @click=${m} variant="standard" icon="comment" aria-label="Gå till kommentarer" tooltip="Gå till kommentarer"></scb-icon-button>
|
|
79
|
+
`:s`
|
|
78
80
|
<md-icon>comment</md-icon>
|
|
79
81
|
`}
|
|
80
82
|
<span>${this.commentsText}: ${this.comments}</span>
|
|
@@ -83,52 +85,52 @@ import{_ as f}from"../../vendor/preload-helper.js";import{a as k,n as o,i as _,x
|
|
|
83
85
|
@mouseenter=${()=>u(!0)}
|
|
84
86
|
@mouseleave=${()=>u(!1)}
|
|
85
87
|
>
|
|
86
|
-
${this.likesInteractive?
|
|
88
|
+
${this.likesInteractive?s`
|
|
87
89
|
<scb-icon-button variant="standard" icon="${this.hasLiked,"thumb_up"}" aria-label="${this.likesText||"Gilla"}" tooltip="${this.likesText||"Gilla"}"
|
|
88
|
-
@click=${
|
|
89
|
-
@keydown=${
|
|
90
|
-
@hover=${
|
|
90
|
+
@click=${p=>{p.stopPropagation(),this.dispatchEvent(new CustomEvent("like-click",{bubbles:!0,composed:!0}))}}
|
|
91
|
+
@keydown=${p=>{(p.key==="Enter"||p.key===" ")&&(p.preventDefault(),p.stopPropagation(),this.dispatchEvent(new CustomEvent("like-click",{bubbles:!0,composed:!0})))}}
|
|
92
|
+
@hover=${p=>{p.preventDefault(),p.stopPropagation(),this.dispatchEvent(new CustomEvent("like-hover",{bubbles:!0,composed:!0}))}}
|
|
91
93
|
></scb-icon-button>
|
|
92
|
-
`:
|
|
94
|
+
`:s`<md-icon>"${this.hasLiked,"thumb_up"}"</md-icon>`}
|
|
93
95
|
<span>${this.likesText}: ${this.likes}</span>
|
|
94
96
|
</span>
|
|
95
97
|
</div>
|
|
96
98
|
</div>
|
|
97
99
|
</div>
|
|
98
|
-
`);case"link":return
|
|
100
|
+
`);case"link":return l(s`
|
|
99
101
|
<div class="full-content">
|
|
100
102
|
<div class="top-content">
|
|
101
|
-
${this.title?
|
|
102
|
-
${this.subtitle?
|
|
103
|
-
${this.supportingText?
|
|
104
|
-
${n?
|
|
103
|
+
${this.title?s`<div class="header"><span class="title">${this.title}</span></div>`:""}
|
|
104
|
+
${this.subtitle?s`<div class="sub-label">${this.subtitle}</div>`:""}
|
|
105
|
+
${this.supportingText?s`<div class="supporting-text">${this.supportingText}</div>`:""}
|
|
106
|
+
${n?s`<div class="date">${n}</div>`:""}
|
|
105
107
|
</div>
|
|
106
108
|
<div class="content links">
|
|
107
109
|
<slot></slot>
|
|
108
110
|
</div>
|
|
109
111
|
</div>
|
|
110
|
-
`);case"action":return
|
|
112
|
+
`);case"action":return l(s`
|
|
111
113
|
<div class="full-content">
|
|
112
114
|
<div class="top-content">
|
|
113
|
-
${this.title?
|
|
114
|
-
${this.subtitle?
|
|
115
|
-
${this.supportingText?
|
|
116
|
-
${n?
|
|
115
|
+
${this.title?s`<div class="header"><span class="title">${this.title}</span></div>`:""}
|
|
116
|
+
${this.subtitle?s`<div class="sub-label">${this.subtitle}</div>`:""}
|
|
117
|
+
${this.supportingText?s`<div class="supporting-text">${this.supportingText}</div>`:""}
|
|
118
|
+
${n?s`<div class="date">${n}</div>`:""}
|
|
117
119
|
</div>
|
|
118
120
|
<div class="content actions">
|
|
119
121
|
<slot></slot>
|
|
120
122
|
</div>
|
|
121
123
|
</div>
|
|
122
|
-
`);default:return
|
|
124
|
+
`);default:return l(s`
|
|
123
125
|
<div class="full-content">
|
|
124
126
|
<div class="top-content">
|
|
125
|
-
${this.title?
|
|
126
|
-
${this.subtitle?
|
|
127
|
-
${this.supportingText?
|
|
128
|
-
${n?
|
|
127
|
+
${this.title?s`<div class="header">${c(!!this.cardHref)}</div>`:""}
|
|
128
|
+
${this.subtitle?s`<div class="sub-label">${this.subtitle}</div>`:""}
|
|
129
|
+
${this.supportingText?s`<div class="supporting-text">${this.supportingText}</div>`:""}
|
|
130
|
+
${n?s`<div class="date">${n}</div>`:""}
|
|
129
131
|
</div>
|
|
130
132
|
</div>
|
|
131
|
-
`)}}updated(
|
|
133
|
+
`)}}updated(i){super.updated(i),i.has("width")&&(this.width?this.style.inlineSize=this.width:this.style.removeProperty("inline-size")),i.has("maxWidth")&&(this.maxWidth?this.style.maxInlineSize=this.maxWidth:this.style.removeProperty("max-inline-size")),i.has("height")&&(this.height?this.style.blockSize=this.height:this.style.removeProperty("block-size")),i.has("maxHeight")&&(this.maxHeight?this.style.maxBlockSize=this.maxHeight:this.style.removeProperty("max-block-size")),i.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"),(i.has("spacing")||i.has("spacingTop")||i.has("spacingBottom"))&&y(this,b,g).call(this)}async firstUpdated(i){e.__iconLoaded||(await f(()=>import("../../vendor/vendor-material.js").then(t=>t.i),__vite__mapDeps([0,1]),import.meta.url),e.__iconLoaded=!0),e.__rippleLoaded||(await f(()=>import("../../vendor/vendor-material.js").then(t=>t.r),__vite__mapDeps([0,1]),import.meta.url),e.__rippleLoaded=!0),y(this,b,g).call(this)}};b=new WeakSet;g=function(){const i=this.mapSpacingToken(this.spacing),t=this.mapSpacingToken(this.spacingTop)??i,o=this.mapSpacingToken(this.spacingBottom)??i;t?this.style.setProperty("--scb-card-spacing-block-start",t):this.style.removeProperty("--scb-card-spacing-block-start"),o?this.style.setProperty("--scb-card-spacing-block-end",o):this.style.removeProperty("--scb-card-spacing-block-end")};e.__iconLoaded=!1;e.__rippleLoaded=!1;e.styles=$`
|
|
132
134
|
:host {
|
|
133
135
|
display: block;
|
|
134
136
|
box-sizing: border-box;
|
|
@@ -458,4 +460,4 @@ import{_ as f}from"../../vendor/preload-helper.js";import{a as k,n as o,i as _,x
|
|
|
458
460
|
.scb-card.filled .content.list ::slotted(scb-list) {
|
|
459
461
|
--scb-list-bg: var(--md-sys-color-surface-dim);
|
|
460
462
|
}
|
|
461
|
-
`;
|
|
463
|
+
`;a([r({type:String,reflect:!0})],e.prototype,"type",2);a([r({type:String,reflect:!0})],e.prototype,"variant",2);a([r({type:String,reflect:!0})],e.prototype,"direction",2);a([r({type:String,attribute:"media-type"})],e.prototype,"mediaType",2);a([r({type:String,attribute:"media-href"})],e.prototype,"mediaHref",2);a([r({type:String,attribute:"media-alt"})],e.prototype,"mediaAlt",2);a([r({type:String,attribute:"media-srcset"})],e.prototype,"mediaSrcset",2);a([r({type:String,attribute:"media-sizes"})],e.prototype,"mediaSizes",2);a([r({type:String,attribute:"media-loading"})],e.prototype,"mediaLoading",2);a([r({type:String,attribute:"media-decoding"})],e.prototype,"mediaDecoding",2);a([r({type:String,attribute:"media-fetchpriority"})],e.prototype,"mediaFetchPriority",2);a([r({type:String,attribute:"media-fit"})],e.prototype,"mediaFit",2);a([r({type:String,attribute:"media-position"})],e.prototype,"mediaPosition",2);a([r({type:String,attribute:"media-width"})],e.prototype,"mediaWidth",2);a([r({type:String,attribute:"media-height"})],e.prototype,"mediaHeight",2);a([r({type:String,attribute:"media-aspect"})],e.prototype,"mediaAspect",2);a([r({type:Boolean,attribute:"media-placeholder"})],e.prototype,"mediaPlaceholder",2);a([r({type:String,attribute:"card-href",reflect:!0})],e.prototype,"cardHref",2);a([r({type:String,reflect:!0})],e.prototype,"title",2);a([r({type:String,reflect:!0})],e.prototype,"subtitle",2);a([r({type:String,attribute:"supporting-text",reflect:!0})],e.prototype,"supportingText",2);a([r({type:Date,reflect:!0})],e.prototype,"date",2);a([r({type:String,attribute:"social-comments-text",reflect:!0})],e.prototype,"commentsText",2);a([r({type:Number,attribute:"social-comments",reflect:!0})],e.prototype,"comments",2);a([r({type:String,attribute:"social-comments-href",reflect:!0})],e.prototype,"commentsHref",2);a([r({type:String,attribute:"social-likes-text",reflect:!0})],e.prototype,"likesText",2);a([r({type:Number,attribute:"social-likes",reflect:!0})],e.prototype,"likes",2);a([r({type:Boolean,attribute:"social-has-liked",reflect:!0})],e.prototype,"hasLiked",2);a([r({type:Boolean,attribute:"social-likes-interactive",reflect:!0})],e.prototype,"likesInteractive",2);a([r({type:String,reflect:!0})],e.prototype,"sizing",2);a([r({type:String,reflect:!0})],e.prototype,"width",2);a([r({type:String,reflect:!0,attribute:"max-width"})],e.prototype,"maxWidth",2);a([r({type:String,reflect:!0})],e.prototype,"height",2);a([r({type:String,reflect:!0,attribute:"max-height"})],e.prototype,"maxHeight",2);a([r({type:String,reflect:!0})],e.prototype,"spacing",2);a([r({type:String,attribute:"spacing-top",reflect:!0})],e.prototype,"spacingTop",2);a([r({type:String,attribute:"spacing-bottom",reflect:!0})],e.prototype,"spacingBottom",2);e=a([_("scb-card")],e);
|
|
@@ -33,7 +33,7 @@ import{a as b,n as c,i as p,E as d,x as h,t as u}from"../../vendor/vendor.js";im
|
|
|
33
33
|
display: inline-flex;
|
|
34
34
|
align-items: center;
|
|
35
35
|
padding: var(--spacing-2, 4px);
|
|
36
|
-
gap: var(--spacing-
|
|
36
|
+
gap: var(--spacing-5, 16px);
|
|
37
37
|
cursor: pointer;
|
|
38
38
|
overflow: visible;
|
|
39
39
|
}
|
|
@@ -44,7 +44,6 @@ import{a as b,n as c,i as p,E as d,x as h,t as u}from"../../vendor/vendor.js";im
|
|
|
44
44
|
|
|
45
45
|
.box-wrap {
|
|
46
46
|
height: var(--scb-checkbox-target, 40px);
|
|
47
|
-
width: var(--scb-checkbox-target, 40px);
|
|
48
47
|
display: flex;
|
|
49
48
|
align-items: center;
|
|
50
49
|
justify-content: center;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as c,n as d,i as p,x as h,t as u}from"../../vendor/vendor.js";import"../scb-button/scb-button.js";import"../../vendor/vendor-material.js";(function(){try{var t=typeof globalThis<"u"?globalThis:window;if(!t.__scb_ce_guard_installed__){t.__scb_ce_guard_installed__=!0;var
|
|
1
|
+
import{a as c,n as d,i as p,x as h,t as u}from"../../vendor/vendor.js";import"../scb-button/scb-button.js";import"../../vendor/vendor-material.js";(function(){try{var t=typeof globalThis<"u"?globalThis:window;if(!t.__scb_ce_guard_installed__){t.__scb_ce_guard_installed__=!0;var o=customElements.define.bind(customElements);customElements.define=function(n,s,e){try{customElements.get(n)||o(n,s,e)}catch(i){var l=String(i||"");if(l.indexOf("already been used")===-1&&l.indexOf("NotSupportedError")===-1)throw i}}}}catch{}})();var b=Object.defineProperty,m=Object.getOwnPropertyDescriptor,r=(t,o,n,s)=>{for(var e=s>1?void 0:s?m(o,n):o,l=t.length-1,i;l>=0;l--)(i=t[l])&&(e=(s?i(o,n,e):i(e))||e);return s&&e&&b(o,n,e),e};let a=class extends p{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(){this._measureContent(),this._countElements();const t=this.shadowRoot?.querySelector("slot");t&&t.addEventListener("slotchange",()=>{this._measureContent(),this._countElements()})}updated(t){(t.has("collapsed-height")||t.has("expanded"))&&this._measureContent(),(t.has("visible-elements")||t.has("variant"))&&this._countElements()}_measureContent(){if(this.variant==="height"){const t=this.shadowRoot?.querySelector("slot");if(t){const o=t.assignedNodes({flatten:!0});let n=0;o.forEach(s=>{if(s.nodeType===Node.ELEMENT_NODE){const e=s;n+=e.offsetHeight||e.scrollHeight||0}}),this._contentHeight=n,this.requestUpdate()}}}_countElements(){if(this.variant==="elements"){const t=this.shadowRoot?.querySelector("slot");if(t){const o=t.assignedNodes({flatten:!0});this._elementCount=o.filter(n=>n.nodeType===Node.ELEMENT_NODE).length,this.requestUpdate()}}}render(){if(this.variant==="height"){const t=this.expanded?`${this._contentHeight}px`:`${this.collapsedHeight}px`,o=this._contentHeight>this.collapsedHeight;return h`
|
|
2
2
|
<div
|
|
3
3
|
class="collapse-content"
|
|
4
4
|
id="${this._contentId}"
|
|
@@ -7,20 +7,20 @@ import{a as c,n as d,i as p,x as h,t as u}from"../../vendor/vendor.js";import"..
|
|
|
7
7
|
aria-label="${this._regionLabel}"
|
|
8
8
|
>
|
|
9
9
|
<slot></slot>
|
|
10
|
-
${
|
|
10
|
+
${o&&!this.expanded?h`<div class="collapse-gradient-overlay"></div>`:""}
|
|
11
11
|
</div>
|
|
12
|
-
${
|
|
12
|
+
${o?h`
|
|
13
13
|
<scb-button
|
|
14
14
|
id="${this._contentId}-button"
|
|
15
15
|
@click="${this.toggle}"
|
|
16
16
|
variant="text"
|
|
17
17
|
label="${this.expanded?this.collapseButtonLabel:this.expandButtonLabel}"
|
|
18
|
-
icon="${this.expanded?"
|
|
18
|
+
icon="${this.expanded?"keyboard_arrow_up":"keyboard_arrow_down"}"
|
|
19
19
|
aria-controls="${this._contentId}"
|
|
20
20
|
>
|
|
21
21
|
</scb-button>
|
|
22
22
|
`:""}
|
|
23
|
-
`}else{const t=typeof this.visibleElements=="string"?parseInt(this.visibleElements,10):this.visibleElements,
|
|
23
|
+
`}else{const t=typeof this.visibleElements=="string"?parseInt(this.visibleElements,10):this.visibleElements,o=this._elementCount>t;return setTimeout(()=>{const n=this.shadowRoot?.querySelector("slot");n&&n.assignedNodes({flatten:!0}).filter(e=>e.nodeType===Node.ELEMENT_NODE).forEach((e,l)=>{const i=e;!this.expanded&&l>=t?i.classList.add("scb-collapsed-hidden"):i.classList.remove("scb-collapsed-hidden")})},0),h`
|
|
24
24
|
<div
|
|
25
25
|
class="collapse-content"
|
|
26
26
|
id="${this._contentId}"
|
|
@@ -29,13 +29,13 @@ import{a as c,n as d,i as p,x as h,t as u}from"../../vendor/vendor.js";import"..
|
|
|
29
29
|
>
|
|
30
30
|
<slot></slot>
|
|
31
31
|
</div>
|
|
32
|
-
${
|
|
32
|
+
${o?h`
|
|
33
33
|
<scb-button
|
|
34
34
|
id="${this._contentId}-button"
|
|
35
35
|
@click="${this.toggle}"
|
|
36
36
|
variant="text"
|
|
37
37
|
label="${this.expanded?this.collapseButtonLabel:this.expandButtonLabel}"
|
|
38
|
-
icon="${this.expanded?"
|
|
38
|
+
icon="${this.expanded?"keyboard_arrow_up":"keyboard_arrow_down"}"
|
|
39
39
|
aria-controls="${this._contentId}"
|
|
40
40
|
>
|
|
41
41
|
</scb-button>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import{a as m,n as
|
|
1
|
+
import{a as m,n as p,e as h,i as f,x as b,t as _}from"../../vendor/vendor.js";import"../scb-button/scb-button.js";import"../scb-menu/scb-menu.js";import"../../vendor/vendor-material.js";import"../scb-menu/scb-menu-item.js";import"../scb-divider/scb-divider.js";import"../scb-menu/scb-sub-menu.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(n,s,i){try{customElements.get(n)||t(n,s,i)}catch(d){var l=String(d||"");if(l.indexOf("already been used")===-1&&l.indexOf("NotSupportedError")===-1)throw d}}}}catch{}})();var y=Object.defineProperty,g=Object.getOwnPropertyDescriptor,a=(e,t,n,s)=>{for(var i=s>1?void 0:s?g(t,n):t,l=e.length-1,d;l>=0;l--)(d=e[l])&&(i=(s?d(t,n,i):d(i))||i);return s&&i&&y(t,n,i),i};let r=class extends f{constructor(){super(...arguments),this.label="Dropdown",this.variant="filled",this.open=!1,this.disabled=!1,this.menuGap="3",this.width=null,this.maxWidth=null,this._slottedMenuEl=null,this._openSettledTimer=null,this._menuCloseTimer=null,this._panelResizeObserver=null,this._panelHeightSyncRaf=null,this._onDocumentClickBound=e=>{if(!this.open)return;const t=e.composedPath(),n=t.find(s=>s instanceof HTMLElement&&s.tagName.toLowerCase()==="scb-dropdown");if(n&&n!==this){this.open=!1;return}t.includes(this)||(this.open=!1)},this._onDocumentKeydownBound=e=>{this.open&&e.key==="Escape"&&(this.open=!1)},this._onSlottedMenuOpen=()=>{this.open||(this.open=!0)},this._onSlottedMenuClose=()=>{this.open&&(this.open=!1)},this._onSlotChange=()=>{this._syncSlottedMenu(),this._applyPanelSizing(),this._applyInertByOpen(),this.requestUpdate()},this._onTriggerClick=e=>{e.stopPropagation(),!this.disabled&&(this.open=!this.open)}}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this._onDocumentClickBound,!0),document.addEventListener("keydown",this._onDocumentKeydownBound)}disconnectedCallback(){document.removeEventListener("click",this._onDocumentClickBound,!0),document.removeEventListener("keydown",this._onDocumentKeydownBound),this._detachSlottedMenuListeners(),this._panelResizeObserver&&(this._panelResizeObserver.disconnect(),this._panelResizeObserver=null),this._panelHeightSyncRaf!==null&&(window.cancelAnimationFrame(this._panelHeightSyncRaf),this._panelHeightSyncRaf=null),this._openSettledTimer!==null&&(window.clearTimeout(this._openSettledTimer),this._openSettledTimer=null),this._menuCloseTimer!==null&&(window.clearTimeout(this._menuCloseTimer),this._menuCloseTimer=null),super.disconnectedCallback()}firstUpdated(e){super.firstUpdated(e),this._syncSlottedMenu(),this._applyPanelVars(),this._applyPanelSizing(),this._applyChevronState(),this._applyInertByOpen(),this._setupPanelResizeObserver(),this._syncPanelMaxHeightByOpen(),this._syncOverflowVisibilityByOpen()}updated(e){super.updated(e),e.has("menuGap")&&this._applyPanelVars(),(e.has("width")||e.has("maxWidth"))&&this._applyPanelSizing(),e.has("open")&&(this.open||this._closeAllSubMenus(),this._syncSlottedMenuOpen(),this._applyChevronState(),this._applyInertByOpen(),this._syncPanelMaxHeightByOpen(),this._syncOverflowVisibilityByOpen())}_applyPanelVars(){if(this.menuGap==null||String(this.menuGap).trim()===""){this.style.removeProperty("--scb-dropdown-panel-gap");return}this.style.setProperty("--scb-dropdown-panel-gap",this._mapSpacingToken(this.menuGap))}_applyPanelSizing(){const e=this.renderRoot.querySelector(".panel-surface");e&&(this.width&&String(this.width).trim()!==""?e.style.inlineSize=this.width:e.style.removeProperty("inline-size"),this.maxWidth&&String(this.maxWidth).trim()!==""?e.style.maxInlineSize=this.maxWidth:e.style.removeProperty("max-inline-size")),this._slottedMenuEl&&(this.width&&String(this.width).trim()!==""?this._slottedMenuEl.style.inlineSize=this.width:this._slottedMenuEl.style.removeProperty("inline-size"),this.maxWidth&&String(this.maxWidth).trim()!==""?this._slottedMenuEl.style.maxInlineSize=this.maxWidth:this._slottedMenuEl.style.removeProperty("max-inline-size")),this._schedulePanelHeightSync()}_setupPanelResizeObserver(){if(this._panelResizeObserver||typeof ResizeObserver>"u")return;const e=this._panelInnerEl;e&&(this._panelResizeObserver=new ResizeObserver(()=>{this._schedulePanelHeightSync()}),this._panelResizeObserver.observe(e))}_schedulePanelHeightSync(){this._panelHeightSyncRaf===null&&(this._panelHeightSyncRaf=window.requestAnimationFrame(()=>{this._panelHeightSyncRaf=null,this._syncPanelMaxHeightByOpen()}))}_syncPanelMaxHeightByOpen(){const e=this._panelSurfaceEl;if(!e)return;if(this._slottedMenuEl){e.style.removeProperty("--scb-dropdown-panel-current-max-height");return}if(!this.open){e.style.setProperty("--scb-dropdown-panel-current-max-height","0px");return}const t=this._panelInnerEl;if(!t)return;const n=`${Math.ceil(t.scrollHeight)}px`;e.style.getPropertyValue("--scb-dropdown-panel-current-max-height").trim()!==n&&e.style.setProperty("--scb-dropdown-panel-current-max-height",n)}_mapSpacingToken(e){const t=String(e).trim();return/^\d+$/.test(t)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(t,10)))})`:t}_syncSlottedMenu(){const t=(this._slotEl?.assignedElements({flatten:!0})??[]).find(n=>n.tagName.toLowerCase()==="scb-menu");if(t===this._slottedMenuEl){this._syncSlottedMenuOpen();return}this._detachSlottedMenuListeners(),this._slottedMenuEl=t??null,this._slottedMenuEl&&(this._slottedMenuEl.addEventListener("open",this._onSlottedMenuOpen),this._slottedMenuEl.addEventListener("close",this._onSlottedMenuClose),this._syncSlottedMenuOpen())}_detachSlottedMenuListeners(){this._slottedMenuEl&&(this._slottedMenuEl.removeEventListener("open",this._onSlottedMenuOpen),this._slottedMenuEl.removeEventListener("close",this._onSlottedMenuClose))}_syncSlottedMenuOpen(){if(!this._slottedMenuEl)return;if(this._menuCloseTimer!==null&&(window.clearTimeout(this._menuCloseTimer),this._menuCloseTimer=null),this.open){this._slottedMenuEl.open=!0;return}const e=this._getPanelTransitionMs();if(e<=0){this._slottedMenuEl.open=!1;return}this._menuCloseTimer=window.setTimeout(()=>{this._menuCloseTimer=null,!this.open&&this._slottedMenuEl&&(this._slottedMenuEl.open=!1)},e)}_syncOverflowVisibilityByOpen(){if(this._openSettledTimer!==null&&(window.clearTimeout(this._openSettledTimer),this._openSettledTimer=null),this.removeAttribute("data-open-settled"),!this.open)return;const e=this.renderRoot.querySelector(".panel-surface");if(!e){this.setAttribute("data-open-settled","");return}const t=this._getTransitionMs(e);if(t<=0){this.setAttribute("data-open-settled","");return}this._openSettledTimer=window.setTimeout(()=>{this._openSettledTimer=null,this.open&&this.setAttribute("data-open-settled","")},t)}_getPanelTransitionMs(){const e=this.renderRoot.querySelector(".panel-surface");return e?this._getTransitionMs(e):0}_getTransitionMs(e){const t=getComputedStyle(e),n=t.transitionDuration.split(",").map(o=>o.trim()),s=t.transitionDelay.split(",").map(o=>o.trim()),i=o=>{const u=parseFloat(o);return Number.isFinite(u)?o.endsWith("ms")?u:o.endsWith("s")?u*1e3:u:0},l=Math.max(n.length,s.length);let d=0;for(let o=0;o<l;o+=1){const u=i(n[o]??n[n.length-1]??"0s"),c=i(s[o]??s[s.length-1]??"0s");d=Math.max(d,u+c)}return Math.ceil(d)}_applyInertByOpen(){const e=this.renderRoot.querySelector(".panel");e&&(this.open?(e.removeAttribute("inert"),e.setAttribute("aria-hidden","false"),this._restoreTabIndexesIfNeeded()):(e.setAttribute("inert",""),e.setAttribute("aria-hidden","true"),this._removeTabIndexesIfNeeded()))}_supportsInert(){return"inert"in HTMLElement.prototype}_collectFocusableFromSlot(){const e=this._slotEl;if(!e)return[];const t=e.assignedElements({flatten:!0}),n=[],s=i=>{i instanceof HTMLElement&&i.matches("a,button,input,select,textarea,[tabindex]")&&n.push(i)};return t.forEach(i=>{s(i),i.querySelectorAll?.("a,button,input,select,textarea,[tabindex]").forEach(l=>s(l))}),n}_removeTabIndexesIfNeeded(){if(this._supportsInert())return;this._collectFocusableFromSlot().forEach(t=>{const n=t.getAttribute("tabindex");n!==null&&t.setAttribute("data-scb-prev-tabindex",n),t.setAttribute("tabindex","-1")})}_restoreTabIndexesIfNeeded(){if(this._supportsInert())return;this._collectFocusableFromSlot().forEach(t=>{const n=t.getAttribute("data-scb-prev-tabindex");n!==null?(t.setAttribute("tabindex",n),t.removeAttribute("data-scb-prev-tabindex")):t.removeAttribute("tabindex")})}_closeAllSubMenus(){const e=this.querySelectorAll("scb-sub-menu");for(const t of e)t.removeAttribute("open")}_applyChevronState(){const e=this._getChevronIconEl();e&&(e.style.transition="transform var(--motion-duration-medium, 200ms) var(--motion-easing-standard, ease)",e.style.transformOrigin="center",e.style.transform=this.open?"rotate(180deg)":"rotate(0deg)")}_getChevronIconEl(){const t=this._triggerEl?.shadowRoot;return t?t.querySelector('md-icon[slot="icon"]')??t.querySelector("md-icon"):null}render(){const e=!!this._slottedMenuEl;return b`
|
|
2
2
|
<scb-button
|
|
3
3
|
label=${this.label}
|
|
4
4
|
variant=${this.variant}
|
|
5
|
-
icon="
|
|
5
|
+
icon="keyboard_arrow_down"
|
|
6
6
|
?trailing-icon=${!0}
|
|
7
7
|
?disabled=${this.disabled}
|
|
8
8
|
@click=${this._onTriggerClick}
|
|
@@ -52,7 +52,7 @@ import{a as m,n as d,e as h,i as f,x as b,t as _}from"../../vendor/vendor.js";im
|
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
.panel-surface {
|
|
55
|
-
width:
|
|
55
|
+
width: 100%;
|
|
56
56
|
max-width: var(--scb-dropdown-panel-max-width, 600px);
|
|
57
57
|
background: var(--md-sys-color-surface, #ffffff);
|
|
58
58
|
box-shadow: var(--elevation-2, 0px 2px 10px rgba(0, 0, 0, 0.12));
|
|
@@ -174,9 +174,19 @@ import{a as m,n as d,e as h,i as f,x as b,t as _}from"../../vendor/vendor.js";im
|
|
|
174
174
|
padding: 0;
|
|
175
175
|
}
|
|
176
176
|
|
|
177
|
+
::slotted(scb-checkbox) {
|
|
178
|
+
display: block;
|
|
179
|
+
padding-right: var(--spacing-4, 12px);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
::slotted(scb-radio-button) {
|
|
183
|
+
display: block;
|
|
184
|
+
padding-right: var(--spacing-4, 12px);
|
|
185
|
+
}
|
|
186
|
+
|
|
177
187
|
@media (prefers-reduced-motion: reduce) {
|
|
178
188
|
.panel-surface {
|
|
179
189
|
transition: none;
|
|
180
190
|
}
|
|
181
191
|
}
|
|
182
|
-
`;a([
|
|
192
|
+
`;a([p({type:String})],r.prototype,"label",2);a([p({type:String})],r.prototype,"variant",2);a([p({type:Boolean,reflect:!0})],r.prototype,"open",2);a([p({type:Boolean,reflect:!0})],r.prototype,"disabled",2);a([p({type:String,attribute:"menu-gap"})],r.prototype,"menuGap",2);a([p({type:String})],r.prototype,"width",2);a([p({type:String,attribute:"max-width"})],r.prototype,"maxWidth",2);a([h("scb-button")],r.prototype,"_triggerEl",2);a([h("slot")],r.prototype,"_slotEl",2);a([h(".panel-surface")],r.prototype,"_panelSurfaceEl",2);a([h(".panel-inner")],r.prototype,"_panelInnerEl",2);r=a([_("scb-dropdown")],r);
|
|
@@ -1,8 +1,8 @@
|
|
|
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 p}from"../../vendor/preload-helper.js";import{a as
|
|
3
|
-
<md-icon aria-hidden="true">${this.toggleofficon}</md-icon>
|
|
4
|
-
<md-icon slot="selected" aria-hidden="true">${this.toggleonicon}</md-icon>
|
|
5
|
-
`}__renderSingleIcon(){return l`<md-icon aria-hidden="true">${this.icon}</md-icon>`}__renderMd(){const t=this.toggle?this.__renderToggleIcons():this.__renderSingleIcon();if(this.toggle)switch(this.variant){case"filled":return l`
|
|
2
|
+
import{_ as p}from"../../vendor/preload-helper.js";import{a as b,n as r,i as m,x as l,E as i,t as v}from"../../vendor/vendor.js";import"../../vendor/vendor-material.js";(function(){try{var t=typeof globalThis<"u"?globalThis:window;if(!t.__scb_ce_guard_installed__){t.__scb_ce_guard_installed__=!0;var e=customElements.define.bind(customElements);customElements.define=function(o,d,a){try{customElements.get(o)||e(o,d,a)}catch(h){var c=String(h||"");if(c.indexOf("already been used")===-1&&c.indexOf("NotSupportedError")===-1)throw h}}}}catch{}})();var y=Object.defineProperty,$=Object.getOwnPropertyDescriptor,g=t=>{throw TypeError(t)},n=(t,e,o,d)=>{for(var a=d>1?void 0:d?$(e,o):e,c=t.length-1,h;c>=0;c--)(h=t[c])&&(a=(d?h(e,o,a):h(a))||a);return d&&a&&y(e,o,a),a},A=(t,e,o)=>e.has(t)||g("Cannot "+o),L=(t,e,o)=>e.has(t)?g("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,o),_=(t,e,o)=>(A(t,e,"access private method"),o),u,f;let s=class extends m{constructor(){super(...arguments),L(this,u),this.icon="home",this.filled=!1,this.iconFilled=!1,this.tooltip="",this.ariaLabel="",this.variant="standard",this.toggle=!1,this.selected=!1,this.toggleofficon="add",this.toggleonicon="remove",this.disabled=!1,this.spacing="",this.spacingTop="",this.spacingBottom="",this.href="",this.target="",this.rel="",this.__loadedVariants=new Set,this.__iconLoaded=!1,this.__lastMdHost=null,this.__onInnerChange=()=>{const e=!!this.__getMdHost()?.selected;this.toggle&&(this.selected=e),this.dispatchEvent(new CustomEvent("change",{detail:{selected:e},bubbles:!0,composed:!0}))}}async firstUpdated(){await this.__ensureDepsLoaded(),await this.updateComplete,this.__attachChangeListener(),this.__syncTitleAndAria(),_(this,u,f).call(this)}updated(t){if(super.updated(t),t.has("iconFilled")?this.filled!==this.iconFilled&&(this.filled=this.iconFilled):t.has("filled")&&this.iconFilled!==this.filled&&(this.iconFilled=this.filled),(t.has("spacing")||t.has("spacingTop")||t.has("spacingBottom"))&&_(this,u,f).call(this),t.has("variant")){this.__ensureDepsLoaded().then(()=>{queueMicrotask(()=>{this.__attachChangeListener(),this.__syncTitleAndAria()})});return}(t.has("toggle")||t.has("icon")||t.has("toggleofficon")||t.has("toggleonicon")||t.has("selected")||t.has("disabled")||t.has("tooltip")||t.has("ariaLabel"))&&queueMicrotask(()=>{this.__attachChangeListener(),this.__syncTitleAndAria()})}disconnectedCallback(){this.__lastMdHost?.removeEventListener?.("change",this.__onInnerChange),this.__lastMdHost=null,super.disconnectedCallback()}async __ensureDepsLoaded(){if(!this.__loadedVariants.has(this.variant)){switch(this.variant){case"filled":await p(()=>import("../../vendor/vendor-material.js").then(t=>t.f),__vite__mapDeps([0,1]),import.meta.url);break;case"outlined":await p(()=>import("../../vendor/vendor-material.js").then(t=>t.o),__vite__mapDeps([0,1]),import.meta.url);break;case"filled-tonal":await p(()=>import("../../vendor/vendor-material.js").then(t=>t.c),__vite__mapDeps([0,1]),import.meta.url);break;default:await p(()=>import("../../vendor/vendor-material.js").then(t=>t.d),__vite__mapDeps([0,1]),import.meta.url);break}this.__loadedVariants.add(this.variant)}this.__iconLoaded||(await p(()=>import("../../vendor/vendor-material.js").then(t=>t.i),__vite__mapDeps([0,1]),import.meta.url),this.__iconLoaded=!0)}__getMdHost(){return this.renderRoot.querySelector("md-filled-icon-button, md-outlined-icon-button, md-filled-tonal-icon-button, md-icon-button")}__attachChangeListener(){const t=this.__getMdHost();t&&t!==this.__lastMdHost&&(this.__lastMdHost?.removeEventListener?.("change",this.__onInnerChange),t.addEventListener("change",this.__onInnerChange),this.__lastMdHost=t),this.toggle&&t&&"selected"in t&&(t.selected=this.selected)}__syncTitleAndAria(){const t=this.__getMdHost();if(!t)return;const e=(this.tooltip||this.getAttribute("title")||"").trim(),o=(this.ariaLabel||this.getAttribute("aria-label")||"").trim(),d=this.getAttribute("aria-controls"),a=this.getAttribute("aria-expanded");this.tooltip&&this.setAttribute("title",e);const c=o||e||this.icon.trim()||void 0;c?t.setAttribute("aria-label",c):t.removeAttribute("aria-label"),e?t.setAttribute("title",e):t.removeAttribute("title"),d!==null?t.setAttribute("aria-controls",d):t.removeAttribute("aria-controls"),a!==null?t.setAttribute("aria-expanded",a):t.removeAttribute("aria-expanded")}mapSpacingToken(t){if(!t)return;const e=String(t).trim();if(e)return/^\d+$/.test(e)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(e,10)))})`:e}__renderToggleIcons(){return l`
|
|
3
|
+
<md-icon ?filled=${this.iconFilled||this.filled} aria-hidden="true">${this.toggleofficon}</md-icon>
|
|
4
|
+
<md-icon ?filled=${this.iconFilled||this.filled} slot="selected" aria-hidden="true">${this.toggleonicon}</md-icon>
|
|
5
|
+
`}__renderSingleIcon(){return l`<md-icon ?filled=${this.iconFilled||this.filled} aria-hidden="true">${this.icon}</md-icon>`}__renderMd(){const t=this.toggle?this.__renderToggleIcons():this.__renderSingleIcon();if(this.toggle)switch(this.variant){case"filled":return l`
|
|
6
6
|
<md-filled-icon-button
|
|
7
7
|
toggle
|
|
8
8
|
?selected=${this.selected}
|
|
@@ -55,10 +55,28 @@ import{_ as p}from"../../vendor/preload-helper.js";import{a as f,n,i as m,x as l
|
|
|
55
55
|
<md-icon-button ?disabled=${this.disabled} href=${this.href||i} target=${this.target||i} rel=${this.rel||i}>
|
|
56
56
|
${t}
|
|
57
57
|
</md-icon-button>
|
|
58
|
-
`}}render(){return this.__renderMd()}};
|
|
58
|
+
`}}render(){return this.__renderMd()}};u=new WeakSet;f=function(){const t=this.mapSpacingToken(this.spacing),e=this.mapSpacingToken(this.spacingTop)??t,o=this.mapSpacingToken(this.spacingBottom)??t;e?this.style.setProperty("--scb-icon-button-spacing-block-start",e):this.style.removeProperty("--scb-icon-button-spacing-block-start"),o?this.style.setProperty("--scb-icon-button-spacing-block-end",o):this.style.removeProperty("--scb-icon-button-spacing-block-end")};s.styles=b`
|
|
59
59
|
:host {
|
|
60
60
|
display: inline-flex;
|
|
61
61
|
margin-block-start: var(--scb-icon-button-spacing-block-start, 0);
|
|
62
62
|
margin-block-end: var(--scb-icon-button-spacing-block-end, 0);
|
|
63
|
+
--scb-icon-button-font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
|
|
63
64
|
}
|
|
64
|
-
|
|
65
|
+
|
|
66
|
+
:host([filled]),
|
|
67
|
+
:host([icon-filled]) {
|
|
68
|
+
--scb-icon-button-font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
md-icon {
|
|
72
|
+
--md-icon-font-variation-settings: var(--scb-icon-button-font-variation-settings) !important;
|
|
73
|
+
font-variation-settings: var(--scb-icon-button-font-variation-settings) !important;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
md-icon-button,
|
|
77
|
+
md-filled-icon-button,
|
|
78
|
+
md-outlined-icon-button,
|
|
79
|
+
md-filled-tonal-icon-button {
|
|
80
|
+
--md-icon-font-variation-settings: var(--scb-icon-button-font-variation-settings);
|
|
81
|
+
}
|
|
82
|
+
`;n([r({type:String})],s.prototype,"icon",2);n([r({type:Boolean,reflect:!0})],s.prototype,"filled",2);n([r({type:Boolean,attribute:"icon-filled",reflect:!0})],s.prototype,"iconFilled",2);n([r({type:String})],s.prototype,"tooltip",2);n([r({type:String,attribute:"aria-label"})],s.prototype,"ariaLabel",2);n([r({type:String})],s.prototype,"variant",2);n([r({type:Boolean,reflect:!0})],s.prototype,"toggle",2);n([r({type:Boolean,reflect:!0})],s.prototype,"selected",2);n([r({type:String})],s.prototype,"toggleofficon",2);n([r({type:String})],s.prototype,"toggleonicon",2);n([r({type:Boolean,reflect:!0})],s.prototype,"disabled",2);n([r({type:String,reflect:!0})],s.prototype,"spacing",2);n([r({type:String,attribute:"spacing-top",reflect:!0})],s.prototype,"spacingTop",2);n([r({type:String,attribute:"spacing-bottom",reflect:!0})],s.prototype,"spacingBottom",2);n([r({type:String})],s.prototype,"href",2);n([r({type:String})],s.prototype,"target",2);n([r({type:String})],s.prototype,"rel",2);s=n([v("scb-icon-button")],s);export{s as ScbIconButton};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "scb-wc-test",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.152",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "index.js",
|
|
@@ -369,5 +369,5 @@
|
|
|
369
369
|
},
|
|
370
370
|
"./mvc/*": "./mvc/*"
|
|
371
371
|
},
|
|
372
|
-
"buildHash": "
|
|
372
|
+
"buildHash": "C2B57F73FC9F0786FA89F169F3636F721C1D490351087B3DED56F4D6FA2BB053"
|
|
373
373
|
}
|