scb-wc-test 0.1.11 → 0.1.13
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 +34 -32
- package/mvc/components/all.js +1 -0
- package/mvc/components/scb-accordion/scb-accordion-item.js +21 -61
- package/mvc/components/scb-app-bar/scb-app-bar.js +1 -1
- package/mvc/components/scb-avatar/scb-avatar.js +1 -1
- package/mvc/components/scb-breadcrumb/scb-breadcrumb-item.js +1 -1
- package/mvc/components/scb-breadcrumb/scb-breadcrumb.js +1 -1
- package/mvc/components/scb-button/scb-button.js +1 -1
- package/mvc/components/scb-calendar-card/scb-calendar-card.js +165 -126
- package/mvc/components/scb-card/scb-card.js +223 -217
- package/mvc/components/scb-checkbox/scb-checkbox-group.js +1 -1
- package/mvc/components/scb-checkbox/scb-checkbox.js +9 -11
- package/mvc/components/scb-chips/scb-chip.js +1 -1
- package/mvc/components/scb-dialog/scb-dialog.js +2 -2
- package/mvc/components/scb-divider/scb-divider.js +43 -53
- package/mvc/components/scb-drawer/scb-drawer-item.js +2 -2
- package/mvc/components/scb-drawer/scb-drawer-section.js +4 -4
- package/mvc/components/scb-drawer/scb-drawer.js +1 -1
- package/mvc/components/scb-drawer/scb-sub-drawer.js +1 -1
- package/mvc/components/scb-fact-card/scb-fact-card-content.js +1 -1
- package/mvc/components/scb-fact-card/scb-fact-card.js +68 -55
- package/mvc/components/scb-footer/scb-footer-section.js +2 -2
- package/mvc/components/scb-footer/scb-footer.js +1 -1
- package/mvc/components/scb-grid/scb-grid-item.js +5 -3
- package/mvc/components/scb-grid/scb-grid.js +27 -10
- package/mvc/components/scb-grid/scb-stack.js +10 -6
- package/mvc/components/scb-header/scb-header-drawer-group.js +1 -1
- package/mvc/components/scb-header/scb-header-drawer-item.js +1 -1
- package/mvc/components/scb-header/scb-header-tab.js +1 -1
- package/mvc/components/scb-header/scb-header-utility.js +1 -1
- package/mvc/components/scb-header/scb-header.js +53 -49
- package/mvc/components/scb-icon-button/scb-icon-button.js +45 -80
- package/mvc/components/scb-keyfigure-card/scb-keyfigure-card.js +84 -58
- package/mvc/components/scb-link/scb-link.js +39 -16
- package/mvc/components/scb-list/scb-list-item.js +115 -37
- package/mvc/components/scb-list/scb-list.js +16 -7
- package/mvc/components/scb-menu/scb-menu-item.js +1 -1
- package/mvc/components/scb-menu/scb-menu.js +1 -1
- package/mvc/components/scb-menu/scb-sub-menu.js +1 -1
- package/mvc/components/scb-notification/scb-notification.js +1 -1
- package/mvc/components/scb-notification-card/scb-notification-card.js +187 -0
- package/mvc/components/scb-progress-indicator/scb-progress-indicator.js +1 -1
- package/mvc/components/scb-radio-button/scb-radio-button.js +29 -36
- package/mvc/components/scb-radio-button/scb-radio-group.js +1 -1
- package/mvc/components/scb-search/scb-search.js +48 -37
- package/mvc/components/scb-snackbar/scb-snackbar.js +8 -8
- package/mvc/components/scb-status-pill/scb-status-pill.js +1 -1
- package/mvc/components/scb-switch/scb-switch.js +1 -1
- package/mvc/components/scb-tabs/scb-primary-tab.js +1 -1
- package/mvc/components/scb-tabs/scb-secondary-tab.js +1 -1
- package/mvc/components/scb-tabs/scb-tabs.js +1 -1
- package/mvc/components/scb-textfield/scb-textfield.js +1 -1
- package/mvc/components/scb-toc/scb-toc-item.js +1 -1
- package/mvc/components/scb-toc/scb-toc.js +2 -2
- package/mvc/components/scb-tooltip/scb-tooltip.js +1 -1
- package/mvc/vendor/vendor-material.js +232 -312
- package/mvc/vendor/vendor.js +19 -23
- package/package.json +6 -2
- package/scb-accordion/scb-accordion-item.js +47 -98
- package/scb-calendar-card/scb-calendar-card.d.ts +6 -4
- package/scb-calendar-card/scb-calendar-card.js +207 -154
- package/scb-card/scb-card.d.ts +8 -3
- package/scb-card/scb-card.js +265 -250
- package/scb-checkbox/scb-checkbox.d.ts +1 -0
- package/scb-checkbox/scb-checkbox.js +56 -49
- package/scb-divider/scb-divider.d.ts +16 -4
- package/scb-divider/scb-divider.js +63 -69
- package/scb-fact-card/scb-fact-card.d.ts +8 -7
- package/scb-fact-card/scb-fact-card.js +100 -78
- package/scb-grid/scb-grid-item.d.ts +7 -2
- package/scb-grid/scb-grid-item.js +47 -33
- package/scb-grid/scb-grid.d.ts +7 -3
- package/scb-grid/scb-grid.js +57 -21
- package/scb-grid/scb-stack.d.ts +5 -1
- package/scb-grid/scb-stack.js +57 -31
- package/scb-header/scb-header.d.ts +1 -2
- package/scb-header/scb-header.js +154 -162
- package/scb-icon-button/scb-icon-button.d.ts +15 -11
- package/scb-icon-button/scb-icon-button.js +149 -132
- package/scb-keyfigure-card/scb-keyfigure-card.d.ts +6 -1
- package/scb-keyfigure-card/scb-keyfigure-card.js +139 -93
- package/scb-link/scb-link.d.ts +1 -0
- package/scb-link/scb-link.js +65 -38
- package/scb-list/scb-list-item.d.ts +8 -5
- package/scb-list/scb-list-item.js +183 -73
- package/scb-list/scb-list.d.ts +5 -0
- package/scb-list/scb-list.js +71 -21
- package/scb-notification-card/scb-notification-card.d.ts +18 -0
- package/scb-notification-card/scb-notification-card.js +264 -0
- package/scb-radio-button/scb-radio-button.js +46 -53
- package/scb-search/scb-search.d.ts +8 -0
- package/scb-search/scb-search.js +176 -139
- package/scb-wc-test.bundle.js +1870 -1546
|
@@ -1,40 +1,39 @@
|
|
|
1
|
-
import { css as
|
|
2
|
-
import { property as
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { css as p, LitElement as m, html as s } from "lit";
|
|
2
|
+
import { property as d, customElement as f } from "lit/decorators.js";
|
|
3
|
+
import "@material/web/icon/icon.js";
|
|
4
|
+
import "../scb-tooltip/scb-tooltip.js";
|
|
5
|
+
var g = Object.defineProperty, v = Object.getOwnPropertyDescriptor, l = (t, e, i, r) => {
|
|
6
|
+
for (var n = r > 1 ? void 0 : r ? v(e, i) : e, u = t.length - 1, a; u >= 0; u--)
|
|
7
|
+
(a = t[u]) && (n = (r ? a(e, i, n) : a(n)) || n);
|
|
8
|
+
return r && n && g(e, i, n), n;
|
|
7
9
|
};
|
|
8
|
-
let
|
|
10
|
+
let o = class extends m {
|
|
9
11
|
constructor() {
|
|
10
|
-
super(...arguments), this.ariaLabel = "", this.variant = "standard", this.icon = "home", this.toggle = !1, this.toggleofficon = "add", this.toggleonicon = "remove", this.disabled = !1, this.
|
|
11
|
-
const t = this.
|
|
12
|
-
this.
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
super(...arguments), this.ariaLabel = "", this.tooltip = "", this.variant = "standard", this.icon = "home", this.toggle = !1, this.selected = !1, this.toggleofficon = "add", this.toggleonicon = "remove", this.disabled = !1, this.__loadedVariants = /* @__PURE__ */ new Set(), this.__iconLoaded = !1, this.__onInnerChange = () => {
|
|
13
|
+
const t = this.__getMdHost(), e = !!(t != null && t.selected);
|
|
14
|
+
this.toggle && (this.selected = e), this.dispatchEvent(
|
|
15
|
+
new CustomEvent("change", {
|
|
16
|
+
detail: { selected: e },
|
|
17
|
+
bubbles: !0,
|
|
18
|
+
composed: !0
|
|
19
|
+
})
|
|
20
|
+
);
|
|
17
21
|
};
|
|
18
22
|
}
|
|
19
|
-
__attachChangeListener() {
|
|
20
|
-
var o, e, r;
|
|
21
|
-
const t = (o = this.shadowRoot) == null ? void 0 : o.querySelector(
|
|
22
|
-
"md-filled-icon-button, md-outlined-icon-button, md-filled-tonal-icon-button, md-icon-button"
|
|
23
|
-
);
|
|
24
|
-
t && t !== this.__lastBtn && ((r = (e = this.__lastBtn) == null ? void 0 : e.removeEventListener) == null || r.call(e, "change", this.__onChange), t.addEventListener("change", this.__onChange), this.__lastBtn = t);
|
|
25
|
-
}
|
|
26
23
|
async firstUpdated() {
|
|
27
|
-
await this.__ensureDepsLoaded(), await this.updateComplete, this.__attachChangeListener();
|
|
24
|
+
await this.__ensureDepsLoaded(), await this.updateComplete, this.__attachChangeListener(), this.__syncAria();
|
|
28
25
|
}
|
|
29
26
|
updated(t) {
|
|
30
|
-
super.updated(t), t.has("
|
|
27
|
+
super.updated(t), t.has("variant") || t.has("toggle") || t.has("icon") || t.has("ariaLabel") || t.has("selected") || t.has("disabled") || t.has("tooltip") ? this.__ensureDepsLoaded().then(
|
|
28
|
+
() => queueMicrotask(() => {
|
|
29
|
+
this.__attachChangeListener(), this.__syncAria();
|
|
30
|
+
})
|
|
31
|
+
) : queueMicrotask(() => this.__attachChangeListener());
|
|
31
32
|
}
|
|
32
|
-
// koppla loss lyssnare om host tas bort
|
|
33
33
|
disconnectedCallback() {
|
|
34
|
-
var t,
|
|
35
|
-
super.disconnectedCallback(), (
|
|
34
|
+
var t, e, i;
|
|
35
|
+
super.disconnectedCallback(), (e = (t = this.__lastBtn) == null ? void 0 : t.removeEventListener) == null || e.call(t, "change", this.__onInnerChange), this.__lastBtn = null, (i = this.__ariaObserver) == null || i.disconnect();
|
|
36
36
|
}
|
|
37
|
-
// Ladda in rätt Material-komponenter vid behov (variant + ikon)
|
|
38
37
|
async __ensureDepsLoaded() {
|
|
39
38
|
if (!this.__loadedVariants.has(this.variant)) {
|
|
40
39
|
switch (this.variant) {
|
|
@@ -55,154 +54,172 @@ let n = class extends h {
|
|
|
55
54
|
}
|
|
56
55
|
this.__iconLoaded || (await import("@material/web/icon/icon.js"), this.__iconLoaded = !0);
|
|
57
56
|
}
|
|
58
|
-
|
|
59
|
-
|
|
57
|
+
// Hämta md-* host. Om den är inuti <scb-tooltip>, sök i dess light DOM.
|
|
58
|
+
__getMdHost() {
|
|
59
|
+
const t = this.renderRoot.querySelector(
|
|
60
|
+
"md-filled-icon-button, md-outlined-icon-button, md-filled-tonal-icon-button, md-icon-button"
|
|
61
|
+
);
|
|
62
|
+
if (t) return t;
|
|
63
|
+
const e = this.renderRoot.querySelector("scb-tooltip");
|
|
64
|
+
if (e) {
|
|
65
|
+
const i = e.querySelector(
|
|
66
|
+
"md-filled-icon-button, md-outlined-icon-button, md-filled-tonal-icon-button, md-icon-button"
|
|
67
|
+
);
|
|
68
|
+
if (i) return i;
|
|
69
|
+
}
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
__getInnerButton(t) {
|
|
73
|
+
const e = t == null ? void 0 : t.shadowRoot;
|
|
74
|
+
return e ? e.querySelector("button") || e.querySelector('[role="button"]') : null;
|
|
75
|
+
}
|
|
76
|
+
// Ta bort alla native title-tooltips (förhindrar visning av t.ex. ikonnamn).
|
|
77
|
+
__stripNativeTitles(t) {
|
|
78
|
+
if (!t) return;
|
|
79
|
+
t.removeAttribute("title");
|
|
80
|
+
const e = this.__getInnerButton(t);
|
|
81
|
+
e == null || e.removeAttribute("title");
|
|
82
|
+
const i = t.shadowRoot;
|
|
83
|
+
i && i.querySelectorAll("[title]").forEach((r) => r.removeAttribute("title"));
|
|
84
|
+
}
|
|
85
|
+
__syncAria() {
|
|
86
|
+
var u;
|
|
87
|
+
const t = this.__getMdHost();
|
|
88
|
+
if (!t) return;
|
|
89
|
+
const e = this.__getInnerButton(t), i = (this.ariaLabel || this.getAttribute("aria-label") || "").trim() || this.icon.trim(), r = this.getAttribute("aria-controls"), n = this.getAttribute("aria-expanded");
|
|
90
|
+
e && (i ? e.setAttribute("aria-label", i) : e.removeAttribute("aria-label"), r !== null ? e.setAttribute("aria-controls", r) : e.removeAttribute("aria-controls"), n !== null ? e.setAttribute("aria-expanded", n) : e.removeAttribute("aria-expanded"), e.removeAttribute("title")), t.removeAttribute("aria-label"), t.removeAttribute("aria-controls"), t.removeAttribute("aria-expanded"), t.removeAttribute("title"), this.hasAttribute("aria-label") && this.removeAttribute("aria-label"), this.hasAttribute("aria-controls") && this.removeAttribute("aria-controls"), this.hasAttribute("aria-expanded") && this.removeAttribute("aria-expanded"), this.__stripNativeTitles(t), (u = this.__ariaObserver) == null || u.disconnect(), this.__ariaObserver = new MutationObserver(() => {
|
|
91
|
+
const a = this.__getMdHost(), c = this.__getInnerButton(a);
|
|
92
|
+
if (!a || !c) return;
|
|
93
|
+
const b = (this.ariaLabel || this.getAttribute("aria-label") || "").trim() || this.icon.trim(), h = this.getAttribute("aria-controls"), _ = this.getAttribute("aria-expanded");
|
|
94
|
+
b ? c.setAttribute("aria-label", b) : c.removeAttribute("aria-label"), h !== null ? c.setAttribute("aria-controls", h) : c.removeAttribute("aria-controls"), _ !== null ? c.setAttribute("aria-expanded", _) : c.removeAttribute("aria-expanded"), this.__stripNativeTitles(a), a.removeAttribute("aria-label"), a.removeAttribute("aria-controls"), a.removeAttribute("aria-expanded"), a.removeAttribute("title"), this.hasAttribute("aria-label") && this.removeAttribute("aria-label"), this.hasAttribute("aria-controls") && this.removeAttribute("aria-controls"), this.hasAttribute("aria-expanded") && this.removeAttribute("aria-expanded");
|
|
95
|
+
}), this.__ariaObserver.observe(this, {
|
|
96
|
+
attributes: !0,
|
|
97
|
+
attributeFilter: ["aria-label", "aria-controls", "aria-expanded"]
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
__attachChangeListener() {
|
|
101
|
+
var e, i;
|
|
102
|
+
const t = this.__getMdHost();
|
|
103
|
+
t && t !== this.__lastBtn && ((i = (e = this.__lastBtn) == null ? void 0 : e.removeEventListener) == null || i.call(e, "change", this.__onInnerChange), t.addEventListener("change", this.__onInnerChange), this.__lastBtn = t), this.toggle && t && "selected" in t && (t.selected = this.selected), this.__stripNativeTitles(t || null);
|
|
104
|
+
}
|
|
105
|
+
__renderMd(t = !1) {
|
|
106
|
+
const e = !!t, i = s`
|
|
60
107
|
<md-icon aria-hidden="true">${this.toggleofficon}</md-icon>
|
|
61
108
|
<md-icon slot="selected" aria-hidden="true">${this.toggleonicon}</md-icon>
|
|
62
|
-
`, r =
|
|
63
|
-
if (this.toggle)
|
|
64
|
-
const i = this.selected || !1;
|
|
109
|
+
`, r = s`<md-icon aria-hidden="true">${this.icon}</md-icon>`;
|
|
110
|
+
if (this.toggle)
|
|
65
111
|
switch (this.variant) {
|
|
66
112
|
case "filled":
|
|
67
|
-
return
|
|
113
|
+
return s`
|
|
68
114
|
<md-filled-icon-button
|
|
115
|
+
?scb-tooltip-button=${e}
|
|
69
116
|
toggle
|
|
70
|
-
|
|
117
|
+
?selected=${this.selected}
|
|
71
118
|
?disabled=${this.disabled}
|
|
72
|
-
|
|
73
|
-
aria-pressed="${i}"
|
|
74
|
-
>${e}</md-filled-icon-button>
|
|
119
|
+
>${i}</md-filled-icon-button>
|
|
75
120
|
`;
|
|
76
121
|
case "outlined":
|
|
77
|
-
return
|
|
122
|
+
return s`
|
|
78
123
|
<md-outlined-icon-button
|
|
124
|
+
?scb-tooltip-button=${e}
|
|
79
125
|
toggle
|
|
80
|
-
|
|
126
|
+
?selected=${this.selected}
|
|
81
127
|
?disabled=${this.disabled}
|
|
82
|
-
|
|
83
|
-
aria-pressed="${i}"
|
|
84
|
-
>${e}</md-outlined-icon-button>
|
|
128
|
+
>${i}</md-outlined-icon-button>
|
|
85
129
|
`;
|
|
86
130
|
case "filled-tonal":
|
|
87
|
-
return
|
|
131
|
+
return s`
|
|
88
132
|
<md-filled-tonal-icon-button
|
|
133
|
+
?scb-tooltip-button=${e}
|
|
89
134
|
toggle
|
|
90
|
-
|
|
135
|
+
?selected=${this.selected}
|
|
91
136
|
?disabled=${this.disabled}
|
|
92
|
-
|
|
93
|
-
aria-pressed="${i}"
|
|
94
|
-
>${e}</md-filled-tonal-icon-button>
|
|
137
|
+
>${i}</md-filled-tonal-icon-button>
|
|
95
138
|
`;
|
|
96
139
|
default:
|
|
97
|
-
return
|
|
140
|
+
return s`
|
|
98
141
|
<md-icon-button
|
|
99
|
-
|
|
142
|
+
?scb-tooltip-button=${e}
|
|
100
143
|
toggle
|
|
101
|
-
|
|
144
|
+
?selected=${this.selected}
|
|
102
145
|
?disabled=${this.disabled}
|
|
103
|
-
|
|
104
|
-
aria-pressed="${i}"
|
|
105
|
-
>${e}</md-icon-button>
|
|
146
|
+
>${i}</md-icon-button>
|
|
106
147
|
`;
|
|
107
148
|
}
|
|
108
|
-
}
|
|
109
149
|
switch (this.variant) {
|
|
110
150
|
case "filled":
|
|
111
|
-
return
|
|
112
|
-
<md-filled-icon-button
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
aria-label=${t}
|
|
116
|
-
>${r}</md-filled-icon-button>
|
|
151
|
+
return s`
|
|
152
|
+
<md-filled-icon-button ?scb-tooltip-button=${e} ?disabled=${this.disabled}>
|
|
153
|
+
${r}
|
|
154
|
+
</md-filled-icon-button>
|
|
117
155
|
`;
|
|
118
156
|
case "outlined":
|
|
119
|
-
return
|
|
120
|
-
<md-outlined-icon-button
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
aria-label=${t}
|
|
124
|
-
>${r}</md-outlined-icon-button>
|
|
157
|
+
return s`
|
|
158
|
+
<md-outlined-icon-button ?scb-tooltip-button=${e} ?disabled=${this.disabled}>
|
|
159
|
+
${r}
|
|
160
|
+
</md-outlined-icon-button>
|
|
125
161
|
`;
|
|
126
162
|
case "filled-tonal":
|
|
127
|
-
return
|
|
128
|
-
<md-filled-tonal-icon-button
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
aria-label=${t}
|
|
132
|
-
>${r}</md-filled-tonal-icon-button>
|
|
163
|
+
return s`
|
|
164
|
+
<md-filled-tonal-icon-button ?scb-tooltip-button=${e} ?disabled=${this.disabled}>
|
|
165
|
+
${r}
|
|
166
|
+
</md-filled-tonal-icon-button>
|
|
133
167
|
`;
|
|
134
168
|
default:
|
|
135
|
-
return
|
|
136
|
-
<md-icon-button
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
aria-label=${t}
|
|
140
|
-
>${r}</md-icon-button>
|
|
169
|
+
return s`
|
|
170
|
+
<md-icon-button ?scb-tooltip-button=${e} ?disabled=${this.disabled}>
|
|
171
|
+
${r}
|
|
172
|
+
</md-icon-button>
|
|
141
173
|
`;
|
|
142
174
|
}
|
|
143
175
|
}
|
|
176
|
+
render() {
|
|
177
|
+
const t = (this.tooltip || this.ariaLabel || "").trim();
|
|
178
|
+
return t ? s`
|
|
179
|
+
<scb-tooltip
|
|
180
|
+
variant="plain"
|
|
181
|
+
position="top"
|
|
182
|
+
trigger="hover"
|
|
183
|
+
.delay=${0.12}
|
|
184
|
+
.arrow=${!0}
|
|
185
|
+
supporting-text=${t}
|
|
186
|
+
>
|
|
187
|
+
${this.__renderMd(!0)}
|
|
188
|
+
</scb-tooltip>
|
|
189
|
+
` : this.__renderMd(!1);
|
|
190
|
+
}
|
|
144
191
|
};
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
:host([error]) md-filled-tonal-icon-button[variant='error'],
|
|
150
|
-
:host([error]) md-icon-button[variant='error'] {
|
|
151
|
-
--md-sys-color-primary: var(--md-sys-color-error);
|
|
152
|
-
--md-sys-color-on-primary: var(--md-sys-color-on-error);
|
|
153
|
-
}
|
|
154
|
-
:host([error]) md-outlined-icon-button[variant='error'] md-icon,
|
|
155
|
-
:host([error]) md-icon-button[variant='error'] md-icon {
|
|
156
|
-
color: var(--md-sys-color-error) !important;
|
|
157
|
-
}
|
|
158
|
-
:host([error]) md-outlined-icon-button[variant='error'] {
|
|
159
|
-
--_outline-color: var(--md-sys-color-error);
|
|
160
|
-
--md-outlined-icon-button-pressed-outline-color: var(--md-sys-color-error);
|
|
161
|
-
}
|
|
162
|
-
:host([error]) md-outlined-icon-button[variant='error']:hover {
|
|
163
|
-
--md-outlined-icon-button-outline-width: 2px;
|
|
164
|
-
}
|
|
165
|
-
:host([error]) md-filled-tonal-icon-button[variant='error'] {
|
|
166
|
-
--md-filled-tonal-icon-button-container-color: var(--md-sys-color-error-container);
|
|
167
|
-
--md-filled-tonal-icon-button-label-text-color: var(--md-sys-color-on-error-container);
|
|
168
|
-
--md-filled-tonal-icon-button-hover-label-text-color: var(--md-sys-color-on-error-container);
|
|
169
|
-
--md-filled-tonal-icon-button-pressed-label-text-color: var(--md-sys-color-on-error-container);
|
|
170
|
-
--md-filled-tonal-icon-button-focus-label-text-color: var(--md-sys-color-on-error-container);
|
|
171
|
-
--md-filled-tonal-icon-button-icon-color: var(--md-sys-color-on-error-container);
|
|
172
|
-
--md-filled-tonal-icon-button-hover-icon-color: var(--md-sys-color-on-error-container);
|
|
173
|
-
--md-filled-tonal-icon-button-pressed-icon-color: var(--md-sys-color-on-error-container);
|
|
174
|
-
--md-filled-tonal-icon-button-focus-icon-color: var(--md-sys-color-on-error-container);
|
|
175
|
-
--md-filled-tonal-icon-button-hover-state-layer-color: var(--md-sys-color-on-error-container);
|
|
176
|
-
--md-filled-tonal-icon-button-pressed-state-layer-color: var(--md-sys-color-on-error-container);
|
|
177
|
-
}
|
|
178
|
-
`;
|
|
192
|
+
o.styles = p``;
|
|
193
|
+
l([
|
|
194
|
+
d({ type: String, attribute: "aria-label" })
|
|
195
|
+
], o.prototype, "ariaLabel", 2);
|
|
179
196
|
l([
|
|
180
|
-
|
|
181
|
-
],
|
|
197
|
+
d({ type: String })
|
|
198
|
+
], o.prototype, "tooltip", 2);
|
|
182
199
|
l([
|
|
183
|
-
|
|
184
|
-
],
|
|
200
|
+
d({ type: String })
|
|
201
|
+
], o.prototype, "variant", 2);
|
|
185
202
|
l([
|
|
186
|
-
|
|
187
|
-
],
|
|
203
|
+
d({ type: String })
|
|
204
|
+
], o.prototype, "icon", 2);
|
|
188
205
|
l([
|
|
189
|
-
|
|
190
|
-
],
|
|
206
|
+
d({ type: Boolean, reflect: !0 })
|
|
207
|
+
], o.prototype, "toggle", 2);
|
|
191
208
|
l([
|
|
192
|
-
|
|
193
|
-
],
|
|
209
|
+
d({ type: Boolean, reflect: !0 })
|
|
210
|
+
], o.prototype, "selected", 2);
|
|
194
211
|
l([
|
|
195
|
-
|
|
196
|
-
],
|
|
212
|
+
d({ type: String })
|
|
213
|
+
], o.prototype, "toggleofficon", 2);
|
|
197
214
|
l([
|
|
198
|
-
|
|
199
|
-
],
|
|
215
|
+
d({ type: String })
|
|
216
|
+
], o.prototype, "toggleonicon", 2);
|
|
200
217
|
l([
|
|
201
|
-
|
|
202
|
-
],
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
],
|
|
218
|
+
d({ type: Boolean, reflect: !0 })
|
|
219
|
+
], o.prototype, "disabled", 2);
|
|
220
|
+
o = l([
|
|
221
|
+
f("scb-icon-button")
|
|
222
|
+
], o);
|
|
206
223
|
export {
|
|
207
|
-
|
|
224
|
+
o as ScbIconButton
|
|
208
225
|
};
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
import { LitElement } from 'lit';
|
|
2
2
|
export declare class ScbKeyFigureCard extends LitElement {
|
|
3
|
-
keyfigure: number;
|
|
3
|
+
keyfigure: number | string;
|
|
4
4
|
subLabel: string;
|
|
5
5
|
supportingText: string;
|
|
6
6
|
cardHref: string;
|
|
7
7
|
icon: string;
|
|
8
8
|
size: 'standard' | 'large';
|
|
9
|
+
unit: string;
|
|
10
|
+
fullHeight: boolean;
|
|
11
|
+
fullWidth: boolean;
|
|
12
|
+
stretch: boolean;
|
|
9
13
|
static styles: import('lit').CSSResult;
|
|
14
|
+
private formatNumber;
|
|
10
15
|
render(): import('lit-html').TemplateResult<1>;
|
|
11
16
|
firstUpdated(): void;
|
|
12
17
|
}
|
|
@@ -1,119 +1,165 @@
|
|
|
1
|
-
import { css as
|
|
2
|
-
import { property as
|
|
1
|
+
import { css as d, LitElement as u, html as a } from "lit";
|
|
2
|
+
import { property as s, customElement as g } from "lit/decorators.js";
|
|
3
3
|
import "@material/web/icon/icon.js";
|
|
4
4
|
import "@material/web/ripple/ripple.js";
|
|
5
|
-
var h = Object.defineProperty,
|
|
6
|
-
for (var
|
|
7
|
-
(
|
|
8
|
-
return
|
|
5
|
+
var h = Object.defineProperty, y = Object.getOwnPropertyDescriptor, r = (e, t, o, n) => {
|
|
6
|
+
for (var l = n > 1 ? void 0 : n ? y(t, o) : t, c = e.length - 1, p; c >= 0; c--)
|
|
7
|
+
(p = e[c]) && (l = (n ? p(t, o, l) : p(l)) || l);
|
|
8
|
+
return n && l && h(t, o, l), l;
|
|
9
9
|
};
|
|
10
|
-
let
|
|
10
|
+
let i = class extends u {
|
|
11
11
|
constructor() {
|
|
12
|
-
super(...arguments), this.keyfigure = 0, this.subLabel = "", this.supportingText = "", this.cardHref = "", this.icon = "", this.size = "standard";
|
|
12
|
+
super(...arguments), this.keyfigure = 0, this.subLabel = "", this.supportingText = "", this.cardHref = "", this.icon = "", this.size = "standard", this.unit = "", this.fullHeight = !1, this.fullWidth = !1, this.stretch = !1;
|
|
13
|
+
}
|
|
14
|
+
formatNumber(e) {
|
|
15
|
+
if (typeof e == "number")
|
|
16
|
+
return e.toLocaleString("sv-SE").replace(/\u00A0/g, " ");
|
|
17
|
+
const t = Number(e);
|
|
18
|
+
return Number.isNaN(t) ? String(e) : t.toLocaleString("sv-SE").replace(/\u00A0/g, " ");
|
|
13
19
|
}
|
|
14
20
|
render() {
|
|
15
|
-
const
|
|
16
|
-
return
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
21
|
+
const e = !!this.cardHref, t = this.formatNumber(this.keyfigure);
|
|
22
|
+
return a`
|
|
23
|
+
<div
|
|
24
|
+
class="scb-keyfigure-card ${e ? "clickable" : ""} ${this.size}"
|
|
25
|
+
role=${e ? "link" : "group"}
|
|
26
|
+
tabindex=${e ? "0" : "-1"}
|
|
27
|
+
aria-label=${this.subLabel || ""}
|
|
28
|
+
>
|
|
29
|
+
${e ? a`<md-ripple></md-ripple>` : ""}
|
|
30
|
+
${this.icon ? a`<md-icon>${this.icon}</md-icon>` : ""}
|
|
31
|
+
|
|
32
|
+
${this.keyfigure !== void 0 && this.keyfigure !== null && this.keyfigure !== "" ? a`
|
|
33
|
+
<div class="keyfigure">
|
|
34
|
+
<span class="value">
|
|
35
|
+
${t}${this.unit ? a`<span class="unit">${this.unit}</span>` : ""}
|
|
36
|
+
</span>
|
|
37
|
+
${e ? a`<md-icon>arrow_forward</md-icon>` : ""}
|
|
38
|
+
</div>
|
|
39
|
+
` : ""}
|
|
40
|
+
|
|
41
|
+
${this.subLabel ? a`
|
|
42
|
+
<div class="sub-label">
|
|
43
|
+
${e ? a`<a href="${this.cardHref}" tabindex="-1">${this.subLabel}</a>` : this.subLabel}
|
|
44
|
+
</div>
|
|
45
|
+
` : ""}
|
|
46
|
+
|
|
47
|
+
${this.supportingText ? a`<div class="supporting-text">${this.supportingText}</div>` : ""}
|
|
48
|
+
</div>
|
|
49
|
+
`;
|
|
32
50
|
}
|
|
33
51
|
firstUpdated() {
|
|
34
52
|
if (this.cardHref) {
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
})
|
|
53
|
+
const e = this.renderRoot.querySelector(".scb-keyfigure-card");
|
|
54
|
+
e && (e.addEventListener("click", (t) => {
|
|
55
|
+
t.target.closest("a") || (window.location.href = this.cardHref);
|
|
56
|
+
}), e.addEventListener("keydown", (t) => {
|
|
57
|
+
(t.key === "Enter" || t.key === " ") && (t.preventDefault(), window.location.href = this.cardHref);
|
|
58
|
+
}));
|
|
39
59
|
}
|
|
40
60
|
}
|
|
41
61
|
};
|
|
42
|
-
|
|
43
|
-
:host{ --scb-card-
|
|
62
|
+
i.styles = d`
|
|
63
|
+
:host { --scb-keyfigure-card-max-w: var(--scb-card-max-w, 360px); }
|
|
64
|
+
|
|
44
65
|
:host {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
66
|
+
display: block;
|
|
67
|
+
box-sizing: border-box;
|
|
68
|
+
inline-size: 100%;
|
|
69
|
+
min-inline-size: 0;
|
|
70
|
+
max-inline-size: var(--scb-keyfigure-card-max-w);
|
|
48
71
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
max-width: var(--scb-card-min-w);
|
|
56
|
-
position: relative;
|
|
57
|
-
border-radius: var(--md-sys-shape-corner-large);
|
|
58
|
-
background: var(--md-sys-color-surface-dim);
|
|
59
|
-
padding: var(--spacing-7) var(--spacing-6);
|
|
72
|
+
:host([full-width]) { max-inline-size: none; }
|
|
73
|
+
:host([stretch]), :host([full-height]) { block-size: 100%; }
|
|
74
|
+
|
|
75
|
+
:host([stretch]) .scb-keyfigure-card,
|
|
76
|
+
:host([full-height]) .scb-keyfigure-card {
|
|
77
|
+
block-size: 100%;
|
|
60
78
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
79
|
+
|
|
80
|
+
.scb-keyfigure-card {
|
|
81
|
+
color: var(--md-sys-color-on-surface);
|
|
82
|
+
display: flex;
|
|
83
|
+
flex-direction: column;
|
|
84
|
+
gap: var(--spacing-3);
|
|
85
|
+
position: relative;
|
|
86
|
+
border-radius: var(--md-sys-shape-corner-large);
|
|
87
|
+
background: var(--md-sys-color-surface-dim);
|
|
88
|
+
padding: var(--spacing-7);
|
|
89
|
+
box-sizing: border-box;
|
|
90
|
+
inline-size: 100%;
|
|
91
|
+
max-inline-size: 100%;
|
|
92
|
+
overflow: hidden;
|
|
71
93
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
94
|
+
|
|
95
|
+
.keyfigure {
|
|
96
|
+
display: flex;
|
|
97
|
+
justify-content: space-between;
|
|
98
|
+
align-items: center;
|
|
99
|
+
gap: var(--spacing-3);
|
|
100
|
+
font-size: var(--md-sys-typescale-headline-large-size);
|
|
101
|
+
font-weight: var(--weight-bold);
|
|
102
|
+
line-height: var(--md-sys-typescale-headline-large-line-height);
|
|
103
|
+
letter-spacing: var(--md-sys-typescale-headline-large-tracking);
|
|
75
104
|
}
|
|
105
|
+
.keyfigure .value { white-space: nowrap; }
|
|
106
|
+
.keyfigure .unit { margin-inline-start: .25em; }
|
|
107
|
+
|
|
76
108
|
.sub-label {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
109
|
+
font-size: var(--md-sys-typescale-title-medium-size);
|
|
110
|
+
font-weight: var(--weight-semibold);
|
|
111
|
+
line-height: var(--md-sys-typescale-title-medium-line-height);
|
|
112
|
+
letter-spacing: var(--md-sys-typescale-title-medium-tracking);
|
|
81
113
|
}
|
|
114
|
+
.sub-label a { color: inherit; text-decoration: none; }
|
|
115
|
+
|
|
82
116
|
.supporting-text {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}
|
|
87
|
-
.scb-keyfigure-card.clickable {
|
|
88
|
-
cursor: pointer;
|
|
117
|
+
font-size: var(--md-sys-typescale-body-large-size);
|
|
118
|
+
line-height: var(--md-sys-typescale-body-large-line-height);
|
|
119
|
+
letter-spacing: var(--md-sys-typescale-body-large-tracking);
|
|
89
120
|
}
|
|
121
|
+
|
|
122
|
+
.scb-keyfigure-card.clickable { cursor: pointer; }
|
|
123
|
+
|
|
90
124
|
.scb-keyfigure-card.large .keyfigure {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
125
|
+
font-size: var(--md-sys-typescale-display-medium-size);
|
|
126
|
+
line-height: var(--md-sys-typescale-display-medium-line-height);
|
|
127
|
+
letter-spacing: var(--md-sys-typescale-display-medium-tracking);
|
|
94
128
|
}
|
|
95
129
|
`;
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
],
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
],
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
],
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
],
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
],
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
],
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
],
|
|
130
|
+
r([
|
|
131
|
+
s({ attribute: "keyfigure" })
|
|
132
|
+
], i.prototype, "keyfigure", 2);
|
|
133
|
+
r([
|
|
134
|
+
s({ type: String, attribute: "sub-label" })
|
|
135
|
+
], i.prototype, "subLabel", 2);
|
|
136
|
+
r([
|
|
137
|
+
s({ type: String, attribute: "supporting-text" })
|
|
138
|
+
], i.prototype, "supportingText", 2);
|
|
139
|
+
r([
|
|
140
|
+
s({ type: String, attribute: "card-href" })
|
|
141
|
+
], i.prototype, "cardHref", 2);
|
|
142
|
+
r([
|
|
143
|
+
s({ type: String })
|
|
144
|
+
], i.prototype, "icon", 2);
|
|
145
|
+
r([
|
|
146
|
+
s({ type: String })
|
|
147
|
+
], i.prototype, "size", 2);
|
|
148
|
+
r([
|
|
149
|
+
s({ type: String })
|
|
150
|
+
], i.prototype, "unit", 2);
|
|
151
|
+
r([
|
|
152
|
+
s({ type: Boolean, reflect: !0, attribute: "full-height" })
|
|
153
|
+
], i.prototype, "fullHeight", 2);
|
|
154
|
+
r([
|
|
155
|
+
s({ type: Boolean, reflect: !0, attribute: "full-width" })
|
|
156
|
+
], i.prototype, "fullWidth", 2);
|
|
157
|
+
r([
|
|
158
|
+
s({ type: Boolean, reflect: !0 })
|
|
159
|
+
], i.prototype, "stretch", 2);
|
|
160
|
+
i = r([
|
|
161
|
+
g("scb-keyfigure-card")
|
|
162
|
+
], i);
|
|
117
163
|
export {
|
|
118
|
-
|
|
164
|
+
i as ScbKeyFigureCard
|
|
119
165
|
};
|