scb-wc-test 0.1.105 → 0.1.107
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-accordion/scb-accordion.js +8 -2
- package/mvc/components/scb-avatar/scb-avatar.js +19 -10
- package/mvc/components/scb-breadcrumb/scb-breadcrumb-item.js +2 -3
- package/mvc/components/scb-breadcrumb/scb-breadcrumb.js +13 -7
- package/mvc/components/scb-button/scb-button.js +34 -32
- package/mvc/components/scb-calendar-card/scb-calendar-card.js +13 -11
- package/mvc/components/scb-card/scb-card.js +44 -41
- package/mvc/components/scb-checkbox/scb-checkbox-group.js +15 -13
- package/mvc/components/scb-checkbox/scb-checkbox.js +6 -6
- package/mvc/components/scb-chip/scb-chip.js +27 -7
- package/mvc/components/scb-divider/scb-divider.js +41 -15
- package/mvc/components/scb-fact-card/scb-fact-card.js +37 -18
- package/mvc/components/scb-horizontal-scroller/scb-horizontal-scroller.js +71 -43
- package/mvc/components/scb-icon-button/scb-icon-button.js +16 -10
- package/mvc/components/scb-keyfigure-card/scb-keyfigure-card.js +6 -4
- package/mvc/components/scb-list/scb-list.js +3 -3
- package/mvc/components/scb-notification-card/scb-notification-card.js +5 -5
- package/mvc/components/scb-pagination/scb-pagination.js +165 -107
- package/mvc/components/scb-radio-button/scb-radio-group.js +22 -11
- package/mvc/components/scb-search/scb-search.js +84 -32
- package/mvc/components/scb-segmented-button/scb-segmented-button.js +15 -13
- package/mvc/components/scb-status-pill/scb-status-pill.js +17 -13
- package/mvc/components/scb-stepper/scb-stepper.js +32 -29
- package/mvc/components/scb-switch/scb-switch.js +11 -8
- package/mvc/components/scb-tabs/scb-tabs.js +22 -19
- package/mvc/components/scb-textfield/scb-textfield.js +14 -10
- package/mvc/components/scb-toc/scb-toc.js +6 -3
- package/mvc/components/scb-viz/scb-viz.js +188 -178
- package/package.json +2 -2
- package/scb-accordion/scb-accordion.d.ts +13 -0
- package/scb-accordion/scb-accordion.js +53 -21
- package/scb-avatar/scb-avatar.d.ts +6 -0
- package/scb-avatar/scb-avatar.js +96 -61
- package/scb-breadcrumb/scb-breadcrumb-item.js +8 -9
- package/scb-breadcrumb/scb-breadcrumb.d.ts +6 -0
- package/scb-breadcrumb/scb-breadcrumb.js +61 -30
- package/scb-button/scb-button.d.ts +10 -0
- package/scb-button/scb-button.js +89 -65
- package/scb-calendar-card/scb-calendar-card.d.ts +5 -0
- package/scb-calendar-card/scb-calendar-card.js +79 -55
- package/scb-card/scb-card.d.ts +5 -0
- package/scb-card/scb-card.js +165 -140
- package/scb-checkbox/scb-checkbox-group.d.ts +3 -1
- package/scb-checkbox/scb-checkbox-group.js +59 -40
- package/scb-checkbox/scb-checkbox.d.ts +11 -0
- package/scb-checkbox/scb-checkbox.js +78 -56
- package/scb-chip/scb-chip.d.ts +24 -0
- package/scb-chip/scb-chip.js +137 -65
- package/scb-divider/scb-divider.d.ts +14 -0
- package/scb-divider/scb-divider.js +91 -43
- package/scb-fact-card/scb-fact-card.d.ts +10 -0
- package/scb-fact-card/scb-fact-card.js +135 -94
- package/scb-horizontal-scroller/scb-horizontal-scroller.d.ts +10 -0
- package/scb-horizontal-scroller/scb-horizontal-scroller.js +179 -120
- package/scb-icon-button/scb-icon-button.d.ts +10 -1
- package/scb-icon-button/scb-icon-button.js +88 -59
- package/scb-keyfigure-card/scb-keyfigure-card.d.ts +10 -0
- package/scb-keyfigure-card/scb-keyfigure-card.js +76 -52
- package/scb-list/scb-list.d.ts +7 -1
- package/scb-list/scb-list.js +62 -40
- package/scb-notification-card/scb-notification-card.d.ts +5 -0
- package/scb-notification-card/scb-notification-card.js +56 -39
- package/scb-pagination/scb-pagination.d.ts +12 -1
- package/scb-pagination/scb-pagination.js +235 -147
- package/scb-radio-button/scb-radio-group.d.ts +14 -3
- package/scb-radio-button/scb-radio-group.js +120 -67
- package/scb-search/scb-search.d.ts +15 -2
- package/scb-search/scb-search.js +152 -69
- package/scb-segmented-button/scb-segmented-button.d.ts +45 -4
- package/scb-segmented-button/scb-segmented-button.js +163 -72
- package/scb-status-pill/scb-status-pill.d.ts +12 -1
- package/scb-status-pill/scb-status-pill.js +51 -27
- package/scb-stepper/scb-stepper.d.ts +11 -3
- package/scb-stepper/scb-stepper.js +134 -101
- package/scb-switch/scb-switch.d.ts +21 -2
- package/scb-switch/scb-switch.js +97 -45
- package/scb-tabs/scb-tabs.d.ts +8 -0
- package/scb-tabs/scb-tabs.js +74 -44
- package/scb-textfield/scb-textfield.d.ts +7 -0
- package/scb-textfield/scb-textfield.js +43 -16
- package/scb-toc/scb-toc.d.ts +10 -1
- package/scb-toc/scb-toc.js +49 -18
- package/scb-viz/scb-viz.d.ts +10 -3
- package/scb-viz/scb-viz.js +278 -236
- package/scb-wc-test.bundle.js +1184 -901
package/scb-card/scb-card.js
CHANGED
|
@@ -1,41 +1,43 @@
|
|
|
1
|
-
import { css as
|
|
2
|
-
import { property as
|
|
1
|
+
import { css as v, LitElement as y, html as s } from "lit";
|
|
2
|
+
import { property as r, customElement as f } from "lit/decorators.js";
|
|
3
3
|
import "@material/web/focus/md-focus-ring.js";
|
|
4
4
|
import "../scb-list/scb-list.js";
|
|
5
5
|
import "../scb-button/scb-button.js";
|
|
6
6
|
import "../scb-link/scb-link.js";
|
|
7
7
|
import "../scb-avatar/scb-avatar.js";
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
var x = Object.defineProperty, $ = Object.getOwnPropertyDescriptor, b = (i) => {
|
|
9
|
+
throw TypeError(i);
|
|
10
|
+
}, a = (i, e, o, n) => {
|
|
11
|
+
for (var c = n > 1 ? void 0 : n ? $(e, o) : e, d = i.length - 1, l; d >= 0; d--)
|
|
12
|
+
(l = i[d]) && (c = (n ? l(e, o, c) : l(c)) || c);
|
|
13
|
+
return n && c && x(e, o, c), c;
|
|
14
|
+
}, z = (i, e, o) => e.has(i) || b("Cannot " + o), w = (i, e, o) => e.has(i) ? b("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(i) : e.set(i, o), u = (i, e, o) => (z(i, e, "access private method"), o), h, m;
|
|
15
|
+
let t = class extends y {
|
|
14
16
|
constructor() {
|
|
15
|
-
super(...arguments), 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.likesText = "", this.likes = 0, this.sizing = "stretch", this.width = "", this.maxWidth = "", this.height = "", this.maxHeight = "", this.__onImgLoad = (
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
}, this.__onKeyDown = (
|
|
19
|
-
(
|
|
20
|
-
}, this.__handleHrefNavigation = (
|
|
21
|
-
this.cardHref && (
|
|
17
|
+
super(...arguments), w(this, h), 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.likesText = "", this.likes = 0, this.sizing = "stretch", this.width = "", this.maxWidth = "", this.height = "", this.maxHeight = "", this.spacing = "", this.spacingTop = "", this.spacingBottom = "", this.__onImgLoad = (i) => {
|
|
18
|
+
const e = i.currentTarget.closest(".media");
|
|
19
|
+
e && e.classList.add("is-loaded");
|
|
20
|
+
}, this.__onKeyDown = (i) => {
|
|
21
|
+
(i.key === "Enter" || i.key === " ") && this.cardHref && (i.preventDefault(), window.open(this.cardHref, "_self"));
|
|
22
|
+
}, this.__handleHrefNavigation = (i) => {
|
|
23
|
+
this.cardHref && (i.target.closest("a") || window.open(this.cardHref, "_self"));
|
|
22
24
|
};
|
|
23
25
|
}
|
|
24
26
|
/* Beräkna fallback-mått från media-aspect. Används endast om width/height saknas. */
|
|
25
|
-
__calcAspectWH(
|
|
26
|
-
const
|
|
27
|
-
if (!
|
|
28
|
-
const
|
|
29
|
-
if (
|
|
30
|
-
const
|
|
31
|
-
if (
|
|
32
|
-
}
|
|
33
|
-
const
|
|
34
|
-
return isFinite(
|
|
27
|
+
__calcAspectWH(i) {
|
|
28
|
+
const e = (i || "").trim();
|
|
29
|
+
if (!e) return { w: 640, h: 360 };
|
|
30
|
+
const o = e.includes("/") ? e.split("/") : e.includes(":") ? e.split(":") : e.includes("x") ? e.split("x") : null;
|
|
31
|
+
if (o && o.length === 2) {
|
|
32
|
+
const c = Number(o[0]), d = Number(o[1]);
|
|
33
|
+
if (c > 0 && d > 0) return { w: c, h: d };
|
|
34
|
+
}
|
|
35
|
+
const n = Number(e);
|
|
36
|
+
return isFinite(n) && n > 0 ? { w: 1e3, h: Math.round(1e3 / n) } : { w: 640, h: 360 };
|
|
35
37
|
}
|
|
36
38
|
__mediaTemplate() {
|
|
37
39
|
if ((this.mediaType || "").toLowerCase() === "avatar")
|
|
38
|
-
return
|
|
40
|
+
return s`
|
|
39
41
|
<div class="media">
|
|
40
42
|
<slot name="media">
|
|
41
43
|
<scb-avatar variant="icon" label="${this.title}" icon-name="person"></scb-avatar>
|
|
@@ -43,15 +45,15 @@ let t = class extends u {
|
|
|
43
45
|
</div>
|
|
44
46
|
`;
|
|
45
47
|
if (this.mediaHref || this.mediaSrcset) {
|
|
46
|
-
let
|
|
47
|
-
const
|
|
48
|
-
if (!
|
|
49
|
-
const
|
|
50
|
-
|
|
48
|
+
let e = Number(this.mediaWidth) || 0, o = Number(this.mediaHeight) || 0;
|
|
49
|
+
const n = (this.mediaAspect || "").trim();
|
|
50
|
+
if (!e || !o) {
|
|
51
|
+
const g = this.__calcAspectWH(n || "16/9");
|
|
52
|
+
e || (e = g.w), o || (o = g.h);
|
|
51
53
|
}
|
|
52
|
-
const
|
|
53
|
-
return
|
|
54
|
-
<div class="media ${d}" style="${
|
|
54
|
+
const c = `aspect-ratio:${n || `${e}/${o}`};`, d = this.mediaPlaceholder ? "has-ph" : "", l = this.mediaFit || "cover", p = this.mediaPosition || "center";
|
|
55
|
+
return s`
|
|
56
|
+
<div class="media ${d}" style="${c}">
|
|
55
57
|
<slot name="media-sources"></slot>
|
|
56
58
|
<img
|
|
57
59
|
src="${this.mediaHref || ""}"
|
|
@@ -61,9 +63,9 @@ let t = class extends u {
|
|
|
61
63
|
loading="${this.mediaLoading}"
|
|
62
64
|
decoding="${this.mediaDecoding}"
|
|
63
65
|
fetchpriority="${this.mediaFetchPriority}"
|
|
64
|
-
style="object-fit:${
|
|
65
|
-
width="${
|
|
66
|
-
height="${
|
|
66
|
+
style="object-fit:${l};object-position:${p};"
|
|
67
|
+
width="${e}"
|
|
68
|
+
height="${o}"
|
|
67
69
|
@load=${this.__onImgLoad}
|
|
68
70
|
/>
|
|
69
71
|
</div>
|
|
@@ -71,12 +73,18 @@ let t = class extends u {
|
|
|
71
73
|
}
|
|
72
74
|
return null;
|
|
73
75
|
}
|
|
76
|
+
mapSpacingToken(i) {
|
|
77
|
+
if (!i) return;
|
|
78
|
+
const e = String(i).trim();
|
|
79
|
+
if (e)
|
|
80
|
+
return /^\d+$/.test(e) ? `var(--spacing-${Math.max(0, Math.min(14, parseInt(e, 10)))})` : e;
|
|
81
|
+
}
|
|
74
82
|
render() {
|
|
75
|
-
const
|
|
83
|
+
const i = this.variant ? `${this.variant.toLowerCase()}` : "", e = 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 = (p = !1) => p ? s`<a class="title" href="${this.cardHref}" tabindex="0"
|
|
76
84
|
>${this.title}</a
|
|
77
|
-
><md-icon>arrow_forward</md-icon>` :
|
|
85
|
+
><md-icon>arrow_forward</md-icon>` : s`<span class="title">${this.title}</span>`, d = () => this.__mediaTemplate(), l = (p) => s`
|
|
78
86
|
<div
|
|
79
|
-
class="scb-card ${
|
|
87
|
+
class="scb-card ${i} ${e} ${o}"
|
|
80
88
|
@click=${this.cardHref ? this.__handleHrefNavigation : null}
|
|
81
89
|
@keydown=${this.cardHref ? this.__onKeyDown : null}
|
|
82
90
|
style="cursor:${this.cardHref ? "pointer" : "default"};"
|
|
@@ -84,7 +92,7 @@ let t = class extends u {
|
|
|
84
92
|
tabindex=${this.cardHref ? "0" : "-1"}
|
|
85
93
|
aria-label=${this.title || "Kort"}
|
|
86
94
|
>
|
|
87
|
-
${this.cardHref ?
|
|
95
|
+
${this.cardHref ? s`<md-ripple></md-ripple>` : ""}
|
|
88
96
|
${d()}
|
|
89
97
|
${p}
|
|
90
98
|
</div>
|
|
@@ -92,24 +100,24 @@ let t = class extends u {
|
|
|
92
100
|
`;
|
|
93
101
|
switch (this.type) {
|
|
94
102
|
case "standard":
|
|
95
|
-
return
|
|
103
|
+
return l(s`
|
|
96
104
|
<div class="full-content">
|
|
97
105
|
<div class="top-content">
|
|
98
|
-
${this.title ?
|
|
99
|
-
${this.subtitle ?
|
|
100
|
-
${this.supportingText ?
|
|
101
|
-
${
|
|
106
|
+
${this.title ? s`<div class="header">${c(!!this.cardHref)}</div>` : ""}
|
|
107
|
+
${this.subtitle ? s`<div class="sub-label">${this.subtitle}</div>` : ""}
|
|
108
|
+
${this.supportingText ? s`<div class="supporting-text">${this.supportingText}</div>` : ""}
|
|
109
|
+
${n ? s`<div class="date">${n}</div>` : ""}
|
|
102
110
|
</div>
|
|
103
111
|
</div>
|
|
104
112
|
`);
|
|
105
113
|
case "list":
|
|
106
|
-
return
|
|
114
|
+
return l(s`
|
|
107
115
|
<div class="full-content">
|
|
108
116
|
<div class="top-content">
|
|
109
|
-
${this.title ?
|
|
110
|
-
${this.subtitle ?
|
|
111
|
-
${this.supportingText ?
|
|
112
|
-
${
|
|
117
|
+
${this.title ? s`<div class="header"><span class="title">${this.title}</span></div>` : ""}
|
|
118
|
+
${this.subtitle ? s`<div class="sub-label">${this.subtitle}</div>` : ""}
|
|
119
|
+
${this.supportingText ? s`<div class="supporting-text">${this.supportingText}</div>` : ""}
|
|
120
|
+
${n ? s`<div class="date">${n}</div>` : ""}
|
|
113
121
|
</div>
|
|
114
122
|
<div class="content list">
|
|
115
123
|
<slot></slot>
|
|
@@ -117,13 +125,13 @@ let t = class extends u {
|
|
|
117
125
|
</div>
|
|
118
126
|
`);
|
|
119
127
|
case "social":
|
|
120
|
-
return
|
|
128
|
+
return l(s`
|
|
121
129
|
<div class="full-content">
|
|
122
130
|
<div class="top-content">
|
|
123
|
-
${this.title ?
|
|
124
|
-
${this.subtitle ?
|
|
125
|
-
${this.supportingText ?
|
|
126
|
-
${
|
|
131
|
+
${this.title ? s`<div class="header">${c(!!this.cardHref)}</div>` : ""}
|
|
132
|
+
${this.subtitle ? s`<div class="sub-label">${this.subtitle}</div>` : ""}
|
|
133
|
+
${this.supportingText ? s`<div class="supporting-text">${this.supportingText}</div>` : ""}
|
|
134
|
+
${n ? s`<div class="date">${n}</div>` : ""}
|
|
127
135
|
</div>
|
|
128
136
|
<div class="content">
|
|
129
137
|
<div class="social-metrics">
|
|
@@ -140,13 +148,13 @@ let t = class extends u {
|
|
|
140
148
|
</div>
|
|
141
149
|
`);
|
|
142
150
|
case "link":
|
|
143
|
-
return
|
|
151
|
+
return l(s`
|
|
144
152
|
<div class="full-content">
|
|
145
153
|
<div class="top-content">
|
|
146
|
-
${this.title ?
|
|
147
|
-
${this.subtitle ?
|
|
148
|
-
${this.supportingText ?
|
|
149
|
-
${
|
|
154
|
+
${this.title ? s`<div class="header"><span class="title">${this.title}</span></div>` : ""}
|
|
155
|
+
${this.subtitle ? s`<div class="sub-label">${this.subtitle}</div>` : ""}
|
|
156
|
+
${this.supportingText ? s`<div class="supporting-text">${this.supportingText}</div>` : ""}
|
|
157
|
+
${n ? s`<div class="date">${n}</div>` : ""}
|
|
150
158
|
</div>
|
|
151
159
|
<div class="content links">
|
|
152
160
|
<slot></slot>
|
|
@@ -154,13 +162,13 @@ let t = class extends u {
|
|
|
154
162
|
</div>
|
|
155
163
|
`);
|
|
156
164
|
case "action":
|
|
157
|
-
return
|
|
165
|
+
return l(s`
|
|
158
166
|
<div class="full-content">
|
|
159
167
|
<div class="top-content">
|
|
160
|
-
${this.title ?
|
|
161
|
-
${this.subtitle ?
|
|
162
|
-
${this.supportingText ?
|
|
163
|
-
${
|
|
168
|
+
${this.title ? s`<div class="header"><span class="title">${this.title}</span></div>` : ""}
|
|
169
|
+
${this.subtitle ? s`<div class="sub-label">${this.subtitle}</div>` : ""}
|
|
170
|
+
${this.supportingText ? s`<div class="supporting-text">${this.supportingText}</div>` : ""}
|
|
171
|
+
${n ? s`<div class="date">${n}</div>` : ""}
|
|
164
172
|
</div>
|
|
165
173
|
<div class="content actions">
|
|
166
174
|
<slot></slot>
|
|
@@ -168,28 +176,33 @@ let t = class extends u {
|
|
|
168
176
|
</div>
|
|
169
177
|
`);
|
|
170
178
|
default:
|
|
171
|
-
return
|
|
179
|
+
return l(s`
|
|
172
180
|
<div class="full-content">
|
|
173
181
|
<div class="top-content">
|
|
174
|
-
${this.title ?
|
|
175
|
-
${this.subtitle ?
|
|
176
|
-
${this.supportingText ?
|
|
177
|
-
${
|
|
182
|
+
${this.title ? s`<div class="header">${c(!!this.cardHref)}</div>` : ""}
|
|
183
|
+
${this.subtitle ? s`<div class="sub-label">${this.subtitle}</div>` : ""}
|
|
184
|
+
${this.supportingText ? s`<div class="supporting-text">${this.supportingText}</div>` : ""}
|
|
185
|
+
${n ? s`<div class="date">${n}</div>` : ""}
|
|
178
186
|
</div>
|
|
179
187
|
</div>
|
|
180
188
|
`);
|
|
181
189
|
}
|
|
182
190
|
}
|
|
183
|
-
updated(
|
|
184
|
-
super.updated(
|
|
191
|
+
updated(i) {
|
|
192
|
+
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")) && u(this, h, m).call(this);
|
|
185
193
|
}
|
|
186
|
-
async firstUpdated(
|
|
187
|
-
t.__iconLoaded || (await import("@material/web/icon/icon.js"), t.__iconLoaded = !0), t.__rippleLoaded || (await import("@material/web/ripple/ripple.js"), t.__rippleLoaded = !0);
|
|
194
|
+
async firstUpdated(i) {
|
|
195
|
+
t.__iconLoaded || (await import("@material/web/icon/icon.js"), t.__iconLoaded = !0), t.__rippleLoaded || (await import("@material/web/ripple/ripple.js"), t.__rippleLoaded = !0), u(this, h, m).call(this);
|
|
188
196
|
}
|
|
189
197
|
};
|
|
198
|
+
h = /* @__PURE__ */ new WeakSet();
|
|
199
|
+
m = function() {
|
|
200
|
+
const i = this.mapSpacingToken(this.spacing), e = this.mapSpacingToken(this.spacingTop) ?? i, o = this.mapSpacingToken(this.spacingBottom) ?? i;
|
|
201
|
+
e ? this.style.setProperty("--scb-card-spacing-block-start", e) : 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");
|
|
202
|
+
};
|
|
190
203
|
t.__iconLoaded = !1;
|
|
191
204
|
t.__rippleLoaded = !1;
|
|
192
|
-
t.styles =
|
|
205
|
+
t.styles = v`
|
|
193
206
|
:host {
|
|
194
207
|
display: block;
|
|
195
208
|
box-sizing: border-box;
|
|
@@ -202,6 +215,9 @@ t.styles = m`
|
|
|
202
215
|
--scb-card-horizontal-media-max: 176px;
|
|
203
216
|
--scb-card-horizontal-media-min: 96px;
|
|
204
217
|
--scb-card-horizontal-media-aspect: 16 / 9;
|
|
218
|
+
|
|
219
|
+
margin-block-start: var(--scb-card-spacing-block-start, 0);
|
|
220
|
+
margin-block-end: var(--scb-card-spacing-block-end, 0);
|
|
205
221
|
}
|
|
206
222
|
:host([type='standard']) {
|
|
207
223
|
--scb-card-max-w: var(--scb-card-standard-max-w);
|
|
@@ -492,101 +508,110 @@ t.styles = m`
|
|
|
492
508
|
--scb-list-bg: var(--md-sys-color-surface-dim);
|
|
493
509
|
}
|
|
494
510
|
`;
|
|
495
|
-
|
|
496
|
-
|
|
511
|
+
a([
|
|
512
|
+
r({ type: String, reflect: !0 })
|
|
497
513
|
], t.prototype, "type", 2);
|
|
498
|
-
|
|
499
|
-
|
|
514
|
+
a([
|
|
515
|
+
r({ type: String, reflect: !0 })
|
|
500
516
|
], t.prototype, "variant", 2);
|
|
501
|
-
|
|
502
|
-
|
|
517
|
+
a([
|
|
518
|
+
r({ type: String, reflect: !0 })
|
|
503
519
|
], t.prototype, "direction", 2);
|
|
504
|
-
|
|
505
|
-
|
|
520
|
+
a([
|
|
521
|
+
r({ type: String, attribute: "media-type" })
|
|
506
522
|
], t.prototype, "mediaType", 2);
|
|
507
|
-
|
|
508
|
-
|
|
523
|
+
a([
|
|
524
|
+
r({ type: String, attribute: "media-href" })
|
|
509
525
|
], t.prototype, "mediaHref", 2);
|
|
510
|
-
|
|
511
|
-
|
|
526
|
+
a([
|
|
527
|
+
r({ type: String, attribute: "media-alt" })
|
|
512
528
|
], t.prototype, "mediaAlt", 2);
|
|
513
|
-
|
|
514
|
-
|
|
529
|
+
a([
|
|
530
|
+
r({ type: String, attribute: "media-srcset" })
|
|
515
531
|
], t.prototype, "mediaSrcset", 2);
|
|
516
|
-
|
|
517
|
-
|
|
532
|
+
a([
|
|
533
|
+
r({ type: String, attribute: "media-sizes" })
|
|
518
534
|
], t.prototype, "mediaSizes", 2);
|
|
519
|
-
|
|
520
|
-
|
|
535
|
+
a([
|
|
536
|
+
r({ type: String, attribute: "media-loading" })
|
|
521
537
|
], t.prototype, "mediaLoading", 2);
|
|
522
|
-
|
|
523
|
-
|
|
538
|
+
a([
|
|
539
|
+
r({ type: String, attribute: "media-decoding" })
|
|
524
540
|
], t.prototype, "mediaDecoding", 2);
|
|
525
|
-
|
|
526
|
-
|
|
541
|
+
a([
|
|
542
|
+
r({ type: String, attribute: "media-fetchpriority" })
|
|
527
543
|
], t.prototype, "mediaFetchPriority", 2);
|
|
528
|
-
|
|
529
|
-
|
|
544
|
+
a([
|
|
545
|
+
r({ type: String, attribute: "media-fit" })
|
|
530
546
|
], t.prototype, "mediaFit", 2);
|
|
531
|
-
|
|
532
|
-
|
|
547
|
+
a([
|
|
548
|
+
r({ type: String, attribute: "media-position" })
|
|
533
549
|
], t.prototype, "mediaPosition", 2);
|
|
534
|
-
|
|
535
|
-
|
|
550
|
+
a([
|
|
551
|
+
r({ type: String, attribute: "media-width" })
|
|
536
552
|
], t.prototype, "mediaWidth", 2);
|
|
537
|
-
|
|
538
|
-
|
|
553
|
+
a([
|
|
554
|
+
r({ type: String, attribute: "media-height" })
|
|
539
555
|
], t.prototype, "mediaHeight", 2);
|
|
540
|
-
|
|
541
|
-
|
|
556
|
+
a([
|
|
557
|
+
r({ type: String, attribute: "media-aspect" })
|
|
542
558
|
], t.prototype, "mediaAspect", 2);
|
|
543
|
-
|
|
544
|
-
|
|
559
|
+
a([
|
|
560
|
+
r({ type: Boolean, attribute: "media-placeholder" })
|
|
545
561
|
], t.prototype, "mediaPlaceholder", 2);
|
|
546
|
-
|
|
547
|
-
|
|
562
|
+
a([
|
|
563
|
+
r({ type: String, attribute: "card-href", reflect: !0 })
|
|
548
564
|
], t.prototype, "cardHref", 2);
|
|
549
|
-
|
|
550
|
-
|
|
565
|
+
a([
|
|
566
|
+
r({ type: String, reflect: !0 })
|
|
551
567
|
], t.prototype, "title", 2);
|
|
552
|
-
|
|
553
|
-
|
|
568
|
+
a([
|
|
569
|
+
r({ type: String, reflect: !0 })
|
|
554
570
|
], t.prototype, "subtitle", 2);
|
|
555
|
-
|
|
556
|
-
|
|
571
|
+
a([
|
|
572
|
+
r({ type: String, attribute: "supporting-text", reflect: !0 })
|
|
557
573
|
], t.prototype, "supportingText", 2);
|
|
558
|
-
|
|
559
|
-
|
|
574
|
+
a([
|
|
575
|
+
r({ type: Date, reflect: !0 })
|
|
560
576
|
], t.prototype, "date", 2);
|
|
561
|
-
|
|
562
|
-
|
|
577
|
+
a([
|
|
578
|
+
r({ type: String, attribute: "social-comments-text", reflect: !0 })
|
|
563
579
|
], t.prototype, "commentsText", 2);
|
|
564
|
-
|
|
565
|
-
|
|
580
|
+
a([
|
|
581
|
+
r({ type: Number, attribute: "social-comments", reflect: !0 })
|
|
566
582
|
], t.prototype, "comments", 2);
|
|
567
|
-
|
|
568
|
-
|
|
583
|
+
a([
|
|
584
|
+
r({ type: String, attribute: "social-likes-text", reflect: !0 })
|
|
569
585
|
], t.prototype, "likesText", 2);
|
|
570
|
-
|
|
571
|
-
|
|
586
|
+
a([
|
|
587
|
+
r({ type: Number, attribute: "social-likes", reflect: !0 })
|
|
572
588
|
], t.prototype, "likes", 2);
|
|
573
|
-
|
|
574
|
-
|
|
589
|
+
a([
|
|
590
|
+
r({ type: String, reflect: !0 })
|
|
575
591
|
], t.prototype, "sizing", 2);
|
|
576
|
-
|
|
577
|
-
|
|
592
|
+
a([
|
|
593
|
+
r({ type: String, reflect: !0 })
|
|
578
594
|
], t.prototype, "width", 2);
|
|
579
|
-
|
|
580
|
-
|
|
595
|
+
a([
|
|
596
|
+
r({ type: String, reflect: !0, attribute: "max-width" })
|
|
581
597
|
], t.prototype, "maxWidth", 2);
|
|
582
|
-
|
|
583
|
-
|
|
598
|
+
a([
|
|
599
|
+
r({ type: String, reflect: !0 })
|
|
584
600
|
], t.prototype, "height", 2);
|
|
585
|
-
|
|
586
|
-
|
|
601
|
+
a([
|
|
602
|
+
r({ type: String, reflect: !0, attribute: "max-height" })
|
|
587
603
|
], t.prototype, "maxHeight", 2);
|
|
588
|
-
|
|
589
|
-
|
|
604
|
+
a([
|
|
605
|
+
r({ type: String, reflect: !0 })
|
|
606
|
+
], t.prototype, "spacing", 2);
|
|
607
|
+
a([
|
|
608
|
+
r({ type: String, attribute: "spacing-top", reflect: !0 })
|
|
609
|
+
], t.prototype, "spacingTop", 2);
|
|
610
|
+
a([
|
|
611
|
+
r({ type: String, attribute: "spacing-bottom", reflect: !0 })
|
|
612
|
+
], t.prototype, "spacingBottom", 2);
|
|
613
|
+
t = a([
|
|
614
|
+
f("scb-card")
|
|
590
615
|
], t);
|
|
591
616
|
export {
|
|
592
617
|
t as ScbCard
|
|
@@ -3,7 +3,9 @@ export declare class ScbCheckboxGroup extends LitElement {
|
|
|
3
3
|
#private;
|
|
4
4
|
orientation: 'vertical' | 'horizontal';
|
|
5
5
|
disabled: boolean;
|
|
6
|
-
spacing:
|
|
6
|
+
spacing: string;
|
|
7
|
+
spacingTop: string;
|
|
8
|
+
spacingBottom: string;
|
|
7
9
|
static styles: import('lit').CSSResult;
|
|
8
10
|
render(): import('lit-html').TemplateResult<1>;
|
|
9
11
|
firstUpdated(): void;
|
|
@@ -1,76 +1,95 @@
|
|
|
1
|
-
import { css as
|
|
2
|
-
import { property as
|
|
3
|
-
var
|
|
1
|
+
import { css as k, LitElement as y, html as x } from "lit";
|
|
2
|
+
import { property as l, customElement as _ } from "lit/decorators.js";
|
|
3
|
+
var S = Object.defineProperty, C = Object.getOwnPropertyDescriptor, v = (t) => {
|
|
4
4
|
throw TypeError(t);
|
|
5
|
-
}, c = (t, e,
|
|
6
|
-
for (var o =
|
|
7
|
-
(
|
|
8
|
-
return
|
|
9
|
-
},
|
|
10
|
-
let
|
|
5
|
+
}, c = (t, e, s, i) => {
|
|
6
|
+
for (var o = i > 1 ? void 0 : i ? C(e, s) : e, g = t.length - 1, b; g >= 0; g--)
|
|
7
|
+
(b = t[g]) && (o = (i ? b(e, s, o) : b(o)) || o);
|
|
8
|
+
return i && o && S(e, s, o), o;
|
|
9
|
+
}, m = (t, e, s) => e.has(t) || v("Cannot " + s), d = (t, e, s) => (m(t, e, "read from private field"), s ? s.call(t) : e.get(t)), f = (t, e, s) => e.has(t) ? v("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, s), p = (t, e, s) => (m(t, e, "access private method"), s), n, a, u, h;
|
|
10
|
+
let r = class extends y {
|
|
11
11
|
constructor() {
|
|
12
|
-
super(...arguments), this.orientation = "vertical", this.disabled = !1, this.spacing = "
|
|
13
|
-
var
|
|
14
|
-
const t = (
|
|
12
|
+
super(...arguments), f(this, a), this.orientation = "vertical", this.disabled = !1, this.spacing = "", this.spacingTop = "", this.spacingBottom = "", f(this, n, () => {
|
|
13
|
+
var s;
|
|
14
|
+
const t = (s = this.shadowRoot) == null ? void 0 : s.querySelector("slot");
|
|
15
15
|
if (!t) return;
|
|
16
|
-
const e = t.assignedElements({ flatten: !0 }).filter((
|
|
17
|
-
for (const
|
|
18
|
-
this.disabled ?
|
|
16
|
+
const e = t.assignedElements({ flatten: !0 }).filter((i) => i.tagName.toLowerCase() === "scb-checkbox");
|
|
17
|
+
for (const i of e)
|
|
18
|
+
this.disabled ? i.setAttribute("disabled", "") : i.removeAttribute("disabled"), this.orientation === "horizontal" ? i.setAttribute("orientation", "horizontal") : i.removeAttribute("orientation");
|
|
19
19
|
});
|
|
20
20
|
}
|
|
21
21
|
render() {
|
|
22
22
|
const t = this.orientation === "horizontal" ? "row" : "column";
|
|
23
|
-
return
|
|
23
|
+
return x`
|
|
24
24
|
<div class="g" role="group" aria-disabled=${String(this.disabled)} style=${`--_dir:${t}`}>
|
|
25
|
-
<slot @slotchange=${
|
|
25
|
+
<slot @slotchange=${d(this, n)}></slot>
|
|
26
26
|
</div>
|
|
27
27
|
`;
|
|
28
28
|
}
|
|
29
29
|
firstUpdated() {
|
|
30
|
-
p(this,
|
|
30
|
+
p(this, a, u).call(this), d(this, n).call(this);
|
|
31
31
|
}
|
|
32
32
|
updated(t) {
|
|
33
|
-
(t.has("
|
|
33
|
+
(t.has("spacing") || t.has("spacingTop") || t.has("spacingBottom")) && p(this, a, u).call(this), (t.has("disabled") || t.has("orientation")) && d(this, n).call(this);
|
|
34
34
|
}
|
|
35
35
|
};
|
|
36
|
-
|
|
37
|
-
a
|
|
36
|
+
n = /* @__PURE__ */ new WeakMap();
|
|
37
|
+
a = /* @__PURE__ */ new WeakSet();
|
|
38
|
+
u = function() {
|
|
39
|
+
const t = p(this, a, h).call(this, this.spacing), e = p(this, a, h).call(this, this.spacingTop) ?? t, s = p(this, a, h).call(this, this.spacingBottom) ?? t;
|
|
40
|
+
e ? this.style.setProperty("--scb-checkbox-group-spacing-block-start", e) : this.style.removeProperty("--scb-checkbox-group-spacing-block-start"), s ? this.style.setProperty("--scb-checkbox-group-spacing-block-end", s) : this.style.removeProperty("--scb-checkbox-group-spacing-block-end");
|
|
41
|
+
};
|
|
42
|
+
h = function(t) {
|
|
43
|
+
if (!t) return;
|
|
44
|
+
const e = String(t).trim();
|
|
45
|
+
if (e)
|
|
46
|
+
return /^\d+$/.test(e) ? `var(--spacing-${Math.max(0, Math.min(14, parseInt(e, 10)))})` : e;
|
|
47
|
+
};
|
|
48
|
+
r.styles = k`
|
|
38
49
|
:host {
|
|
39
50
|
display: block;
|
|
51
|
+
/* Vertikal standard-spacing mellan items i gruppen */
|
|
40
52
|
--scb-checkbox-gap: var(--spacing-4, 12px);
|
|
53
|
+
|
|
54
|
+
margin-block-start: var(--scb-checkbox-group-spacing-block-start, 0);
|
|
55
|
+
margin-block-end: var(--scb-checkbox-group-spacing-block-end, 0);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/* Horisontell standard-spacing mellan items om spacing för gruppen inte overrideas via CSS-variabel */
|
|
59
|
+
:host([orientation='horizontal']) {
|
|
60
|
+
--scb-checkbox-gap: var(--spacing-8, 32px);
|
|
41
61
|
}
|
|
42
62
|
|
|
43
63
|
.g {
|
|
44
64
|
display: flex;
|
|
45
65
|
flex-direction: var(--_dir, column);
|
|
46
66
|
align-items: flex-start;
|
|
47
|
-
gap: 0;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
:host([spacing='group']) .g {
|
|
51
67
|
gap: var(--scb-checkbox-gap);
|
|
52
68
|
}
|
|
53
69
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
:host([spacing='group']) ::slotted(scb-checkbox) {
|
|
70
|
+
/* När checkboxar ligger i en grupp ska spacing ägas av gruppen, inte av enskilda items */
|
|
71
|
+
::slotted(scb-checkbox) {
|
|
59
72
|
--scb-checkbox-gap: 0;
|
|
60
73
|
}
|
|
61
74
|
`;
|
|
62
75
|
c([
|
|
63
|
-
|
|
64
|
-
],
|
|
76
|
+
l({ type: String, reflect: !0 })
|
|
77
|
+
], r.prototype, "orientation", 2);
|
|
78
|
+
c([
|
|
79
|
+
l({ type: Boolean, reflect: !0 })
|
|
80
|
+
], r.prototype, "disabled", 2);
|
|
81
|
+
c([
|
|
82
|
+
l({ type: String, reflect: !0 })
|
|
83
|
+
], r.prototype, "spacing", 2);
|
|
65
84
|
c([
|
|
66
|
-
|
|
67
|
-
],
|
|
85
|
+
l({ type: String, attribute: "spacing-top", reflect: !0 })
|
|
86
|
+
], r.prototype, "spacingTop", 2);
|
|
68
87
|
c([
|
|
69
|
-
|
|
70
|
-
],
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
],
|
|
88
|
+
l({ type: String, attribute: "spacing-bottom", reflect: !0 })
|
|
89
|
+
], r.prototype, "spacingBottom", 2);
|
|
90
|
+
r = c([
|
|
91
|
+
_("scb-checkbox-group")
|
|
92
|
+
], r);
|
|
74
93
|
export {
|
|
75
|
-
|
|
94
|
+
r as ScbCheckboxGroup
|
|
76
95
|
};
|
|
@@ -1,16 +1,27 @@
|
|
|
1
1
|
import { LitElement, TemplateResult, PropertyValues } from 'lit';
|
|
2
2
|
export declare class ScbCheckbox extends LitElement {
|
|
3
|
+
static formAssociated: boolean;
|
|
4
|
+
private _internals;
|
|
5
|
+
constructor();
|
|
3
6
|
disabled: boolean;
|
|
4
7
|
indeterminate: boolean;
|
|
5
8
|
checked: boolean;
|
|
6
9
|
label: string;
|
|
7
10
|
supportingText: string;
|
|
8
11
|
ariaLabel: string;
|
|
12
|
+
name: string;
|
|
13
|
+
value: string;
|
|
14
|
+
private _form;
|
|
15
|
+
private _formResetHandler;
|
|
16
|
+
private _initialChecked;
|
|
9
17
|
private _checkboxId;
|
|
10
18
|
connectedCallback(): void;
|
|
19
|
+
disconnectedCallback(): void;
|
|
11
20
|
protected firstUpdated(): void;
|
|
12
21
|
protected updated(changed: PropertyValues): void;
|
|
22
|
+
formDisabledCallback(disabled: boolean): void;
|
|
13
23
|
private __syncInnerAria;
|
|
24
|
+
private __syncFormValue;
|
|
14
25
|
static styles: import('lit').CSSResult;
|
|
15
26
|
render(): TemplateResult;
|
|
16
27
|
}
|