scb-wc-test 0.1.346 → 0.1.348
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-list/scb-list-item.js +17 -14
- package/mvc/components/scb-notification-card/scb-notification-card.js +15 -9
- package/package.json +2 -2
- package/scb-list/scb-list-item.d.ts +2 -0
- package/scb-list/scb-list-item.js +61 -37
- package/scb-notification-card/scb-notification-card.js +14 -8
- package/scb-wc-test.bundle.js +614 -605
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../../vendor/vendor-material.js","../../vendor/vendor.js","../scb-checkbox/scb-checkbox.js","../scb-checkbox/scb-checkbox-group.js","../scb-switch/scb-switch.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{_ as
|
|
2
|
+
import{_ as w}from"../../vendor/preload-helper.js";import{n as s,t as L,i as T,a as C,E as o,x as n}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 i=customElements.define.bind(customElements);customElements.define=function(e,d,c){try{customElements.get(e)||i(e,d,c)}catch(h){var l=String(h||"");if(l.indexOf("already been used")===-1&&l.indexOf("NotSupportedError")===-1)throw h}}}}catch{}})();var D=Object.defineProperty,P=Object.getOwnPropertyDescriptor,E=t=>{throw TypeError(t)},r=(t,i,e,d)=>{for(var c=d>1?void 0:d?P(i,e):i,l=t.length-1,h;l>=0;l--)(h=t[l])&&(c=(d?h(i,e,c):h(c))||c);return d&&c&&D(i,e,c),c},V=(t,i,e)=>i.has(t)||E("Cannot "+e),u=(t,i,e)=>(V(t,i,"read from private field"),e?e.call(t):i.get(t)),g=(t,i,e)=>i.has(t)?E("Cannot add the same private member more than once"):i instanceof WeakSet?i.add(t):i.set(t,e),_=(t,i,e,d)=>(V(t,i,"write to private field"),i.set(t,e),e),f=(t,i,e)=>(V(t,i,"access private method"),e),y,b,m,v,x,k,S,$;let a=class extends T{constructor(){super(...arguments),g(this,v),this.type="text",this.href="",this.itemHref="",this.target="",this.disabled=!1,this.label="",this.supportingText="",this.overline="",this.leading=!1,this.leadingVariant="",this.leadingIcon="",this.avatarLabel="",this.avatarAlt="",this.avatarVariant="icon",this.avatarSrc="",this.imgHrefImage="",this.trailing=!1,this.trailingVariant="",this.trailingIcon="",this.trailingSwitchLabel="",this.trailingSwitchSelected=!1,this.density=0,this.noDivider=!1,g(this,y,!1),g(this,b,!1),g(this,m,!1),this.onRowClick=()=>{if(this.type==="link"&&(this.href||this.itemHref))return;const t=this.shadowRoot?.querySelector("scb-checkbox"),i=this.shadowRoot?.querySelector("scb-switch");if(t&&(t.checked=!t.checked),i){const e=!this.trailingSwitchSelected;i.selected=e,f(this,v,k).call(this,e,!0)}},g(this,S,t=>{const i=t.detail?.selected,e=typeof i=="boolean"?i:t.currentTarget?.selected??!1;f(this,v,k).call(this,e,!0)}),g(this,$,t=>{if(!t.defaultPrevented&&(t.key==="Enter"||t.key===" ")){if(this.type==="link"){const i=this.shadowRoot?.querySelector("a[href]");if(i){t.preventDefault(),i.click();return}}t.preventDefault(),this.onRowClick()}})}static get styles(){return C`
|
|
3
3
|
:host {
|
|
4
4
|
border-bottom: var(--stroke-border, 1px) solid var(--md-sys-color-outline-variant);
|
|
5
5
|
margin-bottom: calc(var(--stroke-border, 1px) * -1);
|
|
@@ -106,7 +106,7 @@ import{_ as b}from"../../vendor/preload-helper.js";import{n as s,t as I,i as E,a
|
|
|
106
106
|
width: 100%;
|
|
107
107
|
gap: 12px;
|
|
108
108
|
}
|
|
109
|
-
`}async firstUpdated(){await
|
|
109
|
+
`}async firstUpdated(){await f(this,v,x).call(this),this.addEventListener("keydown",u(this,$))}updated(t){super.updated(t),(t.has("leading")||t.has("leadingVariant")||t.has("trailing")||t.has("trailingVariant")||t.has("type")||t.has("target"))&&f(this,v,x).call(this)}render(){const t=this.leading?(()=>{switch(this.leadingVariant){case"icon":return this.leadingIcon?n`<div class="leading"><md-icon>${this.leadingIcon}</md-icon></div>`:o;case"avatar":return n`
|
|
110
110
|
<div class="leading">
|
|
111
111
|
<scb-avatar
|
|
112
112
|
label=${this.avatarLabel}
|
|
@@ -117,31 +117,34 @@ import{_ as b}from"../../vendor/preload-helper.js";import{n as s,t as I,i as E,a
|
|
|
117
117
|
variant=${this.avatarVariant}
|
|
118
118
|
></scb-avatar>
|
|
119
119
|
</div>
|
|
120
|
-
`;case"image":return this.imgHrefImage?n`<div class="leading"><img class="img" part="leading-image" src="${this.imgHrefImage}" alt="" /></div>`:
|
|
120
|
+
`;case"image":return this.imgHrefImage?n`<div class="leading"><img class="img" part="leading-image" src="${this.imgHrefImage}" alt="" /></div>`:o;default:return o}})():o,i=this.href||this.itemHref||"",e=this.target==="_blank"?"open_in_new":"chevron_right",d=this.label?`Välj ${this.label}`:"Välj",c=this.label?`Växla ${this.label}`:"Växla";let l=o;if(this.trailing)if(this.trailingVariant==="icon"){const p=this.trailingIcon||(this.type==="link"?e:"");l=p?n`<div class="trailing"><md-icon>${p}</md-icon></div>`:o}else this.trailingVariant==="checkbox"?l=n`
|
|
121
121
|
<div class="trailing">
|
|
122
122
|
<scb-checkbox
|
|
123
123
|
aria-label=${d}
|
|
124
|
-
@click=${
|
|
124
|
+
@click=${p=>p.stopPropagation()}
|
|
125
125
|
></scb-checkbox>
|
|
126
|
-
</div>`:this.trailingVariant==="switch"&&(
|
|
126
|
+
</div>`:this.trailingVariant==="switch"&&(l=n`
|
|
127
127
|
<div class="trailing">
|
|
128
128
|
<scb-switch
|
|
129
|
-
|
|
130
|
-
|
|
129
|
+
.selected=${this.trailingSwitchSelected}
|
|
130
|
+
label=${this.trailingSwitchLabel||o}
|
|
131
|
+
aria-label=${c}
|
|
132
|
+
@click=${p=>p.stopPropagation()}
|
|
133
|
+
@change=${u(this,S)}
|
|
131
134
|
></scb-switch>
|
|
132
|
-
</div>`);else this.type==="link"&&(
|
|
135
|
+
</div>`);else this.type==="link"&&(l=n`<div class="trailing"><md-icon>${e}</md-icon></div>`);const h=this.type==="link"&&this.target==="_blank"?"noopener noreferrer":o,I=n`
|
|
133
136
|
${t}
|
|
134
137
|
<div class="texts">
|
|
135
|
-
${this.overline?n`<div class="overline">${this.overline}</div>`:
|
|
138
|
+
${this.overline?n`<div class="overline">${this.overline}</div>`:o}
|
|
136
139
|
<div class="label">${this.label}</div>
|
|
137
|
-
${this.supportingText?n`<div class="supporting-text">${this.supportingText}</div>`:
|
|
140
|
+
${this.supportingText?n`<div class="supporting-text">${this.supportingText}</div>`:o}
|
|
138
141
|
</div>
|
|
139
|
-
${
|
|
142
|
+
${l}
|
|
140
143
|
`;return n`
|
|
141
144
|
<div class="row" @click=${this.onRowClick} ?inert=${this.disabled} aria-disabled=${this.disabled?"true":"false"}>
|
|
142
|
-
${this.type==="link"&&i?n`<a class="link" href=${i} target=${this.target||
|
|
143
|
-
${this.type==="link"?n`<md-ripple></md-ripple>`:
|
|
145
|
+
${this.type==="link"&&i?n`<a class="link" href=${i} target=${this.target||o} rel=${h}>${I}</a>`:I}
|
|
146
|
+
${this.type==="link"?n`<md-ripple></md-ripple>`:o}
|
|
144
147
|
</div>
|
|
145
148
|
|
|
146
149
|
<md-focus-ring></md-focus-ring>
|
|
147
|
-
`}};
|
|
150
|
+
`}};y=new WeakMap;b=new WeakMap;m=new WeakMap;v=new WeakSet;x=async function(){const t=this.type==="link"&&(!this.trailing||this.trailingVariant==="icon");(this.leading&&this.leadingVariant==="icon"||this.trailing&&this.trailingVariant==="icon"||t)&&!u(this,y)&&(await w(()=>import("../../vendor/vendor-material.js").then(e=>e.i),__vite__mapDeps([0,1]),import.meta.url),_(this,y,!0)),this.trailing&&this.trailingVariant==="checkbox"&&!u(this,b)&&(await w(()=>import("../scb-checkbox/scb-checkbox.js"),__vite__mapDeps([2,1,0,3]),import.meta.url),_(this,b,!0)),this.trailing&&this.trailingVariant==="switch"&&!u(this,m)&&(await w(()=>import("../scb-switch/scb-switch.js"),__vite__mapDeps([4,1,0]),import.meta.url),_(this,m,!0))};k=function(t,i){this.trailingSwitchSelected=t,i&&this.dispatchEvent(new CustomEvent("trailing-switch-change",{detail:{selected:t},bubbles:!0,composed:!0}))};S=new WeakMap;$=new WeakMap;r([s({type:String,reflect:!0,attribute:"type"})],a.prototype,"type",2);r([s({type:String})],a.prototype,"href",2);r([s({type:String,attribute:"item-href"})],a.prototype,"itemHref",2);r([s({type:String,attribute:"target"})],a.prototype,"target",2);r([s({type:Boolean,attribute:"disabled"})],a.prototype,"disabled",2);r([s({type:String,reflect:!0})],a.prototype,"label",2);r([s({type:String,attribute:"supporting-text"})],a.prototype,"supportingText",2);r([s({type:String,attribute:"overline"})],a.prototype,"overline",2);r([s({type:Boolean})],a.prototype,"leading",2);r([s({type:String,attribute:"leading-variant",reflect:!0})],a.prototype,"leadingVariant",2);r([s({type:String,attribute:"leading-icon"})],a.prototype,"leadingIcon",2);r([s({type:String,attribute:"avatar-label"})],a.prototype,"avatarLabel",2);r([s({type:String,attribute:"avatar-alt"})],a.prototype,"avatarAlt",2);r([s({type:String,attribute:"avatar-variant"})],a.prototype,"avatarVariant",2);r([s({type:String,attribute:"avatar-src"})],a.prototype,"avatarSrc",2);r([s({type:String,reflect:!0,attribute:"img-href-image"})],a.prototype,"imgHrefImage",2);r([s({type:Boolean})],a.prototype,"trailing",2);r([s({type:String,attribute:"trailing-variant",reflect:!0})],a.prototype,"trailingVariant",2);r([s({type:String,attribute:"trailing-icon"})],a.prototype,"trailingIcon",2);r([s({type:String,attribute:"trailing-switch-label"})],a.prototype,"trailingSwitchLabel",2);r([s({type:Boolean,attribute:"trailing-switch-selected",reflect:!0})],a.prototype,"trailingSwitchSelected",2);r([s({type:Number,reflect:!0})],a.prototype,"density",2);r([s({type:Boolean,attribute:"no-divider",reflect:!0})],a.prototype,"noDivider",2);a=r([L("scb-list-item")],a);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as h,n,i as f,x as c,t as
|
|
1
|
+
import{a as h,n,i as f,x as c,t as g}from"../../vendor/vendor.js";import"../../vendor/vendor-material.js";import"../scb-icon-button/scb-icon-button.js";import"../../vendor/preload-helper.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(s,a,r){try{customElements.get(s)||o(s,a,r)}catch(p){var l=String(p||"");if(l.indexOf("already been used")===-1&&l.indexOf("NotSupportedError")===-1)throw p}}}}catch{}})();var d=Object.defineProperty,m=Object.getOwnPropertyDescriptor,e=(t,o,s,a)=>{for(var r=a>1?void 0:a?m(o,s):o,l=t.length-1,p;l>=0;l--)(p=t[l])&&(r=(a?p(o,s,r):p(r))||r);return a&&r&&d(o,s,r),r};let i=class extends f{constructor(){super(...arguments),this.variant="success",this.direction="horizontal",this.size="large",this.title="",this.subtitle="",this.supportingText="",this.open=!1,this.linkText="",this.linkHref="#",this.href="",this.showIcon=!1,this.showCloseButton=!1,this.sizing="stretch",this.width="",this.maxWidth="",this.height="",this.maxHeight="",this.fullHeight=!1,this.fullWidth=!1,this.spacing=void 0,this.spacingTop=void 0,this.spacingBottom=void 0,this.spacingLeft=void 0,this.spacingRight=void 0,this._closeNotification=()=>{this.open=!1;const t=new CustomEvent("close",{detail:{open:this.open},bubbles:!0,composed:!0});this.dispatchEvent(t);const o=new CustomEvent("Close",{detail:{open:this.open},bubbles:!0,composed:!0});this.dispatchEvent(o)}}_iconForVariant(){switch(this.variant){case"success":return"check_circle";case"error":return"error";case"warning":return"warning";case"info":default:return"info"}}__resolveSpacingToken(t){const o=(t??"").trim();return o?/^\d+$/.test(o)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(o,10)))})`:o:""}__applySpacing(){const t=this.__resolveSpacingToken(this.spacingTop||this.spacing),o=this.__resolveSpacingToken(this.spacingBottom||this.spacing),s=this.__resolveSpacingToken(this.spacingLeft||this.spacing),a=this.__resolveSpacingToken(this.spacingRight||this.spacing);t?this.style.marginBlockStart=t:this.style.removeProperty("margin-block-start"),o?this.style.marginBlockEnd=o:this.style.removeProperty("margin-block-end"),s?this.style.marginInlineStart=s:this.style.removeProperty("margin-inline-start"),a?this.style.marginInlineEnd=a:this.style.removeProperty("margin-inline-end")}updated(t){super.updated(t),t.has("width")&&(this.width&&this.width.trim()!==""?this.style.inlineSize=this.width:this.style.removeProperty("inline-size")),t.has("maxWidth")&&(this.maxWidth&&this.maxWidth.trim()!==""?this.style.maxInlineSize=this.maxWidth:this.style.removeProperty("max-inline-size")),t.has("height")&&(this.height&&this.height.trim()!==""?this.style.blockSize=this.height:this.style.removeProperty("block-size")),t.has("maxHeight")&&(this.maxHeight&&this.maxHeight.trim()!==""?this.style.maxBlockSize=this.maxHeight:this.style.removeProperty("max-block-size")),(t.has("spacing")||t.has("spacingTop")||t.has("spacingBottom")||t.has("spacingLeft")||t.has("spacingRight"))&&this.__applySpacing()}render(){const t=this.direction==="vertical"?"vertical":"horizontal",o=!!(this.title||this.subtitle),s=!!(this.supportingText&&!this.title&&!this.subtitle&&!this.linkText),a=this.variant==="success"?"--_icon-color: var(--md-sys-color-on-success-container, #007041);":this.variant==="error"?"--_icon-color: var(--md-sys-color-on-error-container, #942500);":this.variant==="warning"?"--_icon-color: var(--md-sys-color-on-warning-container, #6B5600);":"--_icon-color: var(--md-sys-color-on-info-container, #1E00BE);",r=this.linkHref&&this.linkHref!=="#"?this.linkHref:this.href||this.linkHref;return c`
|
|
2
2
|
<div class="notification" type=${this.variant} role="alert" aria-live="assertive" aria-atomic="true">
|
|
3
3
|
<div class="notification-main ${t}">
|
|
4
4
|
${this.showIcon?c`
|
|
@@ -6,15 +6,17 @@ import{a as h,n,i as f,x as c,t as d}from"../../vendor/vendor.js";import"../../v
|
|
|
6
6
|
<md-icon aria-hidden="true">${this._iconForVariant()}</md-icon>
|
|
7
7
|
</div>
|
|
8
8
|
`:null}
|
|
9
|
-
<div class="notification-text-container">
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
<div class="notification-text-container ${s?"no-gap":""}">
|
|
10
|
+
${o?c`
|
|
11
|
+
<div class="notification-title-container">
|
|
12
|
+
${this.title?c`<div class="notification-title">${this.title}</div>`:null}
|
|
13
|
+
${this.subtitle?c`<div class="notification-subtitle">${this.subtitle}</div>`:null}
|
|
14
|
+
</div>
|
|
15
|
+
`:null}
|
|
14
16
|
${this.supportingText?c`<div class="notification-text">${this.supportingText}</div>`:null}
|
|
15
17
|
${this.linkText?c`
|
|
16
18
|
<div class="notification-footer">
|
|
17
|
-
<a class="footer-link" href="${
|
|
19
|
+
<a class="footer-link" href="${r}">${this.linkText}</a>
|
|
18
20
|
</div>
|
|
19
21
|
`:null}
|
|
20
22
|
</div>
|
|
@@ -24,7 +26,7 @@ import{a as h,n,i as f,x as c,t as d}from"../../vendor/vendor.js";import"../../v
|
|
|
24
26
|
<scb-icon-button
|
|
25
27
|
aria-label="Stäng meddelande"
|
|
26
28
|
icon="close"
|
|
27
|
-
style=${
|
|
29
|
+
style=${a}
|
|
28
30
|
@click=${this._closeNotification}
|
|
29
31
|
>
|
|
30
32
|
</scb-icon-button>
|
|
@@ -262,6 +264,10 @@ import{a as h,n,i as f,x as c,t as d}from"../../vendor/vendor.js";import"../../v
|
|
|
262
264
|
min-width: 0;
|
|
263
265
|
}
|
|
264
266
|
|
|
267
|
+
.notification-text-container.no-gap {
|
|
268
|
+
gap: 0;
|
|
269
|
+
}
|
|
270
|
+
|
|
265
271
|
.notification-title-container{
|
|
266
272
|
display: flex;
|
|
267
273
|
flex-direction: column;
|
|
@@ -349,4 +355,4 @@ import{a as h,n,i as f,x as c,t as d}from"../../vendor/vendor.js";import"../../v
|
|
|
349
355
|
box-shadow: 0 0 0 2px var(--md-sys-color-primary, #1976d2);
|
|
350
356
|
}
|
|
351
357
|
}
|
|
352
|
-
`];e([n({type:String})],i.prototype,"variant",2);e([n({type:String,reflect:!0})],i.prototype,"direction",2);e([n({type:String,reflect:!0})],i.prototype,"size",2);e([n({type:String})],i.prototype,"title",2);e([n({type:String})],i.prototype,"subtitle",2);e([n({type:String,attribute:"supporting-text"})],i.prototype,"supportingText",2);e([n({type:Boolean,reflect:!0})],i.prototype,"open",2);e([n({type:String,attribute:"link-text"})],i.prototype,"linkText",2);e([n({type:String,attribute:"link-href"})],i.prototype,"linkHref",2);e([n({type:String})],i.prototype,"href",2);e([n({type:Boolean,attribute:"show-icon"})],i.prototype,"showIcon",2);e([n({type:Boolean,attribute:"show-close-button"})],i.prototype,"showCloseButton",2);e([n({type:String,reflect:!0})],i.prototype,"sizing",2);e([n({type:String,reflect:!0})],i.prototype,"width",2);e([n({type:String,reflect:!0,attribute:"max-width"})],i.prototype,"maxWidth",2);e([n({type:String,reflect:!0})],i.prototype,"height",2);e([n({type:String,reflect:!0,attribute:"max-height"})],i.prototype,"maxHeight",2);e([n({type:Boolean,reflect:!0,attribute:"full-height"})],i.prototype,"fullHeight",2);e([n({type:Boolean,reflect:!0,attribute:"full-width"})],i.prototype,"fullWidth",2);e([n({type:String})],i.prototype,"spacing",2);e([n({type:String,attribute:"spacing-top"})],i.prototype,"spacingTop",2);e([n({type:String,attribute:"spacing-bottom"})],i.prototype,"spacingBottom",2);e([n({type:String,attribute:"spacing-left"})],i.prototype,"spacingLeft",2);e([n({type:String,attribute:"spacing-right"})],i.prototype,"spacingRight",2);i=e([
|
|
358
|
+
`];e([n({type:String})],i.prototype,"variant",2);e([n({type:String,reflect:!0})],i.prototype,"direction",2);e([n({type:String,reflect:!0})],i.prototype,"size",2);e([n({type:String})],i.prototype,"title",2);e([n({type:String})],i.prototype,"subtitle",2);e([n({type:String,attribute:"supporting-text"})],i.prototype,"supportingText",2);e([n({type:Boolean,reflect:!0})],i.prototype,"open",2);e([n({type:String,attribute:"link-text"})],i.prototype,"linkText",2);e([n({type:String,attribute:"link-href"})],i.prototype,"linkHref",2);e([n({type:String})],i.prototype,"href",2);e([n({type:Boolean,attribute:"show-icon"})],i.prototype,"showIcon",2);e([n({type:Boolean,attribute:"show-close-button"})],i.prototype,"showCloseButton",2);e([n({type:String,reflect:!0})],i.prototype,"sizing",2);e([n({type:String,reflect:!0})],i.prototype,"width",2);e([n({type:String,reflect:!0,attribute:"max-width"})],i.prototype,"maxWidth",2);e([n({type:String,reflect:!0})],i.prototype,"height",2);e([n({type:String,reflect:!0,attribute:"max-height"})],i.prototype,"maxHeight",2);e([n({type:Boolean,reflect:!0,attribute:"full-height"})],i.prototype,"fullHeight",2);e([n({type:Boolean,reflect:!0,attribute:"full-width"})],i.prototype,"fullWidth",2);e([n({type:String})],i.prototype,"spacing",2);e([n({type:String,attribute:"spacing-top"})],i.prototype,"spacingTop",2);e([n({type:String,attribute:"spacing-bottom"})],i.prototype,"spacingBottom",2);e([n({type:String,attribute:"spacing-left"})],i.prototype,"spacingLeft",2);e([n({type:String,attribute:"spacing-right"})],i.prototype,"spacingRight",2);i=e([g("scb-notification-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.348",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "index.js",
|
|
@@ -414,5 +414,5 @@
|
|
|
414
414
|
},
|
|
415
415
|
"./mvc/*": "./mvc/*"
|
|
416
416
|
},
|
|
417
|
-
"buildHash": "
|
|
417
|
+
"buildHash": "9BE3B4226A6360E1BC78F046D8638AD8FF050366077245DE8DEFE58B1E2D9D0F"
|
|
418
418
|
}
|
|
@@ -20,6 +20,8 @@ export declare class ScbListItem extends LitElement {
|
|
|
20
20
|
trailing: boolean;
|
|
21
21
|
trailingVariant: '' | 'icon' | 'checkbox' | 'switch';
|
|
22
22
|
trailingIcon: string;
|
|
23
|
+
trailingSwitchLabel: string;
|
|
24
|
+
trailingSwitchSelected: boolean;
|
|
23
25
|
density: -4 | -2 | 0;
|
|
24
26
|
noDivider: boolean;
|
|
25
27
|
static get styles(): import('lit').CSSResult;
|
|
@@ -1,22 +1,29 @@
|
|
|
1
|
-
import { LitElement as
|
|
2
|
-
import { property as s, customElement as
|
|
1
|
+
import { LitElement as L, css as C, nothing as c, html as o } from "lit";
|
|
2
|
+
import { property as s, customElement as z } from "lit/decorators.js";
|
|
3
3
|
import "@material/web/focus/md-focus-ring.js";
|
|
4
4
|
import "@material/web/ripple/ripple.js";
|
|
5
|
-
var
|
|
5
|
+
var T = Object.defineProperty, H = Object.getOwnPropertyDescriptor, I = (t) => {
|
|
6
6
|
throw TypeError(t);
|
|
7
7
|
}, r = (t, i, e, l) => {
|
|
8
|
-
for (var
|
|
9
|
-
(
|
|
10
|
-
return l &&
|
|
11
|
-
},
|
|
12
|
-
let a = class extends
|
|
8
|
+
for (var n = l > 1 ? void 0 : l ? H(i, e) : i, p = t.length - 1, v; p >= 0; p--)
|
|
9
|
+
(v = t[p]) && (n = (l ? v(i, e, n) : v(n)) || n);
|
|
10
|
+
return l && n && T(i, e, n), n;
|
|
11
|
+
}, _ = (t, i, e) => i.has(t) || I("Cannot " + e), y = (t, i, e) => (_(t, i, "read from private field"), e ? e.call(t) : i.get(t)), h = (t, i, e) => i.has(t) ? I("Cannot add the same private member more than once") : i instanceof WeakSet ? i.add(t) : i.set(t, e), w = (t, i, e, l) => (_(t, i, "write to private field"), i.set(t, e), e), f = (t, i, e) => (_(t, i, "access private method"), e), u, b, m, g, k, x, S, $;
|
|
12
|
+
let a = class extends L {
|
|
13
13
|
constructor() {
|
|
14
|
-
super(...arguments),
|
|
14
|
+
super(...arguments), h(this, g), this.type = "text", this.href = "", this.itemHref = "", this.target = "", this.disabled = !1, this.label = "", this.supportingText = "", this.overline = "", this.leading = !1, this.leadingVariant = "", this.leadingIcon = "", this.avatarLabel = "", this.avatarAlt = "", this.avatarVariant = "icon", this.avatarSrc = "", this.imgHrefImage = "", this.trailing = !1, this.trailingVariant = "", this.trailingIcon = "", this.trailingSwitchLabel = "", this.trailingSwitchSelected = !1, this.density = 0, this.noDivider = !1, h(this, u, !1), h(this, b, !1), h(this, m, !1), this.onRowClick = () => {
|
|
15
15
|
var e, l;
|
|
16
16
|
if (this.type === "link" && (this.href || this.itemHref)) return;
|
|
17
17
|
const t = (e = this.shadowRoot) == null ? void 0 : e.querySelector("scb-checkbox"), i = (l = this.shadowRoot) == null ? void 0 : l.querySelector("scb-switch");
|
|
18
|
-
t && (t.checked = !t.checked), i
|
|
19
|
-
|
|
18
|
+
if (t && (t.checked = !t.checked), i) {
|
|
19
|
+
const n = !this.trailingSwitchSelected;
|
|
20
|
+
i.selected = n, f(this, g, x).call(this, n, !0);
|
|
21
|
+
}
|
|
22
|
+
}, h(this, S, (t) => {
|
|
23
|
+
var l, n;
|
|
24
|
+
const i = (l = t.detail) == null ? void 0 : l.selected, e = typeof i == "boolean" ? i : ((n = t.currentTarget) == null ? void 0 : n.selected) ?? !1;
|
|
25
|
+
f(this, g, x).call(this, e, !0);
|
|
26
|
+
}), h(this, $, (t) => {
|
|
20
27
|
var i;
|
|
21
28
|
if (!t.defaultPrevented && (t.key === "Enter" || t.key === " ")) {
|
|
22
29
|
if (this.type === "link") {
|
|
@@ -31,7 +38,7 @@ let a = class extends V {
|
|
|
31
38
|
});
|
|
32
39
|
}
|
|
33
40
|
static get styles() {
|
|
34
|
-
return
|
|
41
|
+
return C`
|
|
35
42
|
:host {
|
|
36
43
|
border-bottom: var(--stroke-border, 1px) solid var(--md-sys-color-outline-variant);
|
|
37
44
|
margin-bottom: calc(var(--stroke-border, 1px) * -1);
|
|
@@ -141,18 +148,18 @@ let a = class extends V {
|
|
|
141
148
|
`;
|
|
142
149
|
}
|
|
143
150
|
async firstUpdated() {
|
|
144
|
-
await
|
|
151
|
+
await f(this, g, k).call(this), this.addEventListener("keydown", y(this, $));
|
|
145
152
|
}
|
|
146
153
|
updated(t) {
|
|
147
|
-
super.updated(t), (t.has("leading") || t.has("leadingVariant") || t.has("trailing") || t.has("trailingVariant") || t.has("type") || t.has("target")) &&
|
|
154
|
+
super.updated(t), (t.has("leading") || t.has("leadingVariant") || t.has("trailing") || t.has("trailingVariant") || t.has("type") || t.has("target")) && f(this, g, k).call(this);
|
|
148
155
|
}
|
|
149
156
|
render() {
|
|
150
157
|
const t = this.leading ? (() => {
|
|
151
158
|
switch (this.leadingVariant) {
|
|
152
159
|
case "icon":
|
|
153
|
-
return this.leadingIcon ?
|
|
160
|
+
return this.leadingIcon ? o`<div class="leading"><md-icon>${this.leadingIcon}</md-icon></div>` : c;
|
|
154
161
|
case "avatar":
|
|
155
|
-
return
|
|
162
|
+
return o`
|
|
156
163
|
<div class="leading">
|
|
157
164
|
<scb-avatar
|
|
158
165
|
label=${this.avatarLabel}
|
|
@@ -165,58 +172,69 @@ let a = class extends V {
|
|
|
165
172
|
</div>
|
|
166
173
|
`;
|
|
167
174
|
case "image":
|
|
168
|
-
return this.imgHrefImage ?
|
|
175
|
+
return this.imgHrefImage ? o`<div class="leading"><img class="img" part="leading-image" src="${this.imgHrefImage}" alt="" /></div>` : c;
|
|
169
176
|
default:
|
|
170
|
-
return
|
|
177
|
+
return c;
|
|
171
178
|
}
|
|
172
|
-
})() :
|
|
173
|
-
let p =
|
|
179
|
+
})() : c, i = this.href || this.itemHref || "", e = this.target === "_blank" ? "open_in_new" : "chevron_right", l = this.label ? `Välj ${this.label}` : "Välj", n = this.label ? `Växla ${this.label}` : "Växla";
|
|
180
|
+
let p = c;
|
|
174
181
|
if (this.trailing)
|
|
175
182
|
if (this.trailingVariant === "icon") {
|
|
176
183
|
const d = this.trailingIcon || (this.type === "link" ? e : "");
|
|
177
|
-
p = d ?
|
|
178
|
-
} else this.trailingVariant === "checkbox" ? p =
|
|
184
|
+
p = d ? o`<div class="trailing"><md-icon>${d}</md-icon></div>` : c;
|
|
185
|
+
} else this.trailingVariant === "checkbox" ? p = o`
|
|
179
186
|
<div class="trailing">
|
|
180
187
|
<scb-checkbox
|
|
181
188
|
aria-label=${l}
|
|
182
189
|
@click=${(d) => d.stopPropagation()}
|
|
183
190
|
></scb-checkbox>
|
|
184
|
-
</div>` : this.trailingVariant === "switch" && (p =
|
|
191
|
+
</div>` : this.trailingVariant === "switch" && (p = o`
|
|
185
192
|
<div class="trailing">
|
|
186
193
|
<scb-switch
|
|
187
|
-
|
|
194
|
+
.selected=${this.trailingSwitchSelected}
|
|
195
|
+
label=${this.trailingSwitchLabel || c}
|
|
196
|
+
aria-label=${n}
|
|
188
197
|
@click=${(d) => d.stopPropagation()}
|
|
198
|
+
@change=${y(this, S)}
|
|
189
199
|
></scb-switch>
|
|
190
200
|
</div>`);
|
|
191
|
-
else this.type === "link" && (p =
|
|
192
|
-
const
|
|
201
|
+
else this.type === "link" && (p = o`<div class="trailing"><md-icon>${e}</md-icon></div>`);
|
|
202
|
+
const v = this.type === "link" && this.target === "_blank" ? "noopener noreferrer" : c, V = o`
|
|
193
203
|
${t}
|
|
194
204
|
<div class="texts">
|
|
195
|
-
${this.overline ?
|
|
205
|
+
${this.overline ? o`<div class="overline">${this.overline}</div>` : c}
|
|
196
206
|
<div class="label">${this.label}</div>
|
|
197
|
-
${this.supportingText ?
|
|
207
|
+
${this.supportingText ? o`<div class="supporting-text">${this.supportingText}</div>` : c}
|
|
198
208
|
</div>
|
|
199
209
|
${p}
|
|
200
210
|
`;
|
|
201
|
-
return
|
|
211
|
+
return o`
|
|
202
212
|
<div class="row" @click=${this.onRowClick} ?inert=${this.disabled} aria-disabled=${this.disabled ? "true" : "false"}>
|
|
203
|
-
${this.type === "link" && i ?
|
|
204
|
-
${this.type === "link" ?
|
|
213
|
+
${this.type === "link" && i ? o`<a class="link" href=${i} target=${this.target || c} rel=${v}>${V}</a>` : V}
|
|
214
|
+
${this.type === "link" ? o`<md-ripple></md-ripple>` : c}
|
|
205
215
|
</div>
|
|
206
216
|
|
|
207
217
|
<md-focus-ring></md-focus-ring>
|
|
208
218
|
`;
|
|
209
219
|
}
|
|
210
220
|
};
|
|
211
|
-
f = /* @__PURE__ */ new WeakMap();
|
|
212
221
|
u = /* @__PURE__ */ new WeakMap();
|
|
222
|
+
b = /* @__PURE__ */ new WeakMap();
|
|
213
223
|
m = /* @__PURE__ */ new WeakMap();
|
|
214
|
-
|
|
215
|
-
|
|
224
|
+
g = /* @__PURE__ */ new WeakSet();
|
|
225
|
+
k = async function() {
|
|
216
226
|
const t = this.type === "link" && (!this.trailing || this.trailingVariant === "icon");
|
|
217
|
-
(this.leading && this.leadingVariant === "icon" || this.trailing && this.trailingVariant === "icon" || t) && !
|
|
227
|
+
(this.leading && this.leadingVariant === "icon" || this.trailing && this.trailingVariant === "icon" || t) && !y(this, u) && (await import("@material/web/icon/icon.js"), w(this, u, !0)), this.trailing && this.trailingVariant === "checkbox" && !y(this, b) && (await import("../scb-checkbox/scb-checkbox.js"), w(this, b, !0)), this.trailing && this.trailingVariant === "switch" && !y(this, m) && (await import("../scb-switch/scb-switch.js"), w(this, m, !0));
|
|
228
|
+
};
|
|
229
|
+
x = function(t, i) {
|
|
230
|
+
this.trailingSwitchSelected = t, i && this.dispatchEvent(new CustomEvent("trailing-switch-change", {
|
|
231
|
+
detail: { selected: t },
|
|
232
|
+
bubbles: !0,
|
|
233
|
+
composed: !0
|
|
234
|
+
}));
|
|
218
235
|
};
|
|
219
|
-
|
|
236
|
+
S = /* @__PURE__ */ new WeakMap();
|
|
237
|
+
$ = /* @__PURE__ */ new WeakMap();
|
|
220
238
|
r([
|
|
221
239
|
s({ type: String, reflect: !0, attribute: "type" })
|
|
222
240
|
], a.prototype, "type", 2);
|
|
@@ -274,6 +292,12 @@ r([
|
|
|
274
292
|
r([
|
|
275
293
|
s({ type: String, attribute: "trailing-icon" })
|
|
276
294
|
], a.prototype, "trailingIcon", 2);
|
|
295
|
+
r([
|
|
296
|
+
s({ type: String, attribute: "trailing-switch-label" })
|
|
297
|
+
], a.prototype, "trailingSwitchLabel", 2);
|
|
298
|
+
r([
|
|
299
|
+
s({ type: Boolean, attribute: "trailing-switch-selected", reflect: !0 })
|
|
300
|
+
], a.prototype, "trailingSwitchSelected", 2);
|
|
277
301
|
r([
|
|
278
302
|
s({ type: Number, reflect: !0 })
|
|
279
303
|
], a.prototype, "density", 2);
|
|
@@ -281,7 +305,7 @@ r([
|
|
|
281
305
|
s({ type: Boolean, attribute: "no-divider", reflect: !0 })
|
|
282
306
|
], a.prototype, "noDivider", 2);
|
|
283
307
|
a = r([
|
|
284
|
-
|
|
308
|
+
z("scb-list-item")
|
|
285
309
|
], a);
|
|
286
310
|
export {
|
|
287
311
|
a as ScbListItem
|
|
@@ -51,7 +51,7 @@ let i = class extends f {
|
|
|
51
51
|
super.updated(n), n.has("width") && (this.width && this.width.trim() !== "" ? this.style.inlineSize = this.width : this.style.removeProperty("inline-size")), n.has("maxWidth") && (this.maxWidth && this.maxWidth.trim() !== "" ? this.style.maxInlineSize = this.maxWidth : this.style.removeProperty("max-inline-size")), n.has("height") && (this.height && this.height.trim() !== "" ? this.style.blockSize = this.height : this.style.removeProperty("block-size")), n.has("maxHeight") && (this.maxHeight && this.maxHeight.trim() !== "" ? this.style.maxBlockSize = this.maxHeight : this.style.removeProperty("max-block-size")), (n.has("spacing") || n.has("spacingTop") || n.has("spacingBottom") || n.has("spacingLeft") || n.has("spacingRight")) && this.__applySpacing();
|
|
52
52
|
}
|
|
53
53
|
render() {
|
|
54
|
-
const n = this.direction === "vertical" ? "vertical" : "horizontal", o = this.variant === "success" ? "--_icon-color: var(--md-sys-color-on-success-container, #007041);" : this.variant === "error" ? "--_icon-color: var(--md-sys-color-on-error-container, #942500);" : this.variant === "warning" ? "--_icon-color: var(--md-sys-color-on-warning-container, #6B5600);" : "--_icon-color: var(--md-sys-color-on-info-container, #1E00BE);",
|
|
54
|
+
const n = this.direction === "vertical" ? "vertical" : "horizontal", o = !!(this.title || this.subtitle), s = !!(this.supportingText && !this.title && !this.subtitle && !this.linkText), a = this.variant === "success" ? "--_icon-color: var(--md-sys-color-on-success-container, #007041);" : this.variant === "error" ? "--_icon-color: var(--md-sys-color-on-error-container, #942500);" : this.variant === "warning" ? "--_icon-color: var(--md-sys-color-on-warning-container, #6B5600);" : "--_icon-color: var(--md-sys-color-on-info-container, #1E00BE);", r = this.linkHref && this.linkHref !== "#" ? this.linkHref : this.href || this.linkHref;
|
|
55
55
|
return c`
|
|
56
56
|
<div class="notification" type=${this.variant} role="alert" aria-live="assertive" aria-atomic="true">
|
|
57
57
|
<div class="notification-main ${n}">
|
|
@@ -60,15 +60,17 @@ let i = class extends f {
|
|
|
60
60
|
<md-icon aria-hidden="true">${this._iconForVariant()}</md-icon>
|
|
61
61
|
</div>
|
|
62
62
|
` : null}
|
|
63
|
-
<div class="notification-text-container">
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
63
|
+
<div class="notification-text-container ${s ? "no-gap" : ""}">
|
|
64
|
+
${o ? c`
|
|
65
|
+
<div class="notification-title-container">
|
|
66
|
+
${this.title ? c`<div class="notification-title">${this.title}</div>` : null}
|
|
67
|
+
${this.subtitle ? c`<div class="notification-subtitle">${this.subtitle}</div>` : null}
|
|
68
|
+
</div>
|
|
69
|
+
` : null}
|
|
68
70
|
${this.supportingText ? c`<div class="notification-text">${this.supportingText}</div>` : null}
|
|
69
71
|
${this.linkText ? c`
|
|
70
72
|
<div class="notification-footer">
|
|
71
|
-
<a class="footer-link" href="${
|
|
73
|
+
<a class="footer-link" href="${r}">${this.linkText}</a>
|
|
72
74
|
</div>
|
|
73
75
|
` : null}
|
|
74
76
|
</div>
|
|
@@ -78,7 +80,7 @@ let i = class extends f {
|
|
|
78
80
|
<scb-icon-button
|
|
79
81
|
aria-label="Stäng meddelande"
|
|
80
82
|
icon="close"
|
|
81
|
-
style=${
|
|
83
|
+
style=${a}
|
|
82
84
|
@click=${this._closeNotification}
|
|
83
85
|
>
|
|
84
86
|
</scb-icon-button>
|
|
@@ -320,6 +322,10 @@ i.styles = [
|
|
|
320
322
|
min-width: 0;
|
|
321
323
|
}
|
|
322
324
|
|
|
325
|
+
.notification-text-container.no-gap {
|
|
326
|
+
gap: 0;
|
|
327
|
+
}
|
|
328
|
+
|
|
323
329
|
.notification-title-container{
|
|
324
330
|
display: flex;
|
|
325
331
|
flex-direction: column;
|