scb-wc-test 0.1.1
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/README.md +130 -0
- package/all.js +54 -0
- package/dummy.png +0 -0
- package/index.d.ts +54 -0
- package/index.js +108 -0
- package/mvc/components/all.js +53 -0
- package/mvc/components/scb-accordion/scb-accordion-item.js +194 -0
- package/mvc/components/scb-accordion/scb-accordion.js +5 -0
- package/mvc/components/scb-app-bar/scb-app-bar.js +144 -0
- package/mvc/components/scb-avatar/scb-avatar.js +99 -0
- package/mvc/components/scb-breadcrumb/scb-breadcrumb-item.js +17 -0
- package/mvc/components/scb-breadcrumb/scb-breadcrumb.js +52 -0
- package/mvc/components/scb-button/scb-button.js +121 -0
- package/mvc/components/scb-calendar-card/scb-calendar-card.js +140 -0
- package/mvc/components/scb-card/scb-card.js +256 -0
- package/mvc/components/scb-checkbox/scb-checkbox-group.js +33 -0
- package/mvc/components/scb-checkbox/scb-checkbox.js +99 -0
- package/mvc/components/scb-chips/scb-chip.js +46 -0
- package/mvc/components/scb-dialog/scb-dialog.js +158 -0
- package/mvc/components/scb-divider/scb-divider.js +53 -0
- package/mvc/components/scb-drawer/scb-drawer-item.js +114 -0
- package/mvc/components/scb-drawer/scb-drawer-section.js +19 -0
- package/mvc/components/scb-drawer/scb-drawer.js +79 -0
- package/mvc/components/scb-drawer/scb-sub-drawer.js +10 -0
- package/mvc/components/scb-fact-card/scb-fact-card-content.js +44 -0
- package/mvc/components/scb-fact-card/scb-fact-card.js +66 -0
- package/mvc/components/scb-footer/scb-footer-section.js +3 -0
- package/mvc/components/scb-footer/scb-footer.js +205 -0
- package/mvc/components/scb-grid/scb-grid-item.js +9 -0
- package/mvc/components/scb-grid/scb-grid.js +81 -0
- package/mvc/components/scb-grid/scb-stack.js +16 -0
- package/mvc/components/scb-header/scb-header-drawer-group.js +1 -0
- package/mvc/components/scb-header/scb-header-drawer-item.js +1 -0
- package/mvc/components/scb-header/scb-header-tab.js +1 -0
- package/mvc/components/scb-header/scb-header-utility.js +1 -0
- package/mvc/components/scb-header/scb-header.js +240 -0
- package/mvc/components/scb-icon-button/scb-icon-button.js +95 -0
- package/mvc/components/scb-keyfigure-card/scb-keyfigure-card.js +69 -0
- package/mvc/components/scb-link/scb-link.js +31 -0
- package/mvc/components/scb-list/scb-list-item.js +38 -0
- package/mvc/components/scb-list/scb-list.js +10 -0
- package/mvc/components/scb-menu/scb-menu-item.js +44 -0
- package/mvc/components/scb-menu/scb-menu.js +17 -0
- package/mvc/components/scb-menu/scb-sub-menu.js +29 -0
- package/mvc/components/scb-notification/scb-notification.js +120 -0
- package/mvc/components/scb-progress-indicator/scb-progress-indicator.js +84 -0
- package/mvc/components/scb-radio-button/scb-radio-button.js +95 -0
- package/mvc/components/scb-radio-button/scb-radio-group.js +28 -0
- package/mvc/components/scb-search/scb-search.js +211 -0
- package/mvc/components/scb-snackbar/scb-snackbar.js +83 -0
- package/mvc/components/scb-status-pill/scb-status-pill.js +31 -0
- package/mvc/components/scb-switch/scb-switch.js +54 -0
- package/mvc/components/scb-tabs/scb-primary-tab.js +7 -0
- package/mvc/components/scb-tabs/scb-secondary-tab.js +7 -0
- package/mvc/components/scb-tabs/scb-tabs.js +23 -0
- package/mvc/components/scb-textfield/scb-textfield.js +135 -0
- package/mvc/components/scb-toc/scb-toc-item.js +84 -0
- package/mvc/components/scb-toc/scb-toc.js +6 -0
- package/mvc/components/scb-tooltip/scb-tooltip.js +216 -0
- package/mvc/scb-logo.svg +21 -0
- package/mvc/scb-wc-test.css +1 -0
- package/mvc/scb.svg +14 -0
- package/mvc/vendor/preload-helper.js +1 -0
- package/mvc/vendor/vendor-lit.js +1 -0
- package/mvc/vendor/vendor-material.js +764 -0
- package/mvc/vendor/vendor.js +68 -0
- package/package.json +248 -0
- package/scb-accordion/scb-accordion-item.d.ts +37 -0
- package/scb-accordion/scb-accordion-item.js +343 -0
- package/scb-accordion/scb-accordion.d.ts +6 -0
- package/scb-accordion/scb-accordion.js +33 -0
- package/scb-app-bar/scb-app-bar.d.ts +10 -0
- package/scb-app-bar/scb-app-bar.js +192 -0
- package/scb-avatar/scb-avatar.d.ts +30 -0
- package/scb-avatar/scb-avatar.js +169 -0
- package/scb-breadcrumb/scb-breadcrumb-item.d.ts +9 -0
- package/scb-breadcrumb/scb-breadcrumb-item.js +54 -0
- package/scb-breadcrumb/scb-breadcrumb.d.ts +16 -0
- package/scb-breadcrumb/scb-breadcrumb.js +105 -0
- package/scb-button/scb-button.d.ts +26 -0
- package/scb-button/scb-button.js +247 -0
- package/scb-calendar-card/scb-calendar-card.d.ts +20 -0
- package/scb-calendar-card/scb-calendar-card.js +191 -0
- package/scb-card/scb-card.d.ts +24 -0
- package/scb-card/scb-card.js +345 -0
- package/scb-checkbox/scb-checkbox-group.d.ts +17 -0
- package/scb-checkbox/scb-checkbox-group.js +80 -0
- package/scb-checkbox/scb-checkbox.d.ts +20 -0
- package/scb-checkbox/scb-checkbox.js +157 -0
- package/scb-chips/scb-chip.d.ts +24 -0
- package/scb-chips/scb-chip.js +150 -0
- package/scb-dialog/scb-dialog.d.ts +58 -0
- package/scb-dialog/scb-dialog.js +390 -0
- package/scb-divider/scb-divider.d.ts +9 -0
- package/scb-divider/scb-divider.js +85 -0
- package/scb-drawer/scb-drawer-item.d.ts +61 -0
- package/scb-drawer/scb-drawer-item.js +220 -0
- package/scb-drawer/scb-drawer-section.d.ts +7 -0
- package/scb-drawer/scb-drawer-section.js +44 -0
- package/scb-drawer/scb-drawer.d.ts +97 -0
- package/scb-drawer/scb-drawer.js +258 -0
- package/scb-drawer/scb-sub-drawer.d.ts +10 -0
- package/scb-drawer/scb-sub-drawer.js +43 -0
- package/scb-fact-card/scb-fact-card-content.d.ts +10 -0
- package/scb-fact-card/scb-fact-card-content.js +83 -0
- package/scb-fact-card/scb-fact-card.d.ts +15 -0
- package/scb-fact-card/scb-fact-card.js +110 -0
- package/scb-footer/scb-footer-section.d.ts +21 -0
- package/scb-footer/scb-footer-section.js +28 -0
- package/scb-footer/scb-footer.d.ts +27 -0
- package/scb-footer/scb-footer.js +326 -0
- package/scb-grid/scb-grid-item.d.ts +28 -0
- package/scb-grid/scb-grid-item.js +66 -0
- package/scb-grid/scb-grid.d.ts +33 -0
- package/scb-grid/scb-grid.js +152 -0
- package/scb-grid/scb-stack.d.ts +29 -0
- package/scb-grid/scb-stack.js +82 -0
- package/scb-header/scb-header-drawer-group.d.ts +13 -0
- package/scb-header/scb-header-drawer-group.js +28 -0
- package/scb-header/scb-header-drawer-item.d.ts +14 -0
- package/scb-header/scb-header-drawer-item.js +31 -0
- package/scb-header/scb-header-tab.d.ts +13 -0
- package/scb-header/scb-header-tab.js +28 -0
- package/scb-header/scb-header-utility.d.ts +14 -0
- package/scb-header/scb-header-utility.js +31 -0
- package/scb-header/scb-header.d.ts +105 -0
- package/scb-header/scb-header.js +618 -0
- package/scb-icon-button/scb-icon-button.d.ts +31 -0
- package/scb-icon-button/scb-icon-button.js +208 -0
- package/scb-keyfigure-card/scb-keyfigure-card.d.ts +13 -0
- package/scb-keyfigure-card/scb-keyfigure-card.js +119 -0
- package/scb-link/scb-link.d.ts +17 -0
- package/scb-link/scb-link.js +74 -0
- package/scb-list/scb-list-item.d.ts +32 -0
- package/scb-list/scb-list-item.js +144 -0
- package/scb-list/scb-list.d.ts +8 -0
- package/scb-list/scb-list.js +39 -0
- package/scb-logo.svg +21 -0
- package/scb-menu/scb-menu-item.d.ts +22 -0
- package/scb-menu/scb-menu-item.js +107 -0
- package/scb-menu/scb-menu.d.ts +21 -0
- package/scb-menu/scb-menu.js +98 -0
- package/scb-menu/scb-sub-menu.d.ts +12 -0
- package/scb-menu/scb-sub-menu.js +69 -0
- package/scb-notification/scb-notification.d.ts +16 -0
- package/scb-notification/scb-notification.js +187 -0
- package/scb-progress-indicator/scb-progress-indicator.d.ts +11 -0
- package/scb-progress-indicator/scb-progress-indicator.js +122 -0
- package/scb-radio-button/scb-radio-button.d.ts +19 -0
- package/scb-radio-button/scb-radio-button.js +176 -0
- package/scb-radio-button/scb-radio-group.d.ts +20 -0
- package/scb-radio-button/scb-radio-group.js +81 -0
- package/scb-search/scb-search.d.ts +45 -0
- package/scb-search/scb-search.js +410 -0
- package/scb-snackbar/scb-snackbar.d.ts +17 -0
- package/scb-snackbar/scb-snackbar.js +140 -0
- package/scb-status-pill/scb-status-pill.d.ts +9 -0
- package/scb-status-pill/scb-status-pill.js +62 -0
- package/scb-switch/scb-switch.d.ts +21 -0
- package/scb-switch/scb-switch.js +111 -0
- package/scb-tabs/scb-primary-tab.d.ts +17 -0
- package/scb-tabs/scb-primary-tab.js +93 -0
- package/scb-tabs/scb-secondary-tab.d.ts +17 -0
- package/scb-tabs/scb-secondary-tab.js +97 -0
- package/scb-tabs/scb-tabs.d.ts +10 -0
- package/scb-tabs/scb-tabs.js +66 -0
- package/scb-textfield/scb-textfield.d.ts +41 -0
- package/scb-textfield/scb-textfield.js +258 -0
- package/scb-toc/scb-toc-item.d.ts +21 -0
- package/scb-toc/scb-toc-item.js +196 -0
- package/scb-toc/scb-toc.d.ts +6 -0
- package/scb-toc/scb-toc.js +27 -0
- package/scb-tooltip/scb-tooltip.d.ts +32 -0
- package/scb-tooltip/scb-tooltip.js +329 -0
- package/scb-wc-test.bundle.js +5429 -0
- package/scb-wc-test.css +1 -0
- package/scb-wc-test.d.ts +106 -0
- package/scb.svg +14 -0
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
import{b as p,n as e,i as h,x as i,t as v}from"../../vendor/vendor.js";import"../../vendor/vendor-material.js";import"../scb-list/scb-list.js";import"../scb-button/scb-button.js";import"../../vendor/preload-helper.js";import"../scb-list/scb-list-item.js";var m=Object.defineProperty,b=Object.getOwnPropertyDescriptor,s=(a,r,l,d)=>{for(var c=d>1?void 0:d?b(r,l):r,n=a.length-1,o;n>=0;n--)(o=a[n])&&(c=(d?o(r,l,c):o(c))||c);return d&&c&&m(r,l,c),c};let t=class extends h{constructor(){super(...arguments),this.type="",this.variant="",this.direction="",this.mediaType="",this.mediaHref="",this.cardHref="",this.label="",this.subLabel="",this.supportingText="",this.date=new Date,this.commentsText="",this.comments=0,this.likesText="",this.likes=0}render(){const a=this.variant?`${this.variant.toLowerCase()}`:"",r=this.direction?`${this.direction.toLowerCase()}`:"",l=this.cardHref?"clickable":"",d=this.mediaType?`${this.mediaType.toLowerCase()}`:"";switch(this.type){case"standard":return i`
|
|
2
|
+
<div class="scb-card ${a} ${r} ${l}">
|
|
3
|
+
${this.cardHref?i`<md-ripple></md-ripple>`:""}
|
|
4
|
+
${this.mediaHref?i`<img src="${this.mediaHref}" class="${d}" alt="" ?hidden=${!this.mediaHref} />`:""}
|
|
5
|
+
<div class="full-content">
|
|
6
|
+
<div class="top-content">
|
|
7
|
+
${this.label?i`
|
|
8
|
+
<div class="header">
|
|
9
|
+
${this.cardHref?i`<a href="${this.cardHref}" tabindex="0">${this.label}</a><md-icon>arrow_forward</md-icon>`:this.label}
|
|
10
|
+
</div>`:""}
|
|
11
|
+
${this.subLabel?i`<div class="sub-label">${this.subLabel}</div>`:""}
|
|
12
|
+
${this.supportingText?i`<div class="supporting-text">${this.supportingText}</div>`:""}
|
|
13
|
+
${this.date?i`<div class="date">${this.date}</div>`:""}
|
|
14
|
+
</div>
|
|
15
|
+
</div>
|
|
16
|
+
</div>
|
|
17
|
+
`;case"list":return i`
|
|
18
|
+
<div class="scb-card ${a} vertical ${l}">
|
|
19
|
+
${this.mediaHref?i`<img src="${this.mediaHref}" class="${d}" alt="" ?hidden=${!this.mediaHref} />`:""}
|
|
20
|
+
<div class="full-content">
|
|
21
|
+
<div class="top-content">
|
|
22
|
+
${this.label?i`
|
|
23
|
+
<div class="header">
|
|
24
|
+
${this.label}
|
|
25
|
+
</div>`:""}
|
|
26
|
+
${this.subLabel?i`<div class="sub-label">${this.subLabel}</div>`:""}
|
|
27
|
+
${this.supportingText?i`<div class="supporting-text">${this.supportingText}</div>`:""}
|
|
28
|
+
${this.date?i`<div class="date">${this.date}</div>`:""}
|
|
29
|
+
</div>
|
|
30
|
+
<div class="content list">
|
|
31
|
+
<slot></slot>
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
</div>
|
|
35
|
+
`;case"social":return i`
|
|
36
|
+
<div class="scb-card ${a} ${r} ${l}">
|
|
37
|
+
${this.cardHref?i`<md-ripple></md-ripple>`:""}
|
|
38
|
+
${this.mediaHref?i`<img src="${this.mediaHref}" class="${d}" alt="" ?hidden=${!this.mediaHref} />`:""}
|
|
39
|
+
<div class="full-content">
|
|
40
|
+
<div class="top-content">
|
|
41
|
+
${this.label?i`
|
|
42
|
+
<div class="header">
|
|
43
|
+
${this.cardHref?i`<a href="${this.cardHref}" tabindex="0">${this.label}</a><md-icon>arrow_forward</md-icon>`:this.label}
|
|
44
|
+
</div>`:""}
|
|
45
|
+
${this.subLabel?i`<div class="sub-label">${this.subLabel}</div>`:""}
|
|
46
|
+
${this.supportingText?i`<div class="supporting-text">${this.supportingText}</div>`:""}
|
|
47
|
+
${this.date?i`<div class="date">${this.date}</div>`:""}
|
|
48
|
+
</div>
|
|
49
|
+
<div class="content">
|
|
50
|
+
<div class="social-metrics">
|
|
51
|
+
<span class="comments"><md-icon>mode_comment</md-icon> <span>${this.commentsText}: ${this.comments}</span></span>
|
|
52
|
+
<span class="likes"><md-icon>thumb_up</md-icon> <span>${this.likesText}: ${this.likes}</span></span>
|
|
53
|
+
</div>
|
|
54
|
+
</div>
|
|
55
|
+
</div>
|
|
56
|
+
</div>
|
|
57
|
+
`;case"link":return i`
|
|
58
|
+
<div class="scb-card ${a} ${r} ${l}">
|
|
59
|
+
${this.mediaHref?i`<img src="${this.mediaHref}" class="${d}" alt="" ?hidden=${!this.mediaHref} />`:""}
|
|
60
|
+
<div class="full-content">
|
|
61
|
+
<div class="top-content">
|
|
62
|
+
${this.label?i`
|
|
63
|
+
<div class="header">
|
|
64
|
+
${this.label}
|
|
65
|
+
</div>`:""}
|
|
66
|
+
${this.subLabel?i`<div class="sub-label">${this.subLabel}</div>`:""}
|
|
67
|
+
${this.supportingText?i`<div class="supporting-text">${this.supportingText}</div>`:""}
|
|
68
|
+
${this.date?i`<div class="date">${this.date}</div>`:""}
|
|
69
|
+
</div>
|
|
70
|
+
<div class="content links">
|
|
71
|
+
<slot></slot>
|
|
72
|
+
</div>
|
|
73
|
+
</div>
|
|
74
|
+
</div>
|
|
75
|
+
`;case"action":return i`
|
|
76
|
+
<div class="scb-card ${a} ${r} ${l}">
|
|
77
|
+
${this.mediaHref?i`<img src="${this.mediaHref}" class="${d}" alt="" ?hidden=${!this.mediaHref} />`:""}
|
|
78
|
+
<div class="full-content">
|
|
79
|
+
<div class="top-content">
|
|
80
|
+
${this.label?i`
|
|
81
|
+
<div class="header">
|
|
82
|
+
${this.label}
|
|
83
|
+
</div>`:""}
|
|
84
|
+
${this.subLabel?i`
|
|
85
|
+
<div class="sub-label">${this.subLabel}</div>`:""}
|
|
86
|
+
${this.supportingText?i`
|
|
87
|
+
<div class="supporting-text">${this.supportingText}</div>`:""}
|
|
88
|
+
${this.date?i`
|
|
89
|
+
<div class="date">${this.date}</div>`:""}
|
|
90
|
+
</div>
|
|
91
|
+
<div class="content actions">
|
|
92
|
+
<slot></slot>
|
|
93
|
+
</div>
|
|
94
|
+
</div>
|
|
95
|
+
</div>
|
|
96
|
+
`;default:return i`
|
|
97
|
+
<div class="scb-card ${a} ${r} ${l}">
|
|
98
|
+
${this.cardHref?i`<md-ripple></md-ripple>`:""}
|
|
99
|
+
${this.mediaHref?i`<img src="${this.mediaHref}" class="${d}" alt="" ?hidden=${!this.mediaHref} />`:""}
|
|
100
|
+
<div class="full-content">
|
|
101
|
+
<div class="top-content">
|
|
102
|
+
${this.label?i`
|
|
103
|
+
<div class="header">
|
|
104
|
+
${this.cardHref?i`<a href="${this.cardHref}" tabindex="0">${this.label}</a><md-icon>arrow_forward</md-icon>`:this.label}
|
|
105
|
+
</div>`:""}
|
|
106
|
+
${this.subLabel?i`<div class="sub-label">${this.subLabel}</div>`:""}
|
|
107
|
+
${this.supportingText?i`<div class="supporting-text">${this.supportingText}</div>`:""}
|
|
108
|
+
${this.date?i`<div class="date">${this.date}</div>`:""}
|
|
109
|
+
</div>
|
|
110
|
+
</div>
|
|
111
|
+
</div>
|
|
112
|
+
`}}firstUpdated(){if(this.cardHref){const a=this.renderRoot.querySelector(".scb-card");a&&a.addEventListener("click",r=>{r.target.closest("a")||(window.location.href=this.cardHref)})}}};t.styles=p`
|
|
113
|
+
/* Min-bredder per variant (override-ningsbara via CSS custom props) */
|
|
114
|
+
:host{ --scb-card-min-w: 360px; }
|
|
115
|
+
|
|
116
|
+
:host {
|
|
117
|
+
max-width: var(--scb-card-min-w);
|
|
118
|
+
width: 100%;
|
|
119
|
+
display: block;
|
|
120
|
+
}
|
|
121
|
+
/* Grundläggande stilar för kortet */
|
|
122
|
+
.scb-card {
|
|
123
|
+
color: var(--md-sys-color-on-surface);
|
|
124
|
+
display: flex;
|
|
125
|
+
max-width: var(--scb-card-min-w);
|
|
126
|
+
position: relative;
|
|
127
|
+
background: transparent;
|
|
128
|
+
border-radius: var(--md-sys-shape-corner-large);
|
|
129
|
+
background: var(--md-sys-color-surface);
|
|
130
|
+
}
|
|
131
|
+
.social-metrics md-icon {
|
|
132
|
+
width: var(--scale-05);
|
|
133
|
+
height: var(--scale-05);
|
|
134
|
+
font-size: var(--md-sys-typescale-title-large-size);
|
|
135
|
+
vertical-align: middle;
|
|
136
|
+
}
|
|
137
|
+
.social-metrics {
|
|
138
|
+
display: flex;
|
|
139
|
+
margin-top: var(--spacing-4);
|
|
140
|
+
gap: var(--spacing-5);
|
|
141
|
+
flex-wrap: wrap;
|
|
142
|
+
}
|
|
143
|
+
.comments, .likes {
|
|
144
|
+
display: flex;
|
|
145
|
+
align-items: center;
|
|
146
|
+
gap: var(--spacing-2);
|
|
147
|
+
}
|
|
148
|
+
.scb-card.outlined {
|
|
149
|
+
border: 1px solid var(--md-sys-color-outline-variant);
|
|
150
|
+
}
|
|
151
|
+
.scb-card.filled {
|
|
152
|
+
background: var(--md-sys-color-surface-dim);
|
|
153
|
+
}
|
|
154
|
+
.scb-card.vertical {
|
|
155
|
+
flex-direction: column;
|
|
156
|
+
}
|
|
157
|
+
.scb-card.clickable {
|
|
158
|
+
cursor: pointer;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/* Textstilar */
|
|
162
|
+
.header {
|
|
163
|
+
font-size: var(--md-sys-typescale-headline-small-size);
|
|
164
|
+
font-weight: var(--weight-bold);
|
|
165
|
+
line-height: var(--md-sys-typescale-headline-small-line-height);
|
|
166
|
+
letter-spacing: var(--md-sys-typescale-headline-small-Tracking);
|
|
167
|
+
display: flex;
|
|
168
|
+
justify-content: space-between;
|
|
169
|
+
align-items: center;
|
|
170
|
+
}
|
|
171
|
+
.header a {
|
|
172
|
+
color: inherit;
|
|
173
|
+
text-decoration: none;
|
|
174
|
+
}
|
|
175
|
+
.sub-label {
|
|
176
|
+
font-size: var(--md-sys-typescale-title-medium-size);
|
|
177
|
+
font-weight: var(--weight-semibold);
|
|
178
|
+
line-height: var(--md-sys-typescale-title-medium-line-height);
|
|
179
|
+
letter-spacing: var(--md-sys-typescale-title-medium-tracking);
|
|
180
|
+
}
|
|
181
|
+
.supporting-text {
|
|
182
|
+
font-size: var(--md-sys-typescale-body-large-size);
|
|
183
|
+
line-height: var(--md-sys-typescale-body-large-line-height);
|
|
184
|
+
letter-spacing: var(--md-sys-typescale-body-large-tracking);
|
|
185
|
+
}
|
|
186
|
+
.date {
|
|
187
|
+
font-size: var(--md-sys-typescale-body-medium-size);
|
|
188
|
+
line-height: var(--md-sys-typescale-body-medium-line-height);
|
|
189
|
+
letter-spacing: var(--md-sys-typescale-body-medium-Tracking);
|
|
190
|
+
}
|
|
191
|
+
.full-content {
|
|
192
|
+
padding: var(--spacing-7) var(--spacing-6);
|
|
193
|
+
}
|
|
194
|
+
md-ripple {
|
|
195
|
+
border-radius: var(--md-sys-shape-corner-large);
|
|
196
|
+
}
|
|
197
|
+
.top-content {
|
|
198
|
+
display: flex;
|
|
199
|
+
flex-direction: column;
|
|
200
|
+
gap: var(--spacing-3);
|
|
201
|
+
|
|
202
|
+
}
|
|
203
|
+
.scb-card img {
|
|
204
|
+
border-radius: var(--md-sys-shape-corner-large);
|
|
205
|
+
width: 100%;
|
|
206
|
+
object-fit: contain;
|
|
207
|
+
}
|
|
208
|
+
.scb-card img.avatar{
|
|
209
|
+
border-radius: var(--md-sys-shape-corner-full);
|
|
210
|
+
width: var(--icon-size-large);
|
|
211
|
+
height: var(--icon-size-large);
|
|
212
|
+
margin: var(--spacing-7) 0 0 var(--spacing-6);
|
|
213
|
+
}
|
|
214
|
+
.scb-card img.avatar + .full-content {
|
|
215
|
+
padding: var(--spacing-5) var(--spacing-6) var(--spacing-7) var(--spacing-6);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/* Horisontella kortspecifika stilar */
|
|
219
|
+
.scb-card.horizontal {
|
|
220
|
+
flex-direction: row;
|
|
221
|
+
width: 100%;
|
|
222
|
+
max-width: 576px;
|
|
223
|
+
}
|
|
224
|
+
.scb-card.horizontal .full-content {
|
|
225
|
+
padding: var(--spacing-6) var(--spacing-6) var(--spacing-6) 0;
|
|
226
|
+
width: 100%;
|
|
227
|
+
}
|
|
228
|
+
.scb-card.horizontal img{
|
|
229
|
+
width: auto;
|
|
230
|
+
height: 133px;
|
|
231
|
+
margin: var(--spacing-6);
|
|
232
|
+
}
|
|
233
|
+
.scb-card.horizontal img.avatar {
|
|
234
|
+
border-radius: var(--md-sys-shape-corner-full);
|
|
235
|
+
width: var(--icon-size-large);
|
|
236
|
+
height: var(--icon-size-large);
|
|
237
|
+
margin: var(--spacing-6) 0 var(--spacing-6) var(--spacing-6);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
.scb-card .content.list{
|
|
241
|
+
margin-top: var(--spacing-7);
|
|
242
|
+
}
|
|
243
|
+
.scb-card .content.actions ::slotted(*) {
|
|
244
|
+
margin-top: var(--spacing-7);
|
|
245
|
+
display: flex;
|
|
246
|
+
flex-wrap: wrap;
|
|
247
|
+
gap: var(--spacing-3);
|
|
248
|
+
}
|
|
249
|
+
.scb-card .content.links ::slotted(*) {
|
|
250
|
+
margin-top: var(--spacing-3);
|
|
251
|
+
display: flex;
|
|
252
|
+
flex-direction: column;
|
|
253
|
+
gap: var(--spacing-3);
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
`;s([e({type:String})],t.prototype,"type",2);s([e({type:String})],t.prototype,"variant",2);s([e({type:String})],t.prototype,"direction",2);s([e({type:String,attribute:"media-type"})],t.prototype,"mediaType",2);s([e({type:String,attribute:"media-href"})],t.prototype,"mediaHref",2);s([e({type:String,attribute:"card-href"})],t.prototype,"cardHref",2);s([e({type:String})],t.prototype,"label",2);s([e({type:String,attribute:"sub-label"})],t.prototype,"subLabel",2);s([e({type:String,attribute:"supporting-text"})],t.prototype,"supportingText",2);s([e({type:Date})],t.prototype,"date",2);s([e({type:String,attribute:"social-comments-text"})],t.prototype,"commentsText",2);s([e({type:Number,attribute:"social-comments",reflect:!0})],t.prototype,"comments",2);s([e({type:String,attribute:"social-likes-text"})],t.prototype,"likesText",2);s([e({type:Number,attribute:"social-likes",reflect:!0})],t.prototype,"likes",2);t=s([v("scb-card")],t);
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import{b as d,n as h,i as b,x as u,t as v}from"../../vendor/vendor.js";var f=Object.defineProperty,x=Object.getOwnPropertyDescriptor,g=e=>{throw TypeError(e)},n=(e,r,t,i)=>{for(var s=i>1?void 0:i?x(r,t):r,c=e.length-1,l;c>=0;c--)(l=e[c])&&(s=(i?l(r,t,s):l(s))||s);return i&&s&&f(r,t,s),s},y=(e,r,t)=>r.has(e)||g("Cannot "+t),p=(e,r,t)=>(y(e,r,"read from private field"),t?t.call(e):r.get(e)),_=(e,r,t)=>r.has(e)?g("Cannot add the same private member more than once"):r instanceof WeakSet?r.add(e):r.set(e,t),o;let a=class extends b{constructor(){super(...arguments),this.orientation="vertical",this.disabled=!1,this.spacing="group",_(this,o,()=>{const e=this.shadowRoot?.querySelector("slot");if(!e)return;const r=e.assignedElements({flatten:!0}).filter(t=>t.tagName.toLowerCase()==="scb-checkbox");for(const t of r)this.disabled?t.setAttribute("disabled",""):t.removeAttribute("disabled"),this.orientation==="horizontal"?t.setAttribute("orientation","horizontal"):t.removeAttribute("orientation"),this.spacing==="group"?t.style.setProperty("--scb-checkbox-gap","0"):t.style.removeProperty("--scb-checkbox-gap")})}render(){const e=this.orientation==="horizontal"?"row":"column";return u`
|
|
2
|
+
<div class="g" role="group" aria-disabled=${String(this.disabled)} style=${`--_dir:${e}`}>
|
|
3
|
+
<slot @slotchange=${p(this,o)}></slot>
|
|
4
|
+
</div>
|
|
5
|
+
`}firstUpdated(){p(this,o).call(this)}updated(e){(e.has("disabled")||e.has("orientation")||e.has("spacing"))&&p(this,o).call(this)}};o=new WeakMap;a.styles=d`
|
|
6
|
+
/* Standardgap när group äger spacing. Kan överskridas via --scb-checkbox-gap. */
|
|
7
|
+
:host {
|
|
8
|
+
display: block;
|
|
9
|
+
--scb-checkbox-gap: 12px;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.g {
|
|
13
|
+
display: flex;
|
|
14
|
+
flex-direction: var(--_dir, column);
|
|
15
|
+
align-items: flex-start;
|
|
16
|
+
gap: 0; /* om spacing="item" */
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/* spacing="group" → använder gap-variabeln */
|
|
20
|
+
:host([spacing="group"]) .g {
|
|
21
|
+
gap: var(--scb-checkbox-gap);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/* Öka gap när gruppen är horisontell */
|
|
25
|
+
:host([orientation="horizontal"]) {
|
|
26
|
+
--scb-checkbox-gap: 32px;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/* När gruppen äger spacing: nolla barnens egen högermarginal (horisontellt läge). */
|
|
30
|
+
:host([spacing="group"]) ::slotted(scb-checkbox) {
|
|
31
|
+
--scb-checkbox-gap: 0;
|
|
32
|
+
}
|
|
33
|
+
`;n([h({type:String,reflect:!0})],a.prototype,"orientation",2);n([h({type:Boolean,reflect:!0})],a.prototype,"disabled",2);n([h({type:String,reflect:!0})],a.prototype,"spacing",2);a=n([v("scb-checkbox-group")],a);
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import{b as d,n as i,i as h,x as p,t as b}from"../../vendor/vendor.js";import"../../vendor/vendor-material.js";var u=Object.defineProperty,x=Object.getOwnPropertyDescriptor,o=(e,r,c,a)=>{for(var s=a>1?void 0:a?x(r,c):r,l=e.length-1,n;l>=0;l--)(n=e[l])&&(s=(a?n(r,c,s):n(s))||s);return a&&s&&u(r,c,s),s};let t=class extends h{constructor(){super(...arguments),this.disabled=!1,this.indeterminate=!1,this.checked=!1,this.label="",this.supportingText="",this._checkboxId=""}connectedCallback(){super.connectedCallback(),this._checkboxId=this.id||`scb-checkbox-${Math.random().toString(36).substr(2,9)}`}firstUpdated(){const e=this.shadowRoot?.querySelector("md-checkbox");e&&e.addEventListener("change",()=>{const r=e.checked;this.checked=r,this.dispatchEvent(new CustomEvent("change",{detail:{checked:r},bubbles:!0,composed:!0}))})}updated(e){super.updated(e),e.has("disabled")&&this.toggleAttribute("aria-disabled",this.disabled)}render(){const e=this.supportingText?`${this._checkboxId}-supporting-text`:void 0;return p`
|
|
2
|
+
<label class="wrap">
|
|
3
|
+
<div class="box-wrap">
|
|
4
|
+
<md-checkbox
|
|
5
|
+
id="${this._checkboxId}"
|
|
6
|
+
touch-target="wrapper"
|
|
7
|
+
?disabled=${this.disabled}
|
|
8
|
+
?indeterminate=${this.indeterminate}
|
|
9
|
+
?checked=${this.checked}
|
|
10
|
+
aria-describedby=${e}
|
|
11
|
+
></md-checkbox>
|
|
12
|
+
</div>
|
|
13
|
+
${this.label?p`<span class="lbl">${this.label}</span>`:""}
|
|
14
|
+
</label>
|
|
15
|
+
|
|
16
|
+
${this.supportingText?p`<div id="${this._checkboxId}-supporting-text" class="supporting-text">
|
|
17
|
+
${this.supportingText}
|
|
18
|
+
</div>`:""}
|
|
19
|
+
|
|
20
|
+
<slot></slot>
|
|
21
|
+
`}};t.styles=d`
|
|
22
|
+
/* Grundläggande layout med inline-grid */
|
|
23
|
+
:host {
|
|
24
|
+
display: inline-grid;
|
|
25
|
+
grid-template-columns: auto;
|
|
26
|
+
grid-template-rows: auto auto;
|
|
27
|
+
row-gap: 4px;
|
|
28
|
+
font-family: var(--brand-font, 'Inter', sans-serif);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/* Mer luft till höger i horisontella layouter (sätts av checkbox-gruppen) */
|
|
32
|
+
:host([orientation="horizontal"]) {
|
|
33
|
+
margin-inline-end: var(--scb-checkbox-gap, 24px);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/* Wrapper för md-checkbox + label
|
|
37
|
+
48px kontrollblock + 12px textgap (matchar radio) */
|
|
38
|
+
.wrap {
|
|
39
|
+
display: inline-flex;
|
|
40
|
+
align-items: center;
|
|
41
|
+
gap: 12px;
|
|
42
|
+
cursor: pointer;
|
|
43
|
+
overflow: visible; /* låt ripple synas */
|
|
44
|
+
}
|
|
45
|
+
:host([disabled]) .wrap {
|
|
46
|
+
cursor: default;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/* Hit-target runt själva md-checkboxen (48px) */
|
|
50
|
+
.box-wrap {
|
|
51
|
+
height: var(--scb-checkbox-target, 48px);
|
|
52
|
+
width: var(--scb-checkbox-target, 48px);
|
|
53
|
+
display: flex;
|
|
54
|
+
align-items: center;
|
|
55
|
+
justify-content: center;
|
|
56
|
+
overflow: visible;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/* Nollställ md-checkbox marginal */
|
|
60
|
+
md-checkbox {
|
|
61
|
+
margin: 0;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/* Visa focusring ENDAST vid tangentbordsfokus.
|
|
65
|
+
Vid musklick (focus men inte focus-visible) görs den transparent. */
|
|
66
|
+
md-checkbox:focus:not(:focus-visible) {
|
|
67
|
+
--md-focus-ring-color: transparent;
|
|
68
|
+
--md-focus-ring-width: 0;
|
|
69
|
+
outline: none;
|
|
70
|
+
box-shadow: none;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/* Label-styling */
|
|
74
|
+
.lbl {
|
|
75
|
+
color: var(--md-sys-color-on-surface);
|
|
76
|
+
line-height: 1.2;
|
|
77
|
+
margin-top: 2px;
|
|
78
|
+
}
|
|
79
|
+
:host([disabled]) .lbl {
|
|
80
|
+
color: var(--n-60);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/* Supporting text styling */
|
|
84
|
+
.supporting-text {
|
|
85
|
+
color: var(--md-sys-color-on-surface-variant);
|
|
86
|
+
line-height: 1.2;
|
|
87
|
+
/* 12px (gap) + 48px (box-wrap) -> linjerar med label */
|
|
88
|
+
margin-left: calc(12px + var(--scb-checkbox-target, 48px));
|
|
89
|
+
}
|
|
90
|
+
:host([disabled]) .supporting-text {
|
|
91
|
+
color: var(--n-60);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/* Anpassning för mörkt läge */
|
|
95
|
+
@media (prefers-color-scheme: dark) {
|
|
96
|
+
.lbl { color: var(--md-sys-color-on-surface); }
|
|
97
|
+
.supporting-text { color: var(--md-sys-color-on-surface-variant); }
|
|
98
|
+
}
|
|
99
|
+
`;o([i({type:Boolean,reflect:!0})],t.prototype,"disabled",2);o([i({type:Boolean,reflect:!0})],t.prototype,"indeterminate",2);o([i({type:Boolean,reflect:!0})],t.prototype,"checked",2);o([i({type:String})],t.prototype,"label",2);o([i({type:String,attribute:"supporting-text"})],t.prototype,"supportingText",2);t=o([b("scb-checkbox")],t);export{t as ScbCheckbox};
|
|
@@ -0,0 +1,46 @@
|
|
|
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 d}from"../../vendor/preload-helper.js";import{b as p,n as a,i as _,x as r,t as u}from"../../vendor/vendor.js";var m=Object.defineProperty,v=Object.getOwnPropertyDescriptor,s=(e,o,c,l)=>{for(var i=l>1?void 0:l?v(o,c):o,h=e.length-1,n;h>=0;h--)(n=e[h])&&(i=(l?n(o,c,i):n(i))||i);return l&&i&&m(o,c,i),i};let t=class extends _{constructor(){super(...arguments),this.variant="assist",this.label="",this.icon="",this.disabled=!1,this.elevated=!1,this.removable=!1,this.selected=!1,this.__loadedVariants=new Set,this.__chipSetLoaded=!1,this.__iconLoaded=!1}updated(e){super.updated(e),e.has("disabled")&&this.toggleAttribute("aria-disabled",this.disabled),(e.has("variant")||e.has("icon"))&&this.__ensureDepsLoaded()}firstUpdated(){this.__ensureDepsLoaded()}async __ensureDepsLoaded(){if(!this.__loadedVariants.has(this.variant)){switch(this.variant){case"assist":await d(()=>import("../../vendor/vendor-material.js").then(e=>e.k),__vite__mapDeps([0,1]),import.meta.url);break;case"filter":await d(()=>import("../../vendor/vendor-material.js").then(e=>e.m),__vite__mapDeps([0,1]),import.meta.url);break}this.__loadedVariants.add(this.variant)}!this._insideChipSet&&!this.__chipSetLoaded&&(await d(()=>import("../../vendor/vendor-material.js").then(e=>e.n),__vite__mapDeps([0,1]),import.meta.url),this.__chipSetLoaded=!0),this.icon&&!this.__iconLoaded&&(await d(()=>import("../../vendor/vendor-material.js").then(e=>e.i),__vite__mapDeps([0,1]),import.meta.url),this.__iconLoaded=!0)}get _insideChipSet(){return!!this.closest("md-chip-set")}render(){const e=this._renderChip();return this._insideChipSet?e:r`<md-chip-set>${e}</md-chip-set>`}_renderChip(){const e=this.icon?r`<md-icon slot="icon">${this.icon}</md-icon>`:null;switch(this.variant){case"assist":return r`
|
|
3
|
+
<md-assist-chip
|
|
4
|
+
label=${this.label}
|
|
5
|
+
?disabled=${this.disabled}
|
|
6
|
+
?elevated=${this.elevated}
|
|
7
|
+
@update-focus=${this._forward}
|
|
8
|
+
>
|
|
9
|
+
${e}
|
|
10
|
+
</md-assist-chip>
|
|
11
|
+
`;case"filter":return r`
|
|
12
|
+
<md-filter-chip
|
|
13
|
+
label=${this.label}
|
|
14
|
+
?disabled=${this.disabled}
|
|
15
|
+
?removable=${this.removable}
|
|
16
|
+
?selected=${this.selected}
|
|
17
|
+
aria-pressed="${this.selected}"
|
|
18
|
+
@remove=${this._onRemove}
|
|
19
|
+
@update-focus=${this._forward}
|
|
20
|
+
@click=${()=>this._toggleSelected()}
|
|
21
|
+
>
|
|
22
|
+
${e}
|
|
23
|
+
</md-filter-chip>
|
|
24
|
+
`;default:return r``}}_toggleSelected(){this.selected=!this.selected,this.dispatchEvent(new CustomEvent("selected-changed",{detail:{selected:this.selected},bubbles:!0,composed:!0}))}_onRemove(e){e.stopPropagation(),this.dispatchEvent(new CustomEvent("remove",{detail:{label:this.label},bubbles:!0,composed:!0}))}_forward(e){this.dispatchEvent(new CustomEvent(e.type,{detail:e.detail,bubbles:!0,composed:!0}))}};t.styles=p`
|
|
25
|
+
:host {
|
|
26
|
+
display: inline-block;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/* Sätt samma färg på label för assist som är på filter */
|
|
30
|
+
:host md-assist-chip {
|
|
31
|
+
--_label-text-color: var(--md-sys-color-on-surface-variant);
|
|
32
|
+
--_hover-label-text-color: var(--md-sys-color-on-surface-variant);
|
|
33
|
+
--_focus-label-text-color: var(--md-sys-color-on-surface-variant);
|
|
34
|
+
--_pressed-label-text-color: var(--md-sys-color-on-surface-variant);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
md-icon {
|
|
38
|
+
color: var(--p-20);
|
|
39
|
+
font-size: var(--scb-icon-size-large);
|
|
40
|
+
}
|
|
41
|
+
@media (prefers-color-scheme: dark) {
|
|
42
|
+
md-icon {
|
|
43
|
+
color: var(--md-sys-color-on-surface);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
`;s([a({type:String,reflect:!0})],t.prototype,"variant",2);s([a({type:String})],t.prototype,"label",2);s([a({type:String})],t.prototype,"icon",2);s([a({type:Boolean,reflect:!0})],t.prototype,"disabled",2);s([a({type:Boolean,reflect:!0})],t.prototype,"elevated",2);s([a({type:Boolean,reflect:!0})],t.prototype,"removable",2);s([a({type:Boolean,reflect:!0})],t.prototype,"selected",2);t=s([u("scb-chip")],t);export{t as ScbChip};
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../scb-textfield/scb-textfield.js","../../vendor/preload-helper.js","../../vendor/vendor.js","../scb-checkbox/scb-checkbox.js","../../vendor/vendor-material.js","../scb-radio-button/scb-radio-button.js","../scb-switch/scb-switch.js","../scb-chips/scb-chip.js","../scb-button/scb-button.js","../scb-icon-button/scb-icon-button.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{_ as l}from"../../vendor/preload-helper.js";import{b as h,n as s,i as m,E as p,x as r,t as _}from"../../vendor/vendor.js";var b=Object.defineProperty,f=Object.getOwnPropertyDescriptor,o=(t,e,n,c)=>{for(var a=c>1?void 0:c?f(e,n):e,d=t.length-1,u;d>=0;d--)(u=t[d])&&(a=(c?u(e,n,a):u(a))||a);return c&&a&&b(e,n,a),a};let i=class extends m{constructor(){super(...arguments),this.open=!1,this.inSb=!1,this.scrimClose=!0,this.variant="basic",this.label="",this.icon="",this.supportingText="",this.okButton="OK",this.cancelButton="Avbryt",this.deleteButton="Delete",this.confirmButton="Ta bort",this.denyButton="Avbryt",this.resetButton="Återställ",this.submitButton="Spara",this.formId="",this.formAction="",this.formMethod="",this.__lastTriggerEl=null,this.__slotDeps={"SCB-TEXTFIELD":()=>l(()=>import("../scb-textfield/scb-textfield.js"),__vite__mapDeps([0,1,2]),import.meta.url),"SCB-CHECKBOX":()=>l(()=>import("../scb-checkbox/scb-checkbox.js"),__vite__mapDeps([3,2,4]),import.meta.url),"SCB-RADIO-BUTTON":()=>l(()=>import("../scb-radio-button/scb-radio-button.js"),__vite__mapDeps([5,2,4]),import.meta.url),"SCB-SWITCH":()=>l(()=>import("../scb-switch/scb-switch.js"),__vite__mapDeps([6,1,2]),import.meta.url),"SCB-CHIP":()=>l(()=>import("../scb-chips/scb-chip.js"),__vite__mapDeps([7,1,2]),import.meta.url)},this.__onDocumentClick=t=>{this.__getActionFromEvent(t)==="toggle"&&(this.__setOpen(!this.open),t.stopPropagation())},this.__onDocumentKeydown=t=>{this.open&&t.key==="Escape"&&(this.__fire("esc"),this.__setOpen(!1))},this.__onScrimClick=()=>{this.scrimClose&&(this.__fire("scrim"),this.__setOpen(!1))},this.__onOk=()=>{this.__fire("ok"),this.__setOpen(!1)},this.__onCancel=()=>{this.__fire("cancel"),this.__setOpen(!1)},this.__onConfirm=()=>{this.__fire("confirm"),this.__setOpen(!1)},this.__onDeny=()=>{this.__fire("deny"),this.__setOpen(!1)},this.__onReset=()=>{this.shadowRoot?.querySelector("form")?.reset(),(this.shadowRoot?.querySelector("slot")?.assignedElements({flatten:!0})??[]).forEach(e=>{const n=e.tagName;n==="SCB-TEXTFIELD"&&(e.value=""),n==="SCB-CHECKBOX"&&(e.checked=!1),n==="SCB-RADIO-BUTTON"&&(e.checked=!1),n==="SCB-SWITCH"&&(e.selected=!1),n==="SCB-CHIP"&&(e.selected=!1)}),this.__fire("reset")},this.__onSubmit=()=>{this.shadowRoot?.querySelector("form")?.requestSubmit(),this.__fire("submit"),this.__setOpen(!1)},this.__onKeydownTrap=t=>{if(!this.open||t.key!=="Tab")return;const e=Array.from(this.shadowRoot.querySelectorAll('button,[href],input,select,textarea,[tabindex]:not([tabindex="-1"])')).filter(a=>!a.hasAttribute("disabled"));if(!e.length)return;const n=e[0],c=e[e.length-1];t.shiftKey&&document.activeElement===n?(c.focus(),t.preventDefault()):!t.shiftKey&&document.activeElement===c&&(n.focus(),t.preventDefault())}}async firstUpdated(){await l(()=>import("../scb-button/scb-button.js"),__vite__mapDeps([8,1,2]),import.meta.url),await l(()=>import("../scb-icon-button/scb-icon-button.js"),__vite__mapDeps([9,1,2]),import.meta.url),this.icon&&await l(()=>import("../../vendor/vendor-material.js").then(t=>t.i),__vite__mapDeps([4,2]),import.meta.url),await this.__ensureSlottedDeps()}async __ensureSlottedDeps(){const t=this.shadowRoot?.querySelector("slot");if(!t)return;const e=async n=>{const c=new Set(n.map(a=>a.tagName));for(const a of c){const d=this.__slotDeps[a];d&&await d()}};await e(t.assignedElements({flatten:!0})),t.addEventListener("slotchange",async()=>e(t.assignedElements({flatten:!0})))}__getActionFromEvent(t){if(!this.id)return null;for(const e of t.composedPath())if(e instanceof Element){if(e.getAttribute("data-dialog-toggle")===this.id)return this.__lastTriggerEl=e,"toggle";if(e.getAttribute("aria-controls")===this.id)return this.__lastTriggerEl=e,"toggle"}return null}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this.__onDocumentClick,!1),document.addEventListener("keydown",this.__onDocumentKeydown,!0),this.addEventListener("keydown",this.__onKeydownTrap)}disconnectedCallback(){document.removeEventListener("click",this.__onDocumentClick,!1),document.removeEventListener("keydown",this.__onDocumentKeydown,!0),this.removeEventListener("keydown",this.__onKeydownTrap),super.disconnectedCallback()}updated(t){if(t.has("open")){const e=t.get("open");this.__updateTriggersExpanded(),this.open&&!e?this.updateComplete.then(()=>{this.shadowRoot?.querySelector('button,[href],input,select,textarea,[tabindex]:not([tabindex="-1"])')?.focus?.()}):!this.open&&e&&this.__lastTriggerEl?.focus?.(),this.__toggleScrollLock(this.open)}t.has("icon")&&this.icon&&l(()=>import("../../vendor/vendor-material.js").then(e=>e.i),__vite__mapDeps([4,2]),import.meta.url)}__updateTriggersExpanded(){this.id&&document.querySelectorAll(`[aria-controls="${this.id}"], [data-dialog-toggle="${this.id}"]`).forEach(t=>{t.hasAttribute("aria-controls")&&t.setAttribute("aria-expanded",String(this.open))})}__toggleScrollLock(t){if(this.inSb)return;const e=document.documentElement;e.style.overflow=t?"hidden":""}__setOpen(t){this.open=t,this.__fire(t?"open":"close")}__fire(t,e){this.dispatchEvent(new CustomEvent(t,{detail:e,bubbles:!0,composed:!0}))}__slotIsEmpty(){const t=this.shadowRoot?.querySelector("slot");return t?t.assignedElements({flatten:!0}).length===0:!0}renderHeader(t){const e=this.variant==="form"||this.variant==="floating";return r`
|
|
3
|
+
<div class="header">
|
|
4
|
+
<div class="title">
|
|
5
|
+
${this.icon?r`<md-icon class="dialog-icon">${this.icon}</md-icon>`:p}
|
|
6
|
+
<div class="label" id=${t}>${this.label}</div>
|
|
7
|
+
</div>
|
|
8
|
+
${e?r`<scb-icon-button class="close" icon="close" @click=${this.__onCancel}></scb-icon-button>`:p}
|
|
9
|
+
</div>
|
|
10
|
+
`}renderContentDefault(t){const e=this.__slotIsEmpty();return r`
|
|
11
|
+
<div class="content" id=${t}>
|
|
12
|
+
${e&&this.supportingText?r`${this.supportingText}`:r`<slot></slot>`}
|
|
13
|
+
</div>
|
|
14
|
+
`}renderActions(){switch(this.variant){case"alert":return r`<div class="actions">
|
|
15
|
+
<scb-button variant="text" label=${this.okButton} @click=${this.__onOk}></scb-button>
|
|
16
|
+
</div>`;case"confirm":return r`<div class="actions">
|
|
17
|
+
<scb-button variant="text" label=${this.confirmButton} @click=${this.__onConfirm}></scb-button>
|
|
18
|
+
<scb-button variant="text" label=${this.denyButton} @click=${this.__onDeny}></scb-button>
|
|
19
|
+
</div>`;case"choose":return r`<div class="actions">
|
|
20
|
+
<scb-button variant="text" label=${this.cancelButton} @click=${this.__onCancel}></scb-button>
|
|
21
|
+
<scb-button variant="text" label=${this.okButton} @click=${this.__onOk}></scb-button>
|
|
22
|
+
</div>`;case"form":return r`<div class="actions">
|
|
23
|
+
<scb-button class="start" variant="text" label=${this.resetButton} @click=${this.__onReset}></scb-button>
|
|
24
|
+
<scb-button variant="text" label=${this.cancelButton} @click=${this.__onCancel}></scb-button>
|
|
25
|
+
<scb-button variant="text" label=${this.submitButton} @click=${this.__onSubmit}></scb-button>
|
|
26
|
+
</div>`;case"floating":return p;default:return r`<div class="actions">
|
|
27
|
+
<scb-button variant="text" label=${this.cancelButton} @click=${this.__onCancel}></scb-button>
|
|
28
|
+
<scb-button variant="text" label=${this.okButton} @click=${this.__onOk}></scb-button>
|
|
29
|
+
</div>`}}renderBody(t,e){return this.variant==="form"?r`
|
|
30
|
+
${this.renderHeader(t)}
|
|
31
|
+
<div class="content" id=${e}>
|
|
32
|
+
<form id=${this.formId} action=${this.formAction} method=${this.formMethod||p}>
|
|
33
|
+
<slot></slot>
|
|
34
|
+
</form>
|
|
35
|
+
</div>
|
|
36
|
+
${this.renderActions()}
|
|
37
|
+
`:r`${this.renderHeader(t)} ${this.renderContentDefault(e)} ${this.renderActions()}`}render(){const t="dlg-title",e="dlg-desc";return r`
|
|
38
|
+
<div class="scrim" @click=${this.__onScrimClick} aria-hidden="true"></div>
|
|
39
|
+
<div
|
|
40
|
+
class="container"
|
|
41
|
+
role="dialog"
|
|
42
|
+
aria-modal="true"
|
|
43
|
+
aria-labelledby=${t}
|
|
44
|
+
aria-describedby=${e}
|
|
45
|
+
>
|
|
46
|
+
${this.renderBody(t,e)}
|
|
47
|
+
</div>
|
|
48
|
+
`}};i.styles=h`
|
|
49
|
+
:host { display:block; position:relative; }
|
|
50
|
+
|
|
51
|
+
.scrim {
|
|
52
|
+
position: var(--scb-dialog-scrim-position, fixed);
|
|
53
|
+
inset: 0;
|
|
54
|
+
/* var från tokens, tonas med opacity via color-mix */
|
|
55
|
+
background: color-mix(in srgb, var(--md-sys-color-scrim) 32%, transparent);
|
|
56
|
+
z-index: var(--z-dialog-scrim, 1000);
|
|
57
|
+
opacity: 1;
|
|
58
|
+
transition: opacity var(--motion-duration-short, 0.25s);
|
|
59
|
+
height: var(--scb-dialog-scrim-height, auto);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.container {
|
|
63
|
+
position: var(--scb-dialog-container-position, fixed);
|
|
64
|
+
inset: 50% auto auto 50%;
|
|
65
|
+
transform: translate(-50%, -50%) scale(1);
|
|
66
|
+
|
|
67
|
+
background: var(--md-sys-color-surface);
|
|
68
|
+
color: var(--md-sys-color-on-surface);
|
|
69
|
+
|
|
70
|
+
/* radius mappad till spacing-token som fallback */
|
|
71
|
+
border-radius: var(--scb-dialog-radius, var(--spacing-5, 16px));
|
|
72
|
+
|
|
73
|
+
/* skugga mappad till shadow-token + spacing-tokens */
|
|
74
|
+
box-shadow:
|
|
75
|
+
0 var(--spacing-1, 2px)
|
|
76
|
+
var(--spacing-5, 16px)
|
|
77
|
+
color-mix(in srgb, var(--md-sys-color-shadow) 20%, transparent);
|
|
78
|
+
|
|
79
|
+
/* width/height via CSS custom props med px-fallback */
|
|
80
|
+
min-width: var(--scb-dialog-min-w, 340px);
|
|
81
|
+
max-width: var(--scb-dialog-max-w, 90vw);
|
|
82
|
+
max-height: var(--scb-dialog-max-h, 90vh);
|
|
83
|
+
|
|
84
|
+
display:flex; flex-direction:column;
|
|
85
|
+
|
|
86
|
+
/* padding mappad till spacing-token */
|
|
87
|
+
padding: var(--scb-dialog-padding, var(--spacing-7, 24px));
|
|
88
|
+
|
|
89
|
+
z-index: var(--z-dialog, 1001);
|
|
90
|
+
opacity: 1;
|
|
91
|
+
transition:
|
|
92
|
+
opacity var(--motion-duration-short, 0.25s),
|
|
93
|
+
transform var(--motion-duration-short, 0.25s);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
:host(:not([open])) .scrim,
|
|
97
|
+
:host(:not([open])) .container { opacity:0; pointer-events:none; }
|
|
98
|
+
|
|
99
|
+
/* Header: ikon över rubrik */
|
|
100
|
+
.header {
|
|
101
|
+
display:flex;
|
|
102
|
+
align-items:flex-start;
|
|
103
|
+
gap: var(--spacing-4, 12px);
|
|
104
|
+
margin-bottom: var(--spacing-5, 16px);
|
|
105
|
+
}
|
|
106
|
+
.header .title {
|
|
107
|
+
display:flex;
|
|
108
|
+
flex-direction:column; /* ikon ovanför label */
|
|
109
|
+
gap: var(--spacing-3, 8px);
|
|
110
|
+
}
|
|
111
|
+
.header .label {
|
|
112
|
+
/* typografi mappad till md-sys-typescale tokens */
|
|
113
|
+
font-weight: var(--md-sys-typescale-headline-small-weight, 700);
|
|
114
|
+
font-size: var(--md-sys-typescale-headline-small-size, 1.5rem);
|
|
115
|
+
line-height: var(--md-sys-typescale-headline-small-line-height, 2rem);
|
|
116
|
+
}
|
|
117
|
+
.header .close { margin-left:auto; }
|
|
118
|
+
|
|
119
|
+
.dialog-icon {
|
|
120
|
+
inline-size: var(--scb-dialog-icon-size, var(--spacing-7, 24px));
|
|
121
|
+
block-size: var(--scb-dialog-icon-size, var(--spacing-7, 24px));
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.content {
|
|
125
|
+
flex: 1 1 auto;
|
|
126
|
+
overflow:auto;
|
|
127
|
+
margin-bottom: var(--spacing-5, 16px);
|
|
128
|
+
color: var(--md-sys-color-on-surface-variant);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.actions {
|
|
132
|
+
display:flex;
|
|
133
|
+
align-items:center;
|
|
134
|
+
gap: var(--spacing-3, 8px);
|
|
135
|
+
justify-content:flex-end;
|
|
136
|
+
}
|
|
137
|
+
.actions .start { margin-right:auto; }
|
|
138
|
+
|
|
139
|
+
/* Min-bredder per variant (override-ningsbara via CSS custom props) */
|
|
140
|
+
:host([variant="choose"]) .container { --scb-dialog-min-w: var(--scb-dialog-min-w-choose, 280px); }
|
|
141
|
+
:host([variant="alert"]) .container { --scb-dialog-min-w: var(--scb-dialog-min-w-alert, 320px); }
|
|
142
|
+
:host([variant="confirm"]) .container { --scb-dialog-min-w: var(--scb-dialog-min-w-confirm, 360px); }
|
|
143
|
+
|
|
144
|
+
/* Form-layout: enkel kolumn-grid med gap */
|
|
145
|
+
:host([variant="form"]) form{
|
|
146
|
+
display:grid;
|
|
147
|
+
grid-template-columns: 1fr;
|
|
148
|
+
gap: var(--scb-form-gap, var(--spacing-6, 20px)); /* <— token + fallback */
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
:host([variant="floating"]) .container { --scb-dialog-min-w: var(--scb-dialog-min-w-floating, 360px); }
|
|
152
|
+
|
|
153
|
+
/* Choose: gör slottade radios vertikala med spacing */
|
|
154
|
+
:host([variant="choose"]) ::slotted(scb-radio-button) {
|
|
155
|
+
display:block;
|
|
156
|
+
margin-block: var(--scb-choice-gap, 6px);
|
|
157
|
+
}
|
|
158
|
+
`;o([s({type:Boolean,reflect:!0})],i.prototype,"open",2);o([s({type:Boolean,attribute:!1})],i.prototype,"inSb",2);o([s({type:Boolean,attribute:"scrim-close"})],i.prototype,"scrimClose",2);o([s({type:String})],i.prototype,"variant",2);o([s({type:String})],i.prototype,"label",2);o([s({type:String})],i.prototype,"icon",2);o([s({type:String,attribute:"supporting-text"})],i.prototype,"supportingText",2);o([s({type:String,attribute:"ok-button"})],i.prototype,"okButton",2);o([s({type:String,attribute:"cancel-button"})],i.prototype,"cancelButton",2);o([s({type:String,attribute:"delete-button"})],i.prototype,"deleteButton",2);o([s({type:String,attribute:"confirm-button"})],i.prototype,"confirmButton",2);o([s({type:String,attribute:"deny-button"})],i.prototype,"denyButton",2);o([s({type:String,attribute:"reset-button"})],i.prototype,"resetButton",2);o([s({type:String,attribute:"submit-button"})],i.prototype,"submitButton",2);o([s({type:String,attribute:"form-id"})],i.prototype,"formId",2);o([s({type:String,attribute:"form-action"})],i.prototype,"formAction",2);o([s({type:String,attribute:"form-method"})],i.prototype,"formMethod",2);i=o([_("scb-dialog")],i);
|