scb-wc-test 0.1.81 → 0.1.82
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/all.js +2 -0
- package/index.d.ts +1 -0
- package/index.js +23 -21
- package/mvc/components/all.js +1 -0
- package/mvc/components/scb-chip/scb-chip.js +2 -7
- package/mvc/components/scb-horizontal-scroller/scb-horizontal-scroller.js +38 -27
- package/mvc/components/scb-viz/scb-viz.js +297 -0
- package/package.json +6 -2
- package/scb-chip/scb-chip.js +4 -9
- package/scb-horizontal-scroller/scb-horizontal-scroller.d.ts +1 -0
- package/scb-horizontal-scroller/scb-horizontal-scroller.js +81 -58
- package/scb-viz/scb-viz.d.ts +24 -0
- package/scb-viz/scb-viz.js +408 -0
- package/scb-wc-test.bundle.js +688 -386
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { css as
|
|
2
|
-
import { property as
|
|
1
|
+
import { css as g, LitElement as v, html as a } from "lit";
|
|
2
|
+
import { property as u, customElement as w } from "lit/decorators.js";
|
|
3
3
|
import "../scb-icon-button/scb-icon-button.js";
|
|
4
4
|
import "../scb-button/scb-button.js";
|
|
5
5
|
import "@material/web/focus/md-focus-ring.js";
|
|
6
|
-
var
|
|
7
|
-
for (var s = r > 1 ? void 0 : r ?
|
|
6
|
+
var S = Object.defineProperty, y = Object.getOwnPropertyDescriptor, d = (t, l, o, r) => {
|
|
7
|
+
for (var s = r > 1 ? void 0 : r ? y(l, o) : l, i = t.length - 1, c; i >= 0; i--)
|
|
8
8
|
(c = t[i]) && (s = (r ? c(l, o, s) : c(s)) || s);
|
|
9
|
-
return r && s &&
|
|
9
|
+
return r && s && S(l, o, s), s;
|
|
10
10
|
};
|
|
11
|
-
let
|
|
11
|
+
let n = class extends v {
|
|
12
12
|
constructor() {
|
|
13
|
-
super(...arguments), this.variant = "standard", this.width = "100%", this.showScrollbar = !
|
|
13
|
+
super(...arguments), this.variant = "standard", this.width = "100%", this.showScrollbar = !0, this.rightScrollButtonLabel = "Scrolla höger", this.leftScrollButtonLabel = "Scrolla vänster", this.contentFlex = !1, this.updateScrollButtons = () => {
|
|
14
14
|
var o;
|
|
15
15
|
this.requestUpdate();
|
|
16
16
|
const t = (o = this.shadowRoot) == null ? void 0 : o.querySelector(".scb-horizontal-scroller");
|
|
@@ -57,8 +57,8 @@ let a = class extends g {
|
|
|
57
57
|
}));
|
|
58
58
|
}
|
|
59
59
|
firstUpdated() {
|
|
60
|
-
var i, c,
|
|
61
|
-
const t = (i = this.shadowRoot) == null ? void 0 : i.querySelector(".scb-horizontal-scroller"), l = (c = this.shadowRoot) == null ? void 0 : c.querySelector(".scroll-shadow-left"), o = (
|
|
60
|
+
var i, c, b, f;
|
|
61
|
+
const t = (i = this.shadowRoot) == null ? void 0 : i.querySelector(".scb-horizontal-scroller"), l = (c = this.shadowRoot) == null ? void 0 : c.querySelector(".scroll-shadow-left"), o = (b = this.shadowRoot) == null ? void 0 : b.querySelector(".scroll-shadow-right"), r = (f = this.shadowRoot) == null ? void 0 : f.querySelector("slot");
|
|
62
62
|
t && (t.addEventListener("scroll", this.handleScroll), t.addEventListener("wheel", function(e) {
|
|
63
63
|
e.deltaY !== 0 && (e.preventDefault(), t.scrollLeft += e.deltaY);
|
|
64
64
|
}, { passive: !1 }));
|
|
@@ -68,45 +68,56 @@ let a = class extends g {
|
|
|
68
68
|
l.style.height = `${e.height}px`, o.style.height = `${e.height}px`;
|
|
69
69
|
}
|
|
70
70
|
};
|
|
71
|
-
s(), r && new ResizeObserver(s).observe(r), this.
|
|
71
|
+
s(), r && new ResizeObserver(s).observe(r), this.updateComplete.then(() => {
|
|
72
|
+
this.updateScrollButtons();
|
|
73
|
+
});
|
|
72
74
|
}
|
|
73
75
|
updated(t) {
|
|
74
|
-
var c,
|
|
75
|
-
const l = (c = this.shadowRoot) == null ? void 0 : c.querySelector(".scroll-shadow-left"), o = (
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
76
|
+
var c, b, f, e;
|
|
77
|
+
const l = (c = this.shadowRoot) == null ? void 0 : c.querySelector(".scroll-shadow-left"), o = (b = this.shadowRoot) == null ? void 0 : b.querySelector(".scroll-shadow-right"), r = (f = this.shadowRoot) == null ? void 0 : f.querySelector("slot"), s = (e = this.shadowRoot) == null ? void 0 : e.querySelector(".scb-horizontal-scroller");
|
|
78
|
+
if (s) {
|
|
79
|
+
s.addEventListener("scroll", this.handleScroll), s.addEventListener("wheel", function(p) {
|
|
80
|
+
p.deltaY !== 0 && (p.preventDefault(), s.scrollLeft += p.deltaY);
|
|
81
|
+
}, { passive: !1 }), s.scrollLeft > 0 ? this.setAttribute("data-scroll-left", "") : this.removeAttribute("data-scroll-left");
|
|
82
|
+
const h = s;
|
|
83
|
+
h.scrollLeft + h.clientWidth < h.scrollWidth - 1 ? this.setAttribute("data-scroll-right", "") : this.removeAttribute("data-scroll-right");
|
|
84
|
+
}
|
|
85
|
+
t.has("width") && this.style.setProperty("--scb-horizontal-scroller-width", this.width);
|
|
79
86
|
const i = () => {
|
|
80
87
|
if (r && l && o) {
|
|
81
|
-
const
|
|
82
|
-
l.style.height = `${
|
|
88
|
+
const h = r.getBoundingClientRect();
|
|
89
|
+
l.style.height = `${h.height}px`, o.style.height = `${h.height}px`;
|
|
83
90
|
}
|
|
84
91
|
};
|
|
85
92
|
i(), r && new ResizeObserver(i).observe(r);
|
|
86
93
|
}
|
|
87
94
|
render() {
|
|
88
|
-
|
|
95
|
+
const t = this.variant;
|
|
96
|
+
var l = !!(this.canScrollLeft || this.canScrollRight);
|
|
97
|
+
switch (t) {
|
|
89
98
|
case "inline":
|
|
90
|
-
return
|
|
91
|
-
<div class="scb-horizontal-scroller" tabindex="0">
|
|
92
|
-
|
|
99
|
+
return a`
|
|
100
|
+
<div class="scb-horizontal-scroller ${l ? "canScroll" : ""}" tabindex="0">
|
|
101
|
+
${this.variant != "inline" ? a`<div class="scroll-shadow-left"></div>` : ""}
|
|
93
102
|
<slot></slot>
|
|
94
103
|
<md-focus-ring inward></md-focus-ring>
|
|
95
|
-
|
|
104
|
+
${this.variant != "inline" ? a`<div class="scroll-shadow-right"></div>` : ""}
|
|
96
105
|
</div>
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
106
|
+
${l ? a`
|
|
107
|
+
<div class="scroll-buttons">
|
|
108
|
+
${this.canScrollLeft ? a`
|
|
109
|
+
<scb-button class="scroll-button-left" variant="text" label="${this.leftScrollButtonLabel}" aria-label="Scrolla vänster" icon="chevron_left" @click="${() => this.doScrollBy(-100)}"></scb-button>
|
|
110
|
+
` : ""}
|
|
101
111
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
112
|
+
${this.canScrollRight ? a`
|
|
113
|
+
<scb-button class="scroll-button-right" variant="text" label="${this.rightScrollButtonLabel}" aria-label="Scrolla höger" icon="chevron_right" trailing-icon @click="${() => this.doScrollBy(100)}"></scb-button>
|
|
114
|
+
` : ""}
|
|
115
|
+
</div>
|
|
116
|
+
` : ""}
|
|
106
117
|
`;
|
|
107
118
|
default:
|
|
108
|
-
return
|
|
109
|
-
${this.canScrollLeft ?
|
|
119
|
+
return a`
|
|
120
|
+
${this.canScrollLeft ? a`
|
|
110
121
|
<scb-icon-button class="scroll-button-left" icon="chevron_left" aria-label="Scrolla vänster" variant="filled-tonal" @click="${() => this.doScrollBy(-100)}"></scb-icon-button>
|
|
111
122
|
` : ""}
|
|
112
123
|
<div class="scroll-shadow-left"></div>
|
|
@@ -115,31 +126,37 @@ let a = class extends g {
|
|
|
115
126
|
<md-focus-ring inward></md-focus-ring>
|
|
116
127
|
</div>
|
|
117
128
|
<div class="scroll-shadow-right"></div>
|
|
118
|
-
${this.canScrollRight ?
|
|
129
|
+
${this.canScrollRight ? a`
|
|
119
130
|
<scb-icon-button class="scroll-button-right" icon="chevron_right" aria-label="Scrolla höger" variant="filled-tonal" @click="${() => this.doScrollBy(100)}"></scb-icon-button>
|
|
120
131
|
` : ""}
|
|
121
132
|
`;
|
|
122
133
|
}
|
|
123
134
|
}
|
|
124
135
|
};
|
|
125
|
-
|
|
136
|
+
n.styles = g`
|
|
126
137
|
:host {
|
|
127
|
-
position: relative;
|
|
128
|
-
max-width: var(--scb-horizontal-scroller-width, 100%);
|
|
129
138
|
display: flex;
|
|
139
|
+
position: relative;
|
|
130
140
|
align-items: center;
|
|
131
141
|
gap: var(--spacing-3);
|
|
132
142
|
padding: 0px var(--spacing-8);
|
|
133
143
|
}
|
|
134
144
|
.scb-horizontal-scroller {
|
|
145
|
+
overflow-x: auto;
|
|
146
|
+
-ms-overflow-style: none; /* IE and Edge */
|
|
147
|
+
scrollbar-width: none;
|
|
148
|
+
width: 100%;
|
|
149
|
+
}
|
|
150
|
+
:host([show-scrollbar]) .scb-horizontal-scroller{
|
|
151
|
+
scrollbar-width: auto;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
:host([content-flex]) .scb-horizontal-scroller{
|
|
135
155
|
display: flex;
|
|
136
156
|
flex-direction: row;
|
|
137
|
-
overflow-x: scroll;
|
|
138
157
|
flex: 1 1 auto;
|
|
139
|
-
-ms-overflow-style: none; /* IE and Edge */
|
|
140
|
-
scrollbar-width: none;
|
|
141
|
-
max-width: var(--scb-horizontal-scroller-width, 100%);
|
|
142
158
|
}
|
|
159
|
+
|
|
143
160
|
.scb-horizontal-scroller::-webkit-scrollbar {
|
|
144
161
|
border-radius: var(--md-sys-shape-corner-large);
|
|
145
162
|
height: 4px;
|
|
@@ -161,14 +178,16 @@ a.styles = p`
|
|
|
161
178
|
border-radius: var(--scb-card-focus-ring-radius, var(--md-sys-shape-corner-large));
|
|
162
179
|
}
|
|
163
180
|
|
|
164
|
-
:host([show-scrollbar]) .scb-horizontal-scroller{
|
|
165
|
-
-ms-overflow-style: auto; /* IE and Edge */
|
|
166
|
-
scrollbar-width: auto;
|
|
181
|
+
:host([show-scrollbar]) .scb-horizontal-scroller.canScroll{
|
|
167
182
|
padding-bottom: var(--spacing-5);
|
|
168
183
|
}
|
|
169
184
|
slot {
|
|
170
|
-
display:
|
|
185
|
+
display: block;
|
|
171
186
|
padding: var(--spacing-3);
|
|
187
|
+
min-width: var(--scb-horizontal-scroller-width, auto);
|
|
188
|
+
}
|
|
189
|
+
:host([content-flex]) .scb-horizontal-scroller slot {
|
|
190
|
+
display: flex;
|
|
172
191
|
}
|
|
173
192
|
.scroll-button-left {
|
|
174
193
|
left: var(--spacing-5);
|
|
@@ -206,6 +225,7 @@ a.styles = p`
|
|
|
206
225
|
:host([variant="inline"]) {
|
|
207
226
|
flex-direction: column;
|
|
208
227
|
align-items: unset;
|
|
228
|
+
padding: 0;
|
|
209
229
|
.scroll-buttons {
|
|
210
230
|
display: flex;
|
|
211
231
|
gap: var(--spacing-3);
|
|
@@ -228,23 +248,26 @@ a.styles = p`
|
|
|
228
248
|
|
|
229
249
|
`;
|
|
230
250
|
d([
|
|
231
|
-
|
|
232
|
-
],
|
|
251
|
+
u({ type: String, reflect: !0 })
|
|
252
|
+
], n.prototype, "variant", 2);
|
|
253
|
+
d([
|
|
254
|
+
u({ type: String, reflect: !0 })
|
|
255
|
+
], n.prototype, "width", 2);
|
|
233
256
|
d([
|
|
234
|
-
|
|
235
|
-
],
|
|
257
|
+
u({ type: Boolean, reflect: !0, attribute: "show-scrollbar" })
|
|
258
|
+
], n.prototype, "showScrollbar", 2);
|
|
236
259
|
d([
|
|
237
|
-
|
|
238
|
-
],
|
|
260
|
+
u({ type: String, reflect: !0, attribute: "right-scroll-button-label" })
|
|
261
|
+
], n.prototype, "rightScrollButtonLabel", 2);
|
|
239
262
|
d([
|
|
240
|
-
|
|
241
|
-
],
|
|
263
|
+
u({ type: String, reflect: !0, attribute: "left-scroll-button-label" })
|
|
264
|
+
], n.prototype, "leftScrollButtonLabel", 2);
|
|
242
265
|
d([
|
|
243
|
-
|
|
244
|
-
],
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
],
|
|
266
|
+
u({ type: Boolean, reflect: !0, attribute: "content-flex" })
|
|
267
|
+
], n.prototype, "contentFlex", 2);
|
|
268
|
+
n = d([
|
|
269
|
+
w("scb-horizontal-scroller")
|
|
270
|
+
], n);
|
|
248
271
|
export {
|
|
249
|
-
|
|
272
|
+
n as ScbHorizontalScroller
|
|
250
273
|
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
export declare class ScbViz extends LitElement {
|
|
3
|
+
variant: 'Standard' | 'Diagram' | 'Table' | 'Image';
|
|
4
|
+
selectedChip: 'Diagram' | 'Table' | null;
|
|
5
|
+
title: string;
|
|
6
|
+
subtitle: string;
|
|
7
|
+
description: string;
|
|
8
|
+
comment: string;
|
|
9
|
+
source: string;
|
|
10
|
+
footnote: string;
|
|
11
|
+
lang: string;
|
|
12
|
+
imageHref: string;
|
|
13
|
+
get descriptionLabel(): "Description of the chart" | "Beskrivning av diagrammet";
|
|
14
|
+
get moreAboutStatsLabel(): "More about the statistics" | "Mer om statistiken";
|
|
15
|
+
get commentLabel(): "Comments" | "Kommentar";
|
|
16
|
+
get sourceLabel(): "Source" | "Källa";
|
|
17
|
+
get footnoteLabel(): "Footnotes" | "Fotnot";
|
|
18
|
+
static styles: import('lit').CSSResult;
|
|
19
|
+
firstUpdated(): void;
|
|
20
|
+
updated(): void;
|
|
21
|
+
private _styleSlottedTable;
|
|
22
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
23
|
+
private _onChipSelect;
|
|
24
|
+
}
|
|
@@ -0,0 +1,408 @@
|
|
|
1
|
+
import { css as v, LitElement as h, html as t } from "lit";
|
|
2
|
+
import { property as o, customElement as b } from "lit/decorators.js";
|
|
3
|
+
import "../scb-chip/scb-chip.js";
|
|
4
|
+
import "../scb-accordion/scb-accordion.js";
|
|
5
|
+
import "../scb-divider/scb-divider.js";
|
|
6
|
+
import "../scb-horizontal-scroller/scb-horizontal-scroller.js";
|
|
7
|
+
var p = Object.defineProperty, m = Object.getOwnPropertyDescriptor, l = (i, r, d, a) => {
|
|
8
|
+
for (var e = a > 1 ? void 0 : a ? m(r, d) : r, c = i.length - 1, n; c >= 0; c--)
|
|
9
|
+
(n = i[c]) && (e = (a ? n(r, d, e) : n(e)) || e);
|
|
10
|
+
return a && e && p(r, d, e), e;
|
|
11
|
+
};
|
|
12
|
+
let s = class extends h {
|
|
13
|
+
constructor() {
|
|
14
|
+
super(...arguments), this.variant = "Standard", this.selectedChip = "Diagram", this.title = "", this.subtitle = "", this.description = "", this.comment = "", this.source = "", this.footnote = "", this.lang = "sv", this.imageHref = "";
|
|
15
|
+
}
|
|
16
|
+
// Labels as getters so they react to lang changes
|
|
17
|
+
get descriptionLabel() {
|
|
18
|
+
return this.lang === "en" ? "Description of the chart" : "Beskrivning av diagrammet";
|
|
19
|
+
}
|
|
20
|
+
get moreAboutStatsLabel() {
|
|
21
|
+
return this.lang === "en" ? "More about the statistics" : "Mer om statistiken";
|
|
22
|
+
}
|
|
23
|
+
get commentLabel() {
|
|
24
|
+
return this.lang === "en" ? "Comments" : "Kommentar";
|
|
25
|
+
}
|
|
26
|
+
get sourceLabel() {
|
|
27
|
+
return this.lang === "en" ? "Source" : "Källa";
|
|
28
|
+
}
|
|
29
|
+
get footnoteLabel() {
|
|
30
|
+
return this.lang === "en" ? "Footnotes" : "Fotnot";
|
|
31
|
+
}
|
|
32
|
+
firstUpdated() {
|
|
33
|
+
var r;
|
|
34
|
+
const i = (r = this.shadowRoot) == null ? void 0 : r.querySelector('slot[name="table"]');
|
|
35
|
+
i && (i.addEventListener("slotchange", () => this._styleSlottedTable()), this._styleSlottedTable());
|
|
36
|
+
}
|
|
37
|
+
updated() {
|
|
38
|
+
this._styleSlottedTable();
|
|
39
|
+
}
|
|
40
|
+
_styleSlottedTable() {
|
|
41
|
+
var d;
|
|
42
|
+
const i = (d = this.shadowRoot) == null ? void 0 : d.querySelector('slot[name="table"]');
|
|
43
|
+
if (!i) return;
|
|
44
|
+
i.assignedElements({ flatten: !0 }).forEach((a) => {
|
|
45
|
+
a.tagName === "TABLE" && (a.style.borderCollapse = "collapse", a.style.width = "100%", a.querySelectorAll("tbody tr:nth-child(odd)").forEach((e) => {
|
|
46
|
+
e.style.background = "var(--md-sys-color-surface-container)";
|
|
47
|
+
}), a.querySelectorAll("th").forEach((e) => {
|
|
48
|
+
e.style.border = "1px solid var(--md-sys-color-on-surface)", e.style.padding = "8px";
|
|
49
|
+
}), a.querySelectorAll("td").forEach((e) => {
|
|
50
|
+
e.style.border = "1px solid var(--md-sys-color-on-surface)", e.style.padding = "8px";
|
|
51
|
+
}), a.querySelectorAll("tr").forEach((e) => {
|
|
52
|
+
const c = Array.from(e.children).filter(
|
|
53
|
+
(n) => n.tagName === "TD" || n.tagName === "TH"
|
|
54
|
+
);
|
|
55
|
+
c.length > 0 && (c[0].style.borderLeft = "none", c[c.length - 1].style.borderRight = "none");
|
|
56
|
+
}));
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
render() {
|
|
60
|
+
switch (this.variant) {
|
|
61
|
+
case "Diagram":
|
|
62
|
+
return t`
|
|
63
|
+
<div part="container">
|
|
64
|
+
<div class="header">
|
|
65
|
+
<div class="label">${this.title}</div>
|
|
66
|
+
<div class="subtitle">${this.subtitle}</div>
|
|
67
|
+
</div>
|
|
68
|
+
<div class="content">
|
|
69
|
+
<scb-horizontal-scroller width="600px" class="diagram-scroller" variant="inline" show-scrollbar>
|
|
70
|
+
<slot name="diagram"></slot>
|
|
71
|
+
</scb-horizontal-scroller>
|
|
72
|
+
</div>
|
|
73
|
+
<div class="footer">
|
|
74
|
+
<div class="description section">
|
|
75
|
+
<div class="secondary-label">${this.descriptionLabel}</div>
|
|
76
|
+
${this.description ? t`<div>${this.description}</div>` : ""}
|
|
77
|
+
</div>
|
|
78
|
+
<scb-divider></scb-divider>
|
|
79
|
+
<scb-accordion>
|
|
80
|
+
<scb-accordion-item
|
|
81
|
+
title="${this.moreAboutStatsLabel}"
|
|
82
|
+
>
|
|
83
|
+
<div class="more-about-stats-content">
|
|
84
|
+
<div class="section">
|
|
85
|
+
<div class="secondary-label">${this.commentLabel}</div>
|
|
86
|
+
${this.comment ? t`<div>${this.comment}</div>` : ""}
|
|
87
|
+
</div>
|
|
88
|
+
<div class="section">
|
|
89
|
+
<div class="secondary-label">${this.sourceLabel}</div>
|
|
90
|
+
${this.source ? t`<div>${this.source}</div>` : ""}
|
|
91
|
+
</div>
|
|
92
|
+
<div class="section">
|
|
93
|
+
<div class="secondary-label">${this.footnoteLabel}</div>
|
|
94
|
+
${this.footnote ? t`<div>${this.footnote}</div>` : ""}
|
|
95
|
+
</div>
|
|
96
|
+
</div>
|
|
97
|
+
</scb-accordion-item>
|
|
98
|
+
</scb-accordion>
|
|
99
|
+
</div>
|
|
100
|
+
<slot></slot>
|
|
101
|
+
</div>
|
|
102
|
+
`;
|
|
103
|
+
case "Table":
|
|
104
|
+
return t`
|
|
105
|
+
<div part="container">
|
|
106
|
+
<div class="header">
|
|
107
|
+
<div class="label">${this.title}</div>
|
|
108
|
+
<div class="subtitle">${this.subtitle}</div>
|
|
109
|
+
</div>
|
|
110
|
+
<div class="content">
|
|
111
|
+
<scb-horizontal-scroller width="600px" class="table-scroller" variant="inline" show-scrollbar>
|
|
112
|
+
<slot name="table"></slot>
|
|
113
|
+
</scb-horizontal-scroller>
|
|
114
|
+
</div>
|
|
115
|
+
<div class="footer">
|
|
116
|
+
<div class="description section">
|
|
117
|
+
<div class="secondary-label">${this.descriptionLabel}</div>
|
|
118
|
+
${this.description ? t`<div>${this.description}</div>` : ""}
|
|
119
|
+
</div>
|
|
120
|
+
<scb-divider></scb-divider>
|
|
121
|
+
<scb-accordion>
|
|
122
|
+
<scb-accordion-item
|
|
123
|
+
title="${this.moreAboutStatsLabel}"
|
|
124
|
+
>
|
|
125
|
+
<div class="more-about-stats-content">
|
|
126
|
+
<div class="section">
|
|
127
|
+
<div class="secondary-label">${this.commentLabel}</div>
|
|
128
|
+
${this.comment ? t`<div>${this.comment}</div>` : ""}
|
|
129
|
+
</div>
|
|
130
|
+
<div class="section">
|
|
131
|
+
<div class="secondary-label">${this.sourceLabel}</div>
|
|
132
|
+
${this.source ? t`<div>${this.source}</div>` : ""}
|
|
133
|
+
</div>
|
|
134
|
+
<div class="section">
|
|
135
|
+
<div class="secondary-label">${this.footnoteLabel}</div>
|
|
136
|
+
${this.footnote ? t`<div>${this.footnote}</div>` : ""}
|
|
137
|
+
</div>
|
|
138
|
+
</div>
|
|
139
|
+
</scb-accordion-item>
|
|
140
|
+
</scb-accordion>
|
|
141
|
+
</div>
|
|
142
|
+
<slot></slot>
|
|
143
|
+
</div>
|
|
144
|
+
`;
|
|
145
|
+
case "Image":
|
|
146
|
+
return t`
|
|
147
|
+
<div part="container">
|
|
148
|
+
<div class="header">
|
|
149
|
+
<div class="label">${this.title}</div>
|
|
150
|
+
<div class="subtitle">${this.subtitle}</div>
|
|
151
|
+
</div>
|
|
152
|
+
<div class="content image-content">
|
|
153
|
+
<img src="${this.imageHref}" alt="Image figure"/>
|
|
154
|
+
</div>
|
|
155
|
+
<div class="footer">
|
|
156
|
+
<div class="description section">
|
|
157
|
+
<div class="secondary-label">${this.descriptionLabel}</div>
|
|
158
|
+
${this.description ? t`<div>${this.description}</div>` : ""}
|
|
159
|
+
</div>
|
|
160
|
+
<scb-divider></scb-divider>
|
|
161
|
+
<scb-accordion>
|
|
162
|
+
<scb-accordion-item
|
|
163
|
+
title="${this.moreAboutStatsLabel}"
|
|
164
|
+
>
|
|
165
|
+
<div class="more-about-stats-content">
|
|
166
|
+
<div class="section">
|
|
167
|
+
<div class="secondary-label">${this.commentLabel}</div>
|
|
168
|
+
${this.comment ? t`<div>${this.comment}</div>` : ""}
|
|
169
|
+
</div>
|
|
170
|
+
<div class="section">
|
|
171
|
+
<div class="secondary-label">${this.sourceLabel}</div>
|
|
172
|
+
${this.source ? t`<div>${this.source}</div>` : ""}
|
|
173
|
+
</div>
|
|
174
|
+
<div class="section">
|
|
175
|
+
<div class="secondary-label">${this.footnoteLabel}</div>
|
|
176
|
+
${this.footnote ? t`<div>${this.footnote}</div>` : ""}
|
|
177
|
+
</div>
|
|
178
|
+
</div>
|
|
179
|
+
</scb-accordion-item>
|
|
180
|
+
</scb-accordion>
|
|
181
|
+
</div>
|
|
182
|
+
<slot></slot>
|
|
183
|
+
</div>
|
|
184
|
+
`;
|
|
185
|
+
default:
|
|
186
|
+
const i = this.selectedChip === "Diagram" ? "chip-diagram" : this.selectedChip === "Table" ? "chip-table" : "";
|
|
187
|
+
return this.className !== i && (this.className = i), t`
|
|
188
|
+
<div part="container">
|
|
189
|
+
<div class="header">
|
|
190
|
+
<div class="label">${this.title}</div>
|
|
191
|
+
<div class="subtitle">${this.subtitle}</div>
|
|
192
|
+
</div>
|
|
193
|
+
${this.variant === "Standard" ? t`
|
|
194
|
+
<div class="flipp-wrapper">
|
|
195
|
+
<scb-chip
|
|
196
|
+
variant="filter"
|
|
197
|
+
label=${this.lang === "en" ? "Figure" : "Diagram"}
|
|
198
|
+
icon="bar_chart"
|
|
199
|
+
?selected=${this.selectedChip === "Diagram"}
|
|
200
|
+
@selected-changed=${() => this._onChipSelect("Diagram")}
|
|
201
|
+
></scb-chip>
|
|
202
|
+
<scb-chip
|
|
203
|
+
variant="filter"
|
|
204
|
+
label="${this.lang === "en" ? "Table" : "Tabell"}"
|
|
205
|
+
icon="table"
|
|
206
|
+
?selected=${this.selectedChip === "Table"}
|
|
207
|
+
@selected-changed=${() => this._onChipSelect("Table")}
|
|
208
|
+
></scb-chip>
|
|
209
|
+
</div>
|
|
210
|
+
` : ""}
|
|
211
|
+
<div class="content">
|
|
212
|
+
<scb-horizontal-scroller width="600px" class="diagram-scroller" variant="inline" show-scrollbar>
|
|
213
|
+
<slot name="diagram"></slot>
|
|
214
|
+
</scb-horizontal-scroller>
|
|
215
|
+
<scb-horizontal-scroller width="600px" class="table-scroller" variant="inline" show-scrollbar>
|
|
216
|
+
<slot name="table"></slot>
|
|
217
|
+
</scb-horizontal-scroller>
|
|
218
|
+
</div>
|
|
219
|
+
<div class="footer">
|
|
220
|
+
<div class="description section">
|
|
221
|
+
<div class="secondary-label">${this.descriptionLabel}</div>
|
|
222
|
+
${this.description ? t`<div>${this.description}</div>` : ""}
|
|
223
|
+
</div>
|
|
224
|
+
<scb-divider></scb-divider>
|
|
225
|
+
<scb-accordion>
|
|
226
|
+
<scb-accordion-item
|
|
227
|
+
title="${this.moreAboutStatsLabel}"
|
|
228
|
+
>
|
|
229
|
+
<div class="more-about-stats-content">
|
|
230
|
+
<div class="section">
|
|
231
|
+
<div class="secondary-label">${this.commentLabel}</div>
|
|
232
|
+
${this.comment ? t`<div>${this.comment}</div>` : ""}
|
|
233
|
+
</div>
|
|
234
|
+
<div class="section">
|
|
235
|
+
<div class="secondary-label">${this.sourceLabel}</div>
|
|
236
|
+
${this.source ? t`<div>${this.source}</div>` : ""}
|
|
237
|
+
</div>
|
|
238
|
+
<div class="section">
|
|
239
|
+
<div class="secondary-label">${this.footnoteLabel}</div>
|
|
240
|
+
${this.footnote ? t`<div>${this.footnote}</div>` : ""}
|
|
241
|
+
</div>
|
|
242
|
+
</div>
|
|
243
|
+
</scb-accordion-item>
|
|
244
|
+
</scb-accordion>
|
|
245
|
+
</div>
|
|
246
|
+
<slot></slot>
|
|
247
|
+
</div>
|
|
248
|
+
`;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
_onChipSelect(i) {
|
|
252
|
+
this.selectedChip = i;
|
|
253
|
+
}
|
|
254
|
+
};
|
|
255
|
+
s.styles = v`
|
|
256
|
+
:host {
|
|
257
|
+
display: block;
|
|
258
|
+
font-family: var(--brand-font);
|
|
259
|
+
color: var(--md-sys-color-on-surface);
|
|
260
|
+
background: var(--md-sys-color-surface);
|
|
261
|
+
padding: 24px;
|
|
262
|
+
max-width: 100%;
|
|
263
|
+
border-radius: var(--spacing-04, 16px);
|
|
264
|
+
border: 1px solid var(--md-sys-color-outline-variant);
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
.label {
|
|
268
|
+
font-size: var(--md-sys-typescale-title-large-size);
|
|
269
|
+
font-weight: var(--weight-semibold);
|
|
270
|
+
line-height: var(--md-sys-typescale-title-large-line-height);
|
|
271
|
+
letter-spacing: var(--md-sys-typescale-title-large-tracking);
|
|
272
|
+
}
|
|
273
|
+
.sub-label{
|
|
274
|
+
font-size: var(--md-sys-typescale-body-large-size);
|
|
275
|
+
line-height: var(--md-sys-typescale-body-large-line-height);
|
|
276
|
+
letter-spacing: var(--md-sys-typescale-body-large-tracking);
|
|
277
|
+
}
|
|
278
|
+
.secondary-label {
|
|
279
|
+
font-size: var(--md-sys-typescale-title-medium-size);
|
|
280
|
+
font-weight: var(--weight-semibold);
|
|
281
|
+
line-height: var(--md-sys-typescale-title-medium-line-height);
|
|
282
|
+
letter-spacing: var(--md-sys-typescale-title-medium-tracking);
|
|
283
|
+
}
|
|
284
|
+
.section {
|
|
285
|
+
display: flex;
|
|
286
|
+
flex-direction: column;
|
|
287
|
+
gap: 4px;
|
|
288
|
+
}
|
|
289
|
+
.more-about-stats-content {
|
|
290
|
+
display: flex;
|
|
291
|
+
flex-direction: column;
|
|
292
|
+
gap: 24px;
|
|
293
|
+
max-width: 600px
|
|
294
|
+
}
|
|
295
|
+
.header {
|
|
296
|
+
margin-bottom: 24px;
|
|
297
|
+
max-width: 600px
|
|
298
|
+
}
|
|
299
|
+
.flipp-wrapper {
|
|
300
|
+
margin-bottom: 40px;
|
|
301
|
+
max-width: 600px
|
|
302
|
+
}
|
|
303
|
+
.description{
|
|
304
|
+
margin-bottom: 32px;
|
|
305
|
+
}
|
|
306
|
+
.footer {
|
|
307
|
+
margin-top: 24px;
|
|
308
|
+
|
|
309
|
+
}
|
|
310
|
+
.description.section{
|
|
311
|
+
max-width: 600px
|
|
312
|
+
}
|
|
313
|
+
.table-scroller,
|
|
314
|
+
.diagram-scroller {
|
|
315
|
+
display: none;
|
|
316
|
+
}
|
|
317
|
+
:host([variant='Table']) slot[name="table"] {
|
|
318
|
+
display: block;
|
|
319
|
+
}
|
|
320
|
+
:host([variant='Table']) .table-scroller {
|
|
321
|
+
display: flex;
|
|
322
|
+
}
|
|
323
|
+
:host([variant='Diagram']) slot[name="diagram"] {
|
|
324
|
+
display: block;
|
|
325
|
+
}
|
|
326
|
+
:host([variant='Diagram']) .diagram-scroller {
|
|
327
|
+
display: flex;
|
|
328
|
+
}
|
|
329
|
+
:host([variant='Image']) {
|
|
330
|
+
img {
|
|
331
|
+
height: auto;
|
|
332
|
+
max-width: 100%;
|
|
333
|
+
}
|
|
334
|
+
slot[name="table"] {
|
|
335
|
+
display: none;
|
|
336
|
+
}
|
|
337
|
+
slot[name="diagram"] {
|
|
338
|
+
display: none;
|
|
339
|
+
}
|
|
340
|
+
.image-content {
|
|
341
|
+
display: block;
|
|
342
|
+
}
|
|
343
|
+
.diagram-scroller {
|
|
344
|
+
display: none;
|
|
345
|
+
}
|
|
346
|
+
.table-scroller {
|
|
347
|
+
display: none;
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
:host([variant='Standard'].chip-diagram) .diagram-scroller {
|
|
352
|
+
display: flex;
|
|
353
|
+
}
|
|
354
|
+
:host([variant='Standard'].chip-table) .table-scroller {
|
|
355
|
+
display: flex;
|
|
356
|
+
}
|
|
357
|
+
:host([variant='Standard'].chip-table) slot[name="table"] {
|
|
358
|
+
display: block;
|
|
359
|
+
}
|
|
360
|
+
:host([variant='Standard'].chip-table) slot[name="diagram"] {
|
|
361
|
+
display: none;
|
|
362
|
+
}
|
|
363
|
+
:host([variant='Standard'].chip-diagram) slot[name="table"] {
|
|
364
|
+
display: none;
|
|
365
|
+
}
|
|
366
|
+
:host([variant='Standard'].chip-diagram) slot[name="diagram"] {
|
|
367
|
+
display: block;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
|
|
371
|
+
|
|
372
|
+
`;
|
|
373
|
+
l([
|
|
374
|
+
o({ type: String, reflect: !0 })
|
|
375
|
+
], s.prototype, "variant", 2);
|
|
376
|
+
l([
|
|
377
|
+
o({ type: String })
|
|
378
|
+
], s.prototype, "selectedChip", 2);
|
|
379
|
+
l([
|
|
380
|
+
o({ type: String, reflect: !0 })
|
|
381
|
+
], s.prototype, "title", 2);
|
|
382
|
+
l([
|
|
383
|
+
o({ type: String, reflect: !0 })
|
|
384
|
+
], s.prototype, "subtitle", 2);
|
|
385
|
+
l([
|
|
386
|
+
o({ type: String, reflect: !0 })
|
|
387
|
+
], s.prototype, "description", 2);
|
|
388
|
+
l([
|
|
389
|
+
o({ type: String, reflect: !0 })
|
|
390
|
+
], s.prototype, "comment", 2);
|
|
391
|
+
l([
|
|
392
|
+
o({ type: String, reflect: !0 })
|
|
393
|
+
], s.prototype, "source", 2);
|
|
394
|
+
l([
|
|
395
|
+
o({ type: String, reflect: !0 })
|
|
396
|
+
], s.prototype, "footnote", 2);
|
|
397
|
+
l([
|
|
398
|
+
o({ type: String, reflect: !0, attribute: "lang" })
|
|
399
|
+
], s.prototype, "lang", 2);
|
|
400
|
+
l([
|
|
401
|
+
o({ type: String, reflect: !0, attribute: "image-href" })
|
|
402
|
+
], s.prototype, "imageHref", 2);
|
|
403
|
+
s = l([
|
|
404
|
+
b("scb-viz")
|
|
405
|
+
], s);
|
|
406
|
+
export {
|
|
407
|
+
s as ScbViz
|
|
408
|
+
};
|