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-button/scb-button.js
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
1
|
-
import { LitElement as
|
|
2
|
-
import { property as s, customElement as
|
|
1
|
+
import { LitElement as k, css as T, html as p, nothing as r } from "lit";
|
|
2
|
+
import { property as s, customElement as B } from "lit/decorators.js";
|
|
3
3
|
import "@material/web/button/filled-button.js";
|
|
4
4
|
import "@material/web/button/outlined-button.js";
|
|
5
5
|
import "@material/web/button/filled-tonal-button.js";
|
|
6
6
|
import "@material/web/button/text-button.js";
|
|
7
7
|
import "@material/web/icon/icon.js";
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
var O = Object.defineProperty, w = Object.getOwnPropertyDescriptor, x = (t) => {
|
|
9
|
+
throw TypeError(t);
|
|
10
|
+
}, a = (t, e, i, l) => {
|
|
11
|
+
for (var n = l > 1 ? void 0 : l ? w(e, i) : e, b = t.length - 1, u; b >= 0; b--)
|
|
12
|
+
(u = t[b]) && (n = (l ? u(e, i, n) : u(n)) || n);
|
|
13
|
+
return l && n && O(e, i, n), n;
|
|
14
|
+
}, L = (t, e, i) => e.has(t) || x("Cannot " + i), P = (t, e, i) => e.has(t) ? x("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, i), A = (t, e, i) => (L(t, e, "access private method"), i), m, g;
|
|
15
|
+
let o = class extends k {
|
|
14
16
|
constructor() {
|
|
15
|
-
super(...arguments), this.variant = "filled", this.type = "button", this.label = "Button", this.trailingIcon = !1, this.icon = "", this.disabled = !1, this.href = "", this.target = "", this.rel = "";
|
|
17
|
+
super(...arguments), P(this, m), this.variant = "filled", this.type = "button", this.label = "Button", this.trailingIcon = !1, this.icon = "", this.disabled = !1, this.href = "", this.target = "", this.rel = "", this.spacing = "", this.spacingTop = "", this.spacingBottom = "";
|
|
16
18
|
}
|
|
17
19
|
// Hosta md-* elementet (värden flyttas därifrån in i dess shadow <button>)
|
|
18
20
|
__getMdHost() {
|
|
@@ -27,26 +29,26 @@ let a = class extends _ {
|
|
|
27
29
|
}
|
|
28
30
|
// Spegla aria-attribut från host/md-host -> inre native <button>
|
|
29
31
|
__syncAriaToInner() {
|
|
30
|
-
var
|
|
32
|
+
var $;
|
|
31
33
|
const t = this.__getMdHost(), e = this.__getInnerNativeButton(t);
|
|
32
34
|
if (!t || !e) return;
|
|
33
|
-
const
|
|
35
|
+
const i = (this.getAttribute("aria-label") || "").trim(), l = (t.getAttribute("aria-label") || "").trim(), n = this.label.trim() === "" ? (this.icon || "").trim() : "", b = i || l || n;
|
|
34
36
|
b ? e.setAttribute("aria-label", b) : e.removeAttribute("aria-label");
|
|
35
37
|
const u = this.getAttribute("aria-controls");
|
|
36
38
|
u !== null ? e.setAttribute("aria-controls", u) : e.removeAttribute("aria-controls");
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
const
|
|
40
|
-
if (!(!
|
|
41
|
-
for (const
|
|
42
|
-
if (
|
|
43
|
-
const
|
|
44
|
-
if (
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
} else (
|
|
39
|
+
const y = this.getAttribute("aria-expanded");
|
|
40
|
+
y !== null ? e.setAttribute("aria-expanded", y) : e.removeAttribute("aria-expanded"), t.removeAttribute("aria-label"), t.removeAttribute("aria-controls"), t.removeAttribute("aria-expanded"), this.removeAttribute("aria-expanded"), ($ = this.__ariaObserver) == null || $.disconnect(), this.__ariaObserver = new MutationObserver((S) => {
|
|
41
|
+
const c = this.__getMdHost(), h = this.__getInnerNativeButton(c);
|
|
42
|
+
if (!(!c || !h)) {
|
|
43
|
+
for (const f of S) {
|
|
44
|
+
if (f.type !== "attributes" || !f.attributeName) continue;
|
|
45
|
+
const d = f.attributeName, v = this.getAttribute(d);
|
|
46
|
+
if (d === "aria-label") {
|
|
47
|
+
const I = (c.getAttribute("aria-label") || "").trim(), _ = (v || I || (this.label.trim() === "" ? (this.icon || "").trim() : "")).trim();
|
|
48
|
+
_ ? h.setAttribute("aria-label", _) : h.removeAttribute("aria-label"), c.removeAttribute("aria-label");
|
|
49
|
+
} else (d === "aria-controls" || d === "aria-expanded") && (v === null ? h.removeAttribute(d) : h.setAttribute(d, v), d === "aria-expanded" && this.removeAttribute("aria-expanded"));
|
|
48
50
|
}
|
|
49
|
-
|
|
51
|
+
c.removeAttribute("aria-label"), c.removeAttribute("aria-controls"), c.removeAttribute("aria-expanded");
|
|
50
52
|
}
|
|
51
53
|
}), this.__ariaObserver.observe(this, {
|
|
52
54
|
attributes: !0,
|
|
@@ -60,25 +62,33 @@ let a = class extends _ {
|
|
|
60
62
|
const t = this.closest("form");
|
|
61
63
|
t && (this.type === "submit" && t.requestSubmit(), this.type === "reset" && t.reset());
|
|
62
64
|
}
|
|
63
|
-
}), this.__syncAriaToInner();
|
|
65
|
+
}), this.__syncAriaToInner(), A(this, m, g).call(this);
|
|
64
66
|
}
|
|
65
|
-
// Kör även när variant/icon ändras
|
|
67
|
+
// Kör även när variant/icon/spacing ändras
|
|
66
68
|
updated(t) {
|
|
67
|
-
t.has("variant") && this.__syncAriaToInner();
|
|
69
|
+
t.has("variant") && this.__syncAriaToInner(), (t.has("spacing") || t.has("spacingTop") || t.has("spacingBottom")) && A(this, m, g).call(this);
|
|
68
70
|
}
|
|
69
71
|
disconnectedCallback() {
|
|
70
72
|
var t;
|
|
71
73
|
(t = this.__ariaObserver) == null || t.disconnect(), super.disconnectedCallback();
|
|
72
74
|
}
|
|
75
|
+
mapSpacingToken(t) {
|
|
76
|
+
if (!t) return;
|
|
77
|
+
const e = String(t).trim();
|
|
78
|
+
if (e)
|
|
79
|
+
return /^\d+$/.test(e) ? `var(--spacing-${Math.max(0, Math.min(14, parseInt(e, 10)))})` : e;
|
|
80
|
+
}
|
|
73
81
|
static get styles() {
|
|
74
|
-
return
|
|
82
|
+
return T`
|
|
75
83
|
/* Gör hosten stretchbar i t.ex. flex/grid */
|
|
76
84
|
:host {
|
|
77
85
|
display: inline-flex;
|
|
78
86
|
block-size: var(--scb-button-block-size, auto);
|
|
87
|
+
margin-block-start: var(--scb-button-spacing-block-start, 0);
|
|
88
|
+
margin-block-end: var(--scb-button-spacing-block-end, 0);
|
|
79
89
|
}
|
|
80
90
|
|
|
81
|
-
/* Låt inre md-
|
|
91
|
+
/* Låt inre md-knappar fylla hostens höjd */
|
|
82
92
|
md-filled-button,
|
|
83
93
|
md-outlined-button,
|
|
84
94
|
md-filled-tonal-button,
|
|
@@ -133,17 +143,17 @@ let a = class extends _ {
|
|
|
133
143
|
`;
|
|
134
144
|
}
|
|
135
145
|
render() {
|
|
136
|
-
var
|
|
137
|
-
const t = !!((
|
|
146
|
+
var n;
|
|
147
|
+
const t = !!((n = this.icon) != null && n.trim()), e = t ? p`<md-icon slot="icon">${this.icon}</md-icon>` : r, i = r, l = this.label.trim() === "" ? this.icon : void 0;
|
|
138
148
|
switch (this.variant) {
|
|
139
149
|
case "filled":
|
|
140
|
-
return
|
|
150
|
+
return p`
|
|
141
151
|
<md-filled-button
|
|
142
152
|
type=${this.type}
|
|
143
|
-
variant=${
|
|
153
|
+
variant=${i}
|
|
144
154
|
?trailing-icon=${this.trailingIcon}
|
|
145
155
|
?disabled=${this.disabled}
|
|
146
|
-
aria-label=${
|
|
156
|
+
aria-label=${l}
|
|
147
157
|
href=${this.href || r}
|
|
148
158
|
target=${this.target || r}
|
|
149
159
|
rel=${this.rel || r}
|
|
@@ -154,13 +164,13 @@ let a = class extends _ {
|
|
|
154
164
|
</md-filled-button>
|
|
155
165
|
`;
|
|
156
166
|
case "outlined":
|
|
157
|
-
return
|
|
167
|
+
return p`
|
|
158
168
|
<md-outlined-button
|
|
159
169
|
type=${this.type}
|
|
160
|
-
variant=${
|
|
170
|
+
variant=${i}
|
|
161
171
|
?trailing-icon=${this.trailingIcon}
|
|
162
172
|
?disabled=${this.disabled}
|
|
163
|
-
aria-label=${
|
|
173
|
+
aria-label=${l}
|
|
164
174
|
href=${this.href || r}
|
|
165
175
|
target=${this.target || r}
|
|
166
176
|
rel=${this.rel || r}
|
|
@@ -171,13 +181,13 @@ let a = class extends _ {
|
|
|
171
181
|
</md-outlined-button>
|
|
172
182
|
`;
|
|
173
183
|
case "filled-tonal":
|
|
174
|
-
return
|
|
184
|
+
return p`
|
|
175
185
|
<md-filled-tonal-button
|
|
176
186
|
type=${this.type}
|
|
177
|
-
variant=${
|
|
187
|
+
variant=${i}
|
|
178
188
|
?trailing-icon=${this.trailingIcon}
|
|
179
189
|
?disabled=${this.disabled}
|
|
180
|
-
aria-label=${
|
|
190
|
+
aria-label=${l}
|
|
181
191
|
href=${this.href || r}
|
|
182
192
|
target=${this.target || r}
|
|
183
193
|
rel=${this.rel || r}
|
|
@@ -188,13 +198,13 @@ let a = class extends _ {
|
|
|
188
198
|
</md-filled-tonal-button>
|
|
189
199
|
`;
|
|
190
200
|
case "text":
|
|
191
|
-
return
|
|
201
|
+
return p`
|
|
192
202
|
<md-text-button
|
|
193
203
|
type=${this.type}
|
|
194
|
-
variant=${
|
|
204
|
+
variant=${i}
|
|
195
205
|
?trailing-icon=${this.trailingIcon}
|
|
196
206
|
?disabled=${this.disabled}
|
|
197
|
-
aria-label=${
|
|
207
|
+
aria-label=${l}
|
|
198
208
|
href=${this.href || r}
|
|
199
209
|
target=${this.target || r}
|
|
200
210
|
rel=${this.rel || r}
|
|
@@ -205,40 +215,54 @@ let a = class extends _ {
|
|
|
205
215
|
</md-text-button>
|
|
206
216
|
`;
|
|
207
217
|
default:
|
|
208
|
-
return
|
|
218
|
+
return p``;
|
|
209
219
|
}
|
|
210
220
|
}
|
|
211
221
|
};
|
|
212
|
-
|
|
222
|
+
m = /* @__PURE__ */ new WeakSet();
|
|
223
|
+
g = function() {
|
|
224
|
+
const t = this.mapSpacingToken(this.spacing), e = this.mapSpacingToken(this.spacingTop) ?? t, i = this.mapSpacingToken(this.spacingBottom) ?? t;
|
|
225
|
+
e ? this.style.setProperty("--scb-button-spacing-block-start", e) : this.style.removeProperty("--scb-button-spacing-block-start"), i ? this.style.setProperty("--scb-button-spacing-block-end", i) : this.style.removeProperty("--scb-button-spacing-block-end");
|
|
226
|
+
};
|
|
227
|
+
a([
|
|
213
228
|
s({ type: String, reflect: !0 })
|
|
214
|
-
],
|
|
215
|
-
|
|
229
|
+
], o.prototype, "variant", 2);
|
|
230
|
+
a([
|
|
216
231
|
s({ type: String, reflect: !0 })
|
|
217
|
-
],
|
|
218
|
-
|
|
232
|
+
], o.prototype, "type", 2);
|
|
233
|
+
a([
|
|
219
234
|
s({ type: String })
|
|
220
|
-
],
|
|
221
|
-
|
|
235
|
+
], o.prototype, "label", 2);
|
|
236
|
+
a([
|
|
222
237
|
s({ type: Boolean, attribute: "trailing-icon" })
|
|
223
|
-
],
|
|
224
|
-
|
|
238
|
+
], o.prototype, "trailingIcon", 2);
|
|
239
|
+
a([
|
|
225
240
|
s({ type: String })
|
|
226
|
-
],
|
|
227
|
-
|
|
241
|
+
], o.prototype, "icon", 2);
|
|
242
|
+
a([
|
|
228
243
|
s({ type: Boolean, reflect: !0 })
|
|
229
|
-
],
|
|
230
|
-
|
|
244
|
+
], o.prototype, "disabled", 2);
|
|
245
|
+
a([
|
|
231
246
|
s({ type: String })
|
|
232
|
-
],
|
|
233
|
-
|
|
247
|
+
], o.prototype, "href", 2);
|
|
248
|
+
a([
|
|
234
249
|
s({ type: String })
|
|
235
|
-
],
|
|
236
|
-
|
|
250
|
+
], o.prototype, "target", 2);
|
|
251
|
+
a([
|
|
237
252
|
s({ type: String })
|
|
238
|
-
],
|
|
239
|
-
a
|
|
240
|
-
|
|
241
|
-
],
|
|
253
|
+
], o.prototype, "rel", 2);
|
|
254
|
+
a([
|
|
255
|
+
s({ type: String, reflect: !0 })
|
|
256
|
+
], o.prototype, "spacing", 2);
|
|
257
|
+
a([
|
|
258
|
+
s({ type: String, attribute: "spacing-top", reflect: !0 })
|
|
259
|
+
], o.prototype, "spacingTop", 2);
|
|
260
|
+
a([
|
|
261
|
+
s({ type: String, attribute: "spacing-bottom", reflect: !0 })
|
|
262
|
+
], o.prototype, "spacingBottom", 2);
|
|
263
|
+
o = a([
|
|
264
|
+
B("scb-button")
|
|
265
|
+
], o);
|
|
242
266
|
export {
|
|
243
|
-
|
|
267
|
+
o as ScbButton
|
|
244
268
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { LitElement } from 'lit';
|
|
2
2
|
export declare class ScbCalendarCard extends LitElement {
|
|
3
|
+
#private;
|
|
3
4
|
variant: 'default' | 'outlined' | 'filled';
|
|
4
5
|
direction: 'horizontal' | 'vertical';
|
|
5
6
|
title: string;
|
|
@@ -18,6 +19,9 @@ export declare class ScbCalendarCard extends LitElement {
|
|
|
18
19
|
maxHeight: string;
|
|
19
20
|
minHeight: string;
|
|
20
21
|
sizing: 'stretch' | 'content-width' | 'content-height';
|
|
22
|
+
spacing: string;
|
|
23
|
+
spacingTop: string;
|
|
24
|
+
spacingBottom: string;
|
|
21
25
|
private static __iconLoaded;
|
|
22
26
|
private static __rippleLoaded;
|
|
23
27
|
protected firstUpdated(): Promise<void>;
|
|
@@ -26,6 +30,7 @@ export declare class ScbCalendarCard extends LitElement {
|
|
|
26
30
|
private __applyInnerSizing;
|
|
27
31
|
private _onKeyDown;
|
|
28
32
|
private _handleHrefNavigation;
|
|
33
|
+
private mapSpacingToken;
|
|
29
34
|
protected updated(changed: Map<string, unknown>): void;
|
|
30
35
|
}
|
|
31
36
|
declare global {
|
|
@@ -1,23 +1,25 @@
|
|
|
1
|
-
import { css as
|
|
2
|
-
import { property as
|
|
1
|
+
import { css as u, LitElement as v, html as d } from "lit";
|
|
2
|
+
import { property as a, customElement as b } from "lit/decorators.js";
|
|
3
3
|
import "@material/web/focus/md-focus-ring.js";
|
|
4
|
-
var
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
var x = Object.defineProperty, w = Object.getOwnPropertyDescriptor, f = (e) => {
|
|
5
|
+
throw TypeError(e);
|
|
6
|
+
}, r = (e, t, s, o) => {
|
|
7
|
+
for (var n = o > 1 ? void 0 : o ? w(t, s) : t, l = e.length - 1, c; l >= 0; l--)
|
|
8
|
+
(c = e[l]) && (n = (o ? c(t, s, n) : c(n)) || n);
|
|
9
|
+
return o && n && x(t, s, n), n;
|
|
10
|
+
}, z = (e, t, s) => t.has(e) || f("Cannot " + s), k = (e, t, s) => t.has(e) ? f("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, s), g = (e, t, s) => (z(e, t, "access private method"), s), p, h;
|
|
11
|
+
let i = class extends v {
|
|
10
12
|
constructor() {
|
|
11
|
-
super(...arguments), this.variant = "default", this.direction = "horizontal", this.title = "", this.subtitle = "", this.supportingText = "", this.cardHref = "", this.cardHrefNav = "", this.showMedia = null, this.mediaWidth = "", this.mediaHeight = "", this.mediaAspect = "", this.width = "", this.maxWidth = "", this.minWidth = "", this.height = "", this.maxHeight = "", this.minHeight = "", this.sizing = "stretch";
|
|
13
|
+
super(...arguments), k(this, p), this.variant = "default", this.direction = "horizontal", this.title = "", this.subtitle = "", this.supportingText = "", this.cardHref = "", this.cardHrefNav = "", this.showMedia = null, this.mediaWidth = "", this.mediaHeight = "", this.mediaAspect = "", this.width = "", this.maxWidth = "", this.minWidth = "", this.height = "", this.maxHeight = "", this.minHeight = "", this.sizing = "stretch", this.spacing = "", this.spacingTop = "", this.spacingBottom = "";
|
|
12
14
|
}
|
|
13
15
|
async firstUpdated() {
|
|
14
|
-
i.__iconLoaded || (await import("@material/web/icon/icon.js"), i.__iconLoaded = !0), i.__rippleLoaded || (await import("@material/web/ripple/ripple.js"), i.__rippleLoaded = !0), this.__applyInnerSizing();
|
|
16
|
+
i.__iconLoaded || (await import("@material/web/icon/icon.js"), i.__iconLoaded = !0), i.__rippleLoaded || (await import("@material/web/ripple/ripple.js"), i.__rippleLoaded = !0), this.__applyInnerSizing(), g(this, p, h).call(this);
|
|
15
17
|
}
|
|
16
18
|
render() {
|
|
17
|
-
const e = this.variant ? `${this.variant.toLowerCase()}` : "",
|
|
19
|
+
const e = this.variant ? `${this.variant.toLowerCase()}` : "", t = this.direction ? `${this.direction.toLowerCase()}` : "", s = this.cardHref ? "clickable" : "", o = 1, n = "Jan", l = this.mediaWidth && this.mediaWidth.trim() !== "" ? this.mediaWidth : "", c = this.mediaHeight && this.mediaHeight.trim() !== "" ? this.mediaHeight : "", m = this.mediaAspect && this.mediaAspect.trim() !== "" ? this.mediaAspect : "", y = `${l ? `inline-size:${l};` : ""}${c ? `block-size:${c};` : ""}${m ? `aspect-ratio:${m};` : ""}`;
|
|
18
20
|
return d`
|
|
19
21
|
<div
|
|
20
|
-
class="calendar-card ${
|
|
22
|
+
class="calendar-card ${t} ${s} ${e}"
|
|
21
23
|
role="${this.cardHref ? "link" : "group"}"
|
|
22
24
|
aria-label="${this.title || "Kalenderkort"}"
|
|
23
25
|
tabindex="${this.cardHref ? "0" : "-1"}"
|
|
@@ -27,9 +29,9 @@ let i = class extends f {
|
|
|
27
29
|
>
|
|
28
30
|
${this.cardHref ? d`<md-ripple></md-ripple>` : ""}
|
|
29
31
|
${this.showMedia ? d`
|
|
30
|
-
<div class="media" style="${
|
|
31
|
-
<div class="day">${
|
|
32
|
-
<div class="month">${
|
|
32
|
+
<div class="media" style="${y}" aria-label="Datum: ${o} ${n}">
|
|
33
|
+
<div class="day">${o}</div>
|
|
34
|
+
<div class="month">${n}</div>
|
|
33
35
|
</div>
|
|
34
36
|
` : ""}
|
|
35
37
|
<div class="container">
|
|
@@ -55,13 +57,24 @@ let i = class extends f {
|
|
|
55
57
|
_handleHrefNavigation() {
|
|
56
58
|
this.cardHref && (this.cardHrefNav === "tab" ? window.open(this.cardHref, "_blank") : this.cardHrefNav === "window" ? window.open(this.cardHref, "_blank", "noopener,noreferrer,width=800,height=600") : window.open(this.cardHref, "_self"));
|
|
57
59
|
}
|
|
60
|
+
mapSpacingToken(e) {
|
|
61
|
+
if (!e) return;
|
|
62
|
+
const t = String(e).trim();
|
|
63
|
+
if (t)
|
|
64
|
+
return /^\d+$/.test(t) ? `var(--spacing-${Math.max(0, Math.min(14, parseInt(t, 10)))})` : t;
|
|
65
|
+
}
|
|
58
66
|
updated(e) {
|
|
59
|
-
e.has("width") && (this.width ? this.style.inlineSize = this.width : this.style.removeProperty("inline-size")), e.has("maxWidth") && (this.maxWidth ? this.style.maxInlineSize = this.maxWidth : this.style.removeProperty("max-inline-size")), e.has("minWidth") && (this.minWidth ? this.style.minInlineSize = this.minWidth : this.style.removeProperty("min-inline-size")), e.has("height") && (this.height ? this.style.blockSize = this.height : this.style.removeProperty("block-size")), e.has("maxHeight") && (this.maxHeight ? this.style.maxBlockSize = this.maxHeight : this.style.removeProperty("max-block-size")), e.has("minHeight") && (this.minHeight ? this.style.minBlockSize = this.minHeight : this.style.removeProperty("min-block-size")), (e.has("width") || e.has("height") || e.has("maxHeight") || e.has("sizing")) && this.__applyInnerSizing();
|
|
67
|
+
e.has("width") && (this.width ? this.style.inlineSize = this.width : this.style.removeProperty("inline-size")), e.has("maxWidth") && (this.maxWidth ? this.style.maxInlineSize = this.maxWidth : this.style.removeProperty("max-inline-size")), e.has("minWidth") && (this.minWidth ? this.style.minInlineSize = this.minWidth : this.style.removeProperty("min-inline-size")), e.has("height") && (this.height ? this.style.blockSize = this.height : this.style.removeProperty("block-size")), e.has("maxHeight") && (this.maxHeight ? this.style.maxBlockSize = this.maxHeight : this.style.removeProperty("max-block-size")), e.has("minHeight") && (this.minHeight ? this.style.minBlockSize = this.minHeight : this.style.removeProperty("min-block-size")), (e.has("width") || e.has("height") || e.has("maxHeight") || e.has("sizing")) && this.__applyInnerSizing(), (e.has("spacing") || e.has("spacingTop") || e.has("spacingBottom")) && g(this, p, h).call(this);
|
|
60
68
|
}
|
|
61
69
|
};
|
|
70
|
+
p = /* @__PURE__ */ new WeakSet();
|
|
71
|
+
h = function() {
|
|
72
|
+
const e = this.mapSpacingToken(this.spacing), t = this.mapSpacingToken(this.spacingTop) ?? e, s = this.mapSpacingToken(this.spacingBottom) ?? e;
|
|
73
|
+
t ? this.style.setProperty("--scb-calendar-card-spacing-block-start", t) : this.style.removeProperty("--scb-calendar-card-spacing-block-start"), s ? this.style.setProperty("--scb-calendar-card-spacing-block-end", s) : this.style.removeProperty("--scb-calendar-card-spacing-block-end");
|
|
74
|
+
};
|
|
62
75
|
i.__iconLoaded = !1;
|
|
63
76
|
i.__rippleLoaded = !1;
|
|
64
|
-
i.styles =
|
|
77
|
+
i.styles = u`
|
|
65
78
|
:host {
|
|
66
79
|
display: block;
|
|
67
80
|
position: relative;
|
|
@@ -69,6 +82,8 @@ i.styles = m`
|
|
|
69
82
|
inline-size: 100%;
|
|
70
83
|
min-inline-size: 0;
|
|
71
84
|
padding: var(--scb-calendar-card-focus-ring-gap, 4px);
|
|
85
|
+
margin-block-start: var(--scb-calendar-card-spacing-block-start, 0);
|
|
86
|
+
margin-block-end: var(--scb-calendar-card-spacing-block-end, 0);
|
|
72
87
|
}
|
|
73
88
|
|
|
74
89
|
:host([sizing='stretch']) {
|
|
@@ -279,62 +294,71 @@ i.styles = m`
|
|
|
279
294
|
text-overflow: clip;
|
|
280
295
|
}
|
|
281
296
|
`;
|
|
282
|
-
|
|
283
|
-
|
|
297
|
+
r([
|
|
298
|
+
a({ type: String, reflect: !0 })
|
|
284
299
|
], i.prototype, "variant", 2);
|
|
285
|
-
|
|
286
|
-
|
|
300
|
+
r([
|
|
301
|
+
a({ type: String, reflect: !0 })
|
|
287
302
|
], i.prototype, "direction", 2);
|
|
288
|
-
|
|
289
|
-
|
|
303
|
+
r([
|
|
304
|
+
a({ type: String, reflect: !0 })
|
|
290
305
|
], i.prototype, "title", 2);
|
|
291
|
-
|
|
292
|
-
|
|
306
|
+
r([
|
|
307
|
+
a({ type: String, reflect: !0 })
|
|
293
308
|
], i.prototype, "subtitle", 2);
|
|
294
|
-
|
|
295
|
-
|
|
309
|
+
r([
|
|
310
|
+
a({ type: String, attribute: "supporting-text", reflect: !0 })
|
|
296
311
|
], i.prototype, "supportingText", 2);
|
|
297
|
-
|
|
298
|
-
|
|
312
|
+
r([
|
|
313
|
+
a({ type: String, attribute: "card-href" })
|
|
299
314
|
], i.prototype, "cardHref", 2);
|
|
300
|
-
|
|
301
|
-
|
|
315
|
+
r([
|
|
316
|
+
a({ type: String, attribute: "card-href-nav" })
|
|
302
317
|
], i.prototype, "cardHrefNav", 2);
|
|
303
|
-
|
|
304
|
-
|
|
318
|
+
r([
|
|
319
|
+
a({ type: Boolean, reflect: !0, attribute: "show-media" })
|
|
305
320
|
], i.prototype, "showMedia", 2);
|
|
306
|
-
|
|
307
|
-
|
|
321
|
+
r([
|
|
322
|
+
a({ type: String, attribute: "media-width" })
|
|
308
323
|
], i.prototype, "mediaWidth", 2);
|
|
309
|
-
|
|
310
|
-
|
|
324
|
+
r([
|
|
325
|
+
a({ type: String, attribute: "media-height" })
|
|
311
326
|
], i.prototype, "mediaHeight", 2);
|
|
312
|
-
|
|
313
|
-
|
|
327
|
+
r([
|
|
328
|
+
a({ type: String, attribute: "media-aspect" })
|
|
314
329
|
], i.prototype, "mediaAspect", 2);
|
|
315
|
-
|
|
316
|
-
|
|
330
|
+
r([
|
|
331
|
+
a({ type: String, reflect: !0 })
|
|
317
332
|
], i.prototype, "width", 2);
|
|
318
|
-
|
|
319
|
-
|
|
333
|
+
r([
|
|
334
|
+
a({ type: String, reflect: !0, attribute: "max-width" })
|
|
320
335
|
], i.prototype, "maxWidth", 2);
|
|
321
|
-
|
|
322
|
-
|
|
336
|
+
r([
|
|
337
|
+
a({ type: String, attribute: "min-width" })
|
|
323
338
|
], i.prototype, "minWidth", 2);
|
|
324
|
-
|
|
325
|
-
|
|
339
|
+
r([
|
|
340
|
+
a({ type: String, reflect: !0 })
|
|
326
341
|
], i.prototype, "height", 2);
|
|
327
|
-
|
|
328
|
-
|
|
342
|
+
r([
|
|
343
|
+
a({ type: String, reflect: !0, attribute: "max-height" })
|
|
329
344
|
], i.prototype, "maxHeight", 2);
|
|
330
|
-
|
|
331
|
-
|
|
345
|
+
r([
|
|
346
|
+
a({ type: String, attribute: "min-height" })
|
|
332
347
|
], i.prototype, "minHeight", 2);
|
|
333
|
-
|
|
334
|
-
|
|
348
|
+
r([
|
|
349
|
+
a({ type: String, reflect: !0 })
|
|
335
350
|
], i.prototype, "sizing", 2);
|
|
336
|
-
|
|
337
|
-
|
|
351
|
+
r([
|
|
352
|
+
a({ type: String, reflect: !0 })
|
|
353
|
+
], i.prototype, "spacing", 2);
|
|
354
|
+
r([
|
|
355
|
+
a({ type: String, attribute: "spacing-top", reflect: !0 })
|
|
356
|
+
], i.prototype, "spacingTop", 2);
|
|
357
|
+
r([
|
|
358
|
+
a({ type: String, attribute: "spacing-bottom", reflect: !0 })
|
|
359
|
+
], i.prototype, "spacingBottom", 2);
|
|
360
|
+
i = r([
|
|
361
|
+
b("scb-calendar-card")
|
|
338
362
|
], i);
|
|
339
363
|
export {
|
|
340
364
|
i as ScbCalendarCard
|
package/scb-card/scb-card.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { LitElement, PropertyValues } from 'lit';
|
|
2
2
|
export declare class ScbCard extends LitElement {
|
|
3
|
+
#private;
|
|
3
4
|
private static __iconLoaded;
|
|
4
5
|
private static __rippleLoaded;
|
|
5
6
|
type: string;
|
|
@@ -33,10 +34,14 @@ export declare class ScbCard extends LitElement {
|
|
|
33
34
|
maxWidth: string;
|
|
34
35
|
height: string;
|
|
35
36
|
maxHeight: string;
|
|
37
|
+
spacing: string;
|
|
38
|
+
spacingTop: string;
|
|
39
|
+
spacingBottom: string;
|
|
36
40
|
static styles: import('lit').CSSResult;
|
|
37
41
|
private __calcAspectWH;
|
|
38
42
|
private __onImgLoad;
|
|
39
43
|
private __mediaTemplate;
|
|
44
|
+
private mapSpacingToken;
|
|
40
45
|
render(): import('lit-html').TemplateResult<1>;
|
|
41
46
|
protected updated(changed: PropertyValues): void;
|
|
42
47
|
protected firstUpdated(_changed: PropertyValues): Promise<void>;
|