scb-wc-test 0.1.105 → 0.1.106
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 +15 -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 +3 -2
- 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 +6 -1
- package/scb-icon-button/scb-icon-button.js +81 -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 +41 -4
- package/scb-segmented-button/scb-segmented-button.js +145 -61
- 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 +1171 -890
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import { css as
|
|
2
|
-
import { property as
|
|
1
|
+
import { css as b, LitElement as g, html as a } from "lit";
|
|
2
|
+
import { property as r, customElement as f } from "lit/decorators.js";
|
|
3
3
|
import "@material/web/icon/icon.js";
|
|
4
|
-
var
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
var m = Object.defineProperty, v = Object.getOwnPropertyDescriptor, _ = (t) => {
|
|
5
|
+
throw TypeError(t);
|
|
6
|
+
}, o = (t, e, i, l) => {
|
|
7
|
+
for (var n = l > 1 ? void 0 : l ? v(e, i) : e, d = t.length - 1, h; d >= 0; d--)
|
|
8
|
+
(h = t[d]) && (n = (l ? h(e, i, n) : h(n)) || n);
|
|
9
|
+
return l && n && m(e, i, n), n;
|
|
10
|
+
}, y = (t, e, i) => e.has(t) || _("Cannot " + i), $ = (t, e, i) => e.has(t) ? _("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, i), p = (t, e, i) => (y(t, e, "access private method"), i), c, u;
|
|
11
|
+
let s = class extends g {
|
|
10
12
|
constructor() {
|
|
11
|
-
super(...arguments), this.icon = "home", this.tooltip = "", this.ariaLabel = "", this.variant = "standard", this.toggle = !1, this.selected = !1, this.toggleofficon = "add", this.toggleonicon = "remove", this.disabled = !1, this.__loadedVariants = /* @__PURE__ */ new Set(), this.__iconLoaded = !1, this.__lastMdHost = null, this.__onInnerChange = () => {
|
|
13
|
+
super(...arguments), $(this, c), this.icon = "home", this.tooltip = "", this.ariaLabel = "", this.variant = "standard", this.toggle = !1, this.selected = !1, this.toggleofficon = "add", this.toggleonicon = "remove", this.disabled = !1, this.spacing = "", this.__loadedVariants = /* @__PURE__ */ new Set(), this.__iconLoaded = !1, this.__lastMdHost = null, this.__onInnerChange = () => {
|
|
12
14
|
const t = this.__getMdHost(), e = !!(t != null && t.selected);
|
|
13
15
|
this.toggle && (this.selected = e), this.dispatchEvent(
|
|
14
16
|
new CustomEvent("change", {
|
|
@@ -20,10 +22,10 @@ let i = class extends u {
|
|
|
20
22
|
};
|
|
21
23
|
}
|
|
22
24
|
async firstUpdated() {
|
|
23
|
-
await this.__ensureDepsLoaded(), await this.updateComplete, this.__attachChangeListener(), this.__syncTitleAndAria();
|
|
25
|
+
await this.__ensureDepsLoaded(), await this.updateComplete, this.__attachChangeListener(), this.__syncTitleAndAria(), p(this, c, u).call(this);
|
|
24
26
|
}
|
|
25
27
|
updated(t) {
|
|
26
|
-
if (super.updated(t), t.has("variant")) {
|
|
28
|
+
if (super.updated(t), t.has("spacing") && p(this, c, u).call(this), t.has("variant")) {
|
|
27
29
|
this.__ensureDepsLoaded().then(() => {
|
|
28
30
|
queueMicrotask(() => {
|
|
29
31
|
this.__attachChangeListener(), this.__syncTitleAndAria();
|
|
@@ -67,35 +69,42 @@ let i = class extends u {
|
|
|
67
69
|
}
|
|
68
70
|
/** Koppla change-event från md-* samt spegla selected. */
|
|
69
71
|
__attachChangeListener() {
|
|
70
|
-
var e,
|
|
72
|
+
var e, i;
|
|
71
73
|
const t = this.__getMdHost();
|
|
72
|
-
t && t !== this.__lastMdHost && ((
|
|
74
|
+
t && t !== this.__lastMdHost && ((i = (e = this.__lastMdHost) == null ? void 0 : e.removeEventListener) == null || i.call(e, "change", this.__onInnerChange), t.addEventListener("change", this.__onInnerChange), this.__lastMdHost = t), this.toggle && t && "selected" in t && (t.selected = this.selected);
|
|
73
75
|
}
|
|
74
76
|
/**
|
|
75
|
-
* Synkar native title och aria-* mellan host och md-*.
|
|
77
|
+
* Synkar native title och aria-* mellan host och md-*.
|
|
78
|
+
*/
|
|
76
79
|
__syncTitleAndAria() {
|
|
77
80
|
const t = this.__getMdHost();
|
|
78
81
|
if (!t) return;
|
|
79
|
-
const e = (this.tooltip || this.getAttribute("title") || "").trim(),
|
|
82
|
+
const e = (this.tooltip || this.getAttribute("title") || "").trim(), i = (this.ariaLabel || this.getAttribute("aria-label") || "").trim(), l = this.getAttribute("aria-controls"), n = this.getAttribute("aria-expanded");
|
|
80
83
|
this.tooltip && this.setAttribute("title", e);
|
|
81
|
-
const d =
|
|
82
|
-
d ? t.setAttribute("aria-label", d) : t.removeAttribute("aria-label"), e ? t.setAttribute("title", e) : t.removeAttribute("title"),
|
|
84
|
+
const d = i || e || this.icon.trim() || void 0;
|
|
85
|
+
d ? t.setAttribute("aria-label", d) : t.removeAttribute("aria-label"), e ? t.setAttribute("title", e) : t.removeAttribute("title"), l !== null ? t.setAttribute("aria-controls", l) : t.removeAttribute("aria-controls"), n !== null ? t.setAttribute("aria-expanded", n) : t.removeAttribute("aria-expanded");
|
|
86
|
+
}
|
|
87
|
+
mapSpacingToken(t) {
|
|
88
|
+
if (!t) return;
|
|
89
|
+
const e = String(t).trim();
|
|
90
|
+
if (e)
|
|
91
|
+
return /^\d+$/.test(e) ? `var(--spacing-${Math.max(0, Math.min(14, parseInt(e, 10)))})` : e;
|
|
83
92
|
}
|
|
84
93
|
__renderToggleIcons() {
|
|
85
|
-
return
|
|
94
|
+
return a`
|
|
86
95
|
<md-icon aria-hidden="true">${this.toggleofficon}</md-icon>
|
|
87
96
|
<md-icon slot="selected" aria-hidden="true">${this.toggleonicon}</md-icon>
|
|
88
97
|
`;
|
|
89
98
|
}
|
|
90
99
|
__renderSingleIcon() {
|
|
91
|
-
return
|
|
100
|
+
return a`<md-icon aria-hidden="true">${this.icon}</md-icon>`;
|
|
92
101
|
}
|
|
93
102
|
__renderMd() {
|
|
94
103
|
const t = this.toggle ? this.__renderToggleIcons() : this.__renderSingleIcon();
|
|
95
104
|
if (this.toggle)
|
|
96
105
|
switch (this.variant) {
|
|
97
106
|
case "filled":
|
|
98
|
-
return
|
|
107
|
+
return a`
|
|
99
108
|
<md-filled-icon-button
|
|
100
109
|
toggle
|
|
101
110
|
?selected=${this.selected}
|
|
@@ -105,7 +114,7 @@ let i = class extends u {
|
|
|
105
114
|
</md-filled-icon-button>
|
|
106
115
|
`;
|
|
107
116
|
case "outlined":
|
|
108
|
-
return
|
|
117
|
+
return a`
|
|
109
118
|
<md-outlined-icon-button
|
|
110
119
|
toggle
|
|
111
120
|
?selected=${this.selected}
|
|
@@ -115,7 +124,7 @@ let i = class extends u {
|
|
|
115
124
|
</md-outlined-icon-button>
|
|
116
125
|
`;
|
|
117
126
|
case "filled-tonal":
|
|
118
|
-
return
|
|
127
|
+
return a`
|
|
119
128
|
<md-filled-tonal-icon-button
|
|
120
129
|
toggle
|
|
121
130
|
?selected=${this.selected}
|
|
@@ -125,7 +134,7 @@ let i = class extends u {
|
|
|
125
134
|
</md-filled-tonal-icon-button>
|
|
126
135
|
`;
|
|
127
136
|
default:
|
|
128
|
-
return
|
|
137
|
+
return a`
|
|
129
138
|
<md-icon-button toggle ?selected=${this.selected} ?disabled=${this.disabled}>
|
|
130
139
|
${t}
|
|
131
140
|
</md-icon-button>
|
|
@@ -133,25 +142,25 @@ let i = class extends u {
|
|
|
133
142
|
}
|
|
134
143
|
switch (this.variant) {
|
|
135
144
|
case "filled":
|
|
136
|
-
return
|
|
145
|
+
return a`
|
|
137
146
|
<md-filled-icon-button ?disabled=${this.disabled}>
|
|
138
147
|
${t}
|
|
139
148
|
</md-filled-icon-button>
|
|
140
149
|
`;
|
|
141
150
|
case "outlined":
|
|
142
|
-
return
|
|
151
|
+
return a`
|
|
143
152
|
<md-outlined-icon-button ?disabled=${this.disabled}>
|
|
144
153
|
${t}
|
|
145
154
|
</md-outlined-icon-button>
|
|
146
155
|
`;
|
|
147
156
|
case "filled-tonal":
|
|
148
|
-
return
|
|
157
|
+
return a`
|
|
149
158
|
<md-filled-tonal-icon-button ?disabled=${this.disabled}>
|
|
150
159
|
${t}
|
|
151
160
|
</md-filled-tonal-icon-button>
|
|
152
161
|
`;
|
|
153
162
|
default:
|
|
154
|
-
return
|
|
163
|
+
return a`
|
|
155
164
|
<md-icon-button ?disabled=${this.disabled}>
|
|
156
165
|
${t}
|
|
157
166
|
</md-icon-button>
|
|
@@ -162,37 +171,50 @@ let i = class extends u {
|
|
|
162
171
|
return this.__renderMd();
|
|
163
172
|
}
|
|
164
173
|
};
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
174
|
+
c = /* @__PURE__ */ new WeakSet();
|
|
175
|
+
u = function() {
|
|
176
|
+
const t = this.mapSpacingToken(this.spacing);
|
|
177
|
+
t ? this.style.setProperty("--scb-icon-button-spacing-block", t) : this.style.removeProperty("--scb-icon-button-spacing-block");
|
|
178
|
+
};
|
|
179
|
+
s.styles = b`
|
|
180
|
+
:host {
|
|
181
|
+
display: inline-flex;
|
|
182
|
+
margin-block: var(--scb-icon-button-spacing-block, 0);
|
|
183
|
+
}
|
|
184
|
+
`;
|
|
185
|
+
o([
|
|
186
|
+
r({ type: String })
|
|
187
|
+
], s.prototype, "icon", 2);
|
|
188
|
+
o([
|
|
189
|
+
r({ type: String })
|
|
190
|
+
], s.prototype, "tooltip", 2);
|
|
191
|
+
o([
|
|
192
|
+
r({ type: String, attribute: "aria-label" })
|
|
193
|
+
], s.prototype, "ariaLabel", 2);
|
|
194
|
+
o([
|
|
195
|
+
r({ type: String })
|
|
196
|
+
], s.prototype, "variant", 2);
|
|
197
|
+
o([
|
|
198
|
+
r({ type: Boolean, reflect: !0 })
|
|
199
|
+
], s.prototype, "toggle", 2);
|
|
200
|
+
o([
|
|
201
|
+
r({ type: Boolean, reflect: !0 })
|
|
202
|
+
], s.prototype, "selected", 2);
|
|
203
|
+
o([
|
|
204
|
+
r({ type: String })
|
|
205
|
+
], s.prototype, "toggleofficon", 2);
|
|
206
|
+
o([
|
|
207
|
+
r({ type: String })
|
|
208
|
+
], s.prototype, "toggleonicon", 2);
|
|
209
|
+
o([
|
|
210
|
+
r({ type: Boolean, reflect: !0 })
|
|
211
|
+
], s.prototype, "disabled", 2);
|
|
212
|
+
o([
|
|
213
|
+
r({ type: String, reflect: !0 })
|
|
214
|
+
], s.prototype, "spacing", 2);
|
|
215
|
+
s = o([
|
|
216
|
+
f("scb-icon-button")
|
|
217
|
+
], s);
|
|
196
218
|
export {
|
|
197
|
-
|
|
219
|
+
s as ScbIconButton
|
|
198
220
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { LitElement, PropertyValues } from 'lit';
|
|
2
2
|
export declare class ScbKeyFigureCard extends LitElement {
|
|
3
|
+
#private;
|
|
3
4
|
private static __iconLoaded;
|
|
4
5
|
private static __rippleLoaded;
|
|
5
6
|
keyfigure: number | string;
|
|
@@ -14,12 +15,21 @@ export declare class ScbKeyFigureCard extends LitElement {
|
|
|
14
15
|
height: string;
|
|
15
16
|
maxHeight: string;
|
|
16
17
|
sizing: 'stretch' | 'content-width' | 'content-height';
|
|
18
|
+
/**
|
|
19
|
+
* Vertikalt avstånd till omgivande innehåll.
|
|
20
|
+
* spacing sätter både top och bottom om spacing-top/spacing-bottom inte är satta.
|
|
21
|
+
* "N" (0–14) mappas till var(--spacing-N), annars valfritt CSS-värde (t.ex. "16px" eller "var(--spacing-6)").
|
|
22
|
+
*/
|
|
23
|
+
spacing: string;
|
|
24
|
+
spacingTop: string;
|
|
25
|
+
spacingBottom: string;
|
|
17
26
|
static styles: import('lit').CSSResult;
|
|
18
27
|
private formatNumber;
|
|
19
28
|
protected firstUpdated(): Promise<void>;
|
|
20
29
|
render(): import('lit-html').TemplateResult<1>;
|
|
21
30
|
private __applyInnerSizing;
|
|
22
31
|
protected updated(changed: PropertyValues): void;
|
|
32
|
+
private mapSpacingToken;
|
|
23
33
|
private __onKeyDown;
|
|
24
34
|
private __handleHrefNavigation;
|
|
25
35
|
}
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import { css as
|
|
2
|
-
import { property as
|
|
1
|
+
import { css as u, LitElement as f, html as l } from "lit";
|
|
2
|
+
import { property as a, customElement as m } from "lit/decorators.js";
|
|
3
3
|
import "@material/web/focus/md-focus-ring.js";
|
|
4
|
-
var
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
var b = Object.defineProperty, v = Object.getOwnPropertyDescriptor, y = (e) => {
|
|
5
|
+
throw TypeError(e);
|
|
6
|
+
}, s = (e, t, r, n) => {
|
|
7
|
+
for (var o = n > 1 ? void 0 : n ? v(t, r) : t, p = e.length - 1, h; p >= 0; p--)
|
|
8
|
+
(h = e[p]) && (o = (n ? h(t, r, o) : h(o)) || o);
|
|
9
|
+
return n && o && b(t, r, o), o;
|
|
10
|
+
}, k = (e, t, r) => t.has(e) || y("Cannot " + r), z = (e, t, r) => t.has(e) ? y("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, r), g = (e, t, r) => (k(e, t, "access private method"), r), c, d;
|
|
11
|
+
let i = class extends f {
|
|
10
12
|
constructor() {
|
|
11
|
-
super(...arguments), this.keyfigure = 0, this.subtitle = "", this.supportingText = "", this.cardHref = "", this.icon = "", this.size = "standard", this.unit = "", this.width = "", this.maxWidth = "", this.height = "", this.maxHeight = "", this.sizing = "stretch", this.__onKeyDown = (e) => {
|
|
13
|
+
super(...arguments), z(this, c), this.keyfigure = 0, this.subtitle = "", this.supportingText = "", this.cardHref = "", this.icon = "", this.size = "standard", this.unit = "", this.width = "", this.maxWidth = "", this.height = "", this.maxHeight = "", this.sizing = "stretch", this.spacing = "", this.spacingTop = "", this.spacingBottom = "", this.__onKeyDown = (e) => {
|
|
12
14
|
(e.key === "Enter" || e.key === " ") && this.cardHref && (e.preventDefault(), window.location.href = this.cardHref);
|
|
13
15
|
}, this.__handleHrefNavigation = (e) => {
|
|
14
16
|
this.cardHref && (e.target.closest("a") || (window.location.href = this.cardHref));
|
|
@@ -17,43 +19,43 @@ let i = class extends d {
|
|
|
17
19
|
formatNumber(e) {
|
|
18
20
|
if (typeof e == "number")
|
|
19
21
|
return e.toLocaleString("sv-SE").replace(/\u00A0/g, " ");
|
|
20
|
-
const
|
|
21
|
-
return Number.isNaN(
|
|
22
|
+
const t = Number(e);
|
|
23
|
+
return Number.isNaN(t) ? String(e) : t.toLocaleString("sv-SE").replace(/\u00A0/g, " ");
|
|
22
24
|
}
|
|
23
25
|
async firstUpdated() {
|
|
24
|
-
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();
|
|
26
|
+
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, c, d).call(this);
|
|
25
27
|
}
|
|
26
28
|
render() {
|
|
27
|
-
const e = !!this.cardHref,
|
|
28
|
-
return
|
|
29
|
+
const e = !!this.cardHref, t = this.formatNumber(this.keyfigure), r = (this.unit || "").trim(), n = r ? `${t} ${r}` : t;
|
|
30
|
+
return l`
|
|
29
31
|
<div
|
|
30
32
|
class="scb-keyfigure-card ${e ? "clickable" : ""} ${this.size}"
|
|
31
33
|
role=${e ? "link" : "group"}
|
|
32
34
|
tabindex=${e ? "0" : "-1"}
|
|
33
|
-
aria-label=${this.subtitle ||
|
|
35
|
+
aria-label=${this.subtitle || n}
|
|
34
36
|
@click=${e ? this.__handleHrefNavigation : null}
|
|
35
37
|
@keydown=${e ? this.__onKeyDown : null}
|
|
36
38
|
style="cursor:${e ? "pointer" : "default"};"
|
|
37
39
|
>
|
|
38
|
-
${e ?
|
|
39
|
-
${this.icon ?
|
|
40
|
+
${e ? l`<md-ripple></md-ripple>` : ""}
|
|
41
|
+
${this.icon ? l`<md-icon>${this.icon}</md-icon>` : ""}
|
|
40
42
|
|
|
41
|
-
${this.keyfigure !== void 0 && this.keyfigure !== null && this.keyfigure !== "" ?
|
|
43
|
+
${this.keyfigure !== void 0 && this.keyfigure !== null && this.keyfigure !== "" ? l`
|
|
42
44
|
<div class="keyfigure">
|
|
43
|
-
<span class="value" aria-label="${
|
|
44
|
-
${
|
|
45
|
+
<span class="value" aria-label="${n}">
|
|
46
|
+
${t}${r ? l`<span class="unit" aria-hidden="true">\u00A0${r}</span>` : ""}
|
|
45
47
|
</span>
|
|
46
|
-
${e ?
|
|
48
|
+
${e ? l`<md-icon>arrow_forward</md-icon>` : ""}
|
|
47
49
|
</div>
|
|
48
50
|
` : ""}
|
|
49
51
|
|
|
50
|
-
${this.subtitle ?
|
|
52
|
+
${this.subtitle ? l`
|
|
51
53
|
<div class="sub-label">
|
|
52
|
-
${e ?
|
|
54
|
+
${e ? l`<a href="${this.cardHref}" tabindex="-1">${this.subtitle}</a>` : this.subtitle}
|
|
53
55
|
</div>
|
|
54
56
|
` : ""}
|
|
55
57
|
|
|
56
|
-
${this.supportingText ?
|
|
58
|
+
${this.supportingText ? l`<div class="supporting-text">${this.supportingText}</div>` : ""}
|
|
57
59
|
</div>
|
|
58
60
|
|
|
59
61
|
<md-focus-ring></md-focus-ring>
|
|
@@ -65,12 +67,23 @@ let i = class extends d {
|
|
|
65
67
|
this.width && this.width.trim() !== "" ? (e.style.inlineSize = "100%", e.style.maxInlineSize = "100%") : (e.style.removeProperty("inline-size"), e.style.removeProperty("max-inline-size")), this.height && this.height.trim() !== "" || this.sizing === "stretch" ? e.style.blockSize = "100%" : e.style.removeProperty("block-size"), this.maxHeight && this.maxHeight.trim() !== "" ? e.style.maxBlockSize = "100%" : e.style.removeProperty("max-block-size");
|
|
66
68
|
}
|
|
67
69
|
updated(e) {
|
|
68
|
-
super.updated(e), 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("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("width") || e.has("height") || e.has("maxHeight") || e.has("sizing")) && this.__applyInnerSizing();
|
|
70
|
+
super.updated(e), 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("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("width") || e.has("height") || e.has("maxHeight") || e.has("sizing")) && this.__applyInnerSizing(), (e.has("spacing") || e.has("spacingTop") || e.has("spacingBottom")) && g(this, c, d).call(this);
|
|
71
|
+
}
|
|
72
|
+
mapSpacingToken(e) {
|
|
73
|
+
if (!e) return;
|
|
74
|
+
const t = String(e).trim();
|
|
75
|
+
if (t)
|
|
76
|
+
return /^\d+$/.test(t) ? `var(--spacing-${Math.max(0, Math.min(14, parseInt(t, 10)))})` : t;
|
|
69
77
|
}
|
|
70
78
|
};
|
|
79
|
+
c = /* @__PURE__ */ new WeakSet();
|
|
80
|
+
d = function() {
|
|
81
|
+
const e = this.mapSpacingToken(this.spacing), t = this.mapSpacingToken(this.spacingTop), r = this.mapSpacingToken(this.spacingBottom), n = t ?? e, o = r ?? e;
|
|
82
|
+
n ? this.style.setProperty("--scb-keyfigure-card-spacing-block-start", n) : this.style.removeProperty("--scb-keyfigure-card-spacing-block-start"), o ? this.style.setProperty("--scb-keyfigure-card-spacing-block-end", o) : this.style.removeProperty("--scb-keyfigure-card-spacing-block-end");
|
|
83
|
+
};
|
|
71
84
|
i.__iconLoaded = !1;
|
|
72
85
|
i.__rippleLoaded = !1;
|
|
73
|
-
i.styles =
|
|
86
|
+
i.styles = u`
|
|
74
87
|
:host {
|
|
75
88
|
display: block;
|
|
76
89
|
box-sizing: border-box;
|
|
@@ -78,6 +91,8 @@ i.styles = p`
|
|
|
78
91
|
inline-size: 100%;
|
|
79
92
|
min-inline-size: 0;
|
|
80
93
|
padding: var(--scb-keyfigure-card-focus-ring-gap, 4px);
|
|
94
|
+
margin-block-start: var(--scb-keyfigure-card-spacing-block-start, 0);
|
|
95
|
+
margin-block-end: var(--scb-keyfigure-card-spacing-block-end, 0);
|
|
81
96
|
}
|
|
82
97
|
|
|
83
98
|
/* Ska vi ha tabulära eller inte? */
|
|
@@ -187,44 +202,53 @@ i.styles = p`
|
|
|
187
202
|
letter-spacing: var(--md-sys-typescale-display-medium-tracking);
|
|
188
203
|
}
|
|
189
204
|
`;
|
|
190
|
-
|
|
191
|
-
|
|
205
|
+
s([
|
|
206
|
+
a({ attribute: "keyfigure" })
|
|
192
207
|
], i.prototype, "keyfigure", 2);
|
|
193
|
-
|
|
194
|
-
|
|
208
|
+
s([
|
|
209
|
+
a({ type: String, attribute: "subtitle" })
|
|
195
210
|
], i.prototype, "subtitle", 2);
|
|
196
|
-
|
|
197
|
-
|
|
211
|
+
s([
|
|
212
|
+
a({ type: String, attribute: "supporting-text" })
|
|
198
213
|
], i.prototype, "supportingText", 2);
|
|
199
|
-
|
|
200
|
-
|
|
214
|
+
s([
|
|
215
|
+
a({ type: String, attribute: "card-href" })
|
|
201
216
|
], i.prototype, "cardHref", 2);
|
|
202
|
-
|
|
203
|
-
|
|
217
|
+
s([
|
|
218
|
+
a({ type: String })
|
|
204
219
|
], i.prototype, "icon", 2);
|
|
205
|
-
|
|
206
|
-
|
|
220
|
+
s([
|
|
221
|
+
a({ type: String })
|
|
207
222
|
], i.prototype, "size", 2);
|
|
208
|
-
|
|
209
|
-
|
|
223
|
+
s([
|
|
224
|
+
a({ type: String })
|
|
210
225
|
], i.prototype, "unit", 2);
|
|
211
|
-
|
|
212
|
-
|
|
226
|
+
s([
|
|
227
|
+
a({ type: String, reflect: !0 })
|
|
213
228
|
], i.prototype, "width", 2);
|
|
214
|
-
|
|
215
|
-
|
|
229
|
+
s([
|
|
230
|
+
a({ type: String, reflect: !0, attribute: "max-width" })
|
|
216
231
|
], i.prototype, "maxWidth", 2);
|
|
217
|
-
|
|
218
|
-
|
|
232
|
+
s([
|
|
233
|
+
a({ type: String, reflect: !0 })
|
|
219
234
|
], i.prototype, "height", 2);
|
|
220
|
-
|
|
221
|
-
|
|
235
|
+
s([
|
|
236
|
+
a({ type: String, reflect: !0, attribute: "max-height" })
|
|
222
237
|
], i.prototype, "maxHeight", 2);
|
|
223
|
-
|
|
224
|
-
|
|
238
|
+
s([
|
|
239
|
+
a({ type: String, reflect: !0 })
|
|
225
240
|
], i.prototype, "sizing", 2);
|
|
226
|
-
|
|
227
|
-
|
|
241
|
+
s([
|
|
242
|
+
a({ type: String, reflect: !0 })
|
|
243
|
+
], i.prototype, "spacing", 2);
|
|
244
|
+
s([
|
|
245
|
+
a({ type: String, reflect: !0, attribute: "spacing-top" })
|
|
246
|
+
], i.prototype, "spacingTop", 2);
|
|
247
|
+
s([
|
|
248
|
+
a({ type: String, reflect: !0, attribute: "spacing-bottom" })
|
|
249
|
+
], i.prototype, "spacingBottom", 2);
|
|
250
|
+
i = s([
|
|
251
|
+
m("scb-keyfigure-card")
|
|
228
252
|
], i);
|
|
229
253
|
export {
|
|
230
254
|
i as ScbKeyFigureCard
|
package/scb-list/scb-list.d.ts
CHANGED
|
@@ -1,13 +1,19 @@
|
|
|
1
|
-
import { LitElement, TemplateResult } from 'lit';
|
|
1
|
+
import { LitElement, TemplateResult, PropertyValues } from 'lit';
|
|
2
2
|
export declare class ScbList extends LitElement {
|
|
3
3
|
#private;
|
|
4
4
|
noDivider: boolean;
|
|
5
|
+
spacing: string;
|
|
6
|
+
spacingTop: string;
|
|
7
|
+
spacingBottom: string;
|
|
5
8
|
private _slotEl;
|
|
6
9
|
protected firstUpdated(): Promise<void>;
|
|
10
|
+
protected updated(changed: PropertyValues): void;
|
|
7
11
|
private _onSlotChange;
|
|
8
12
|
private _getItems;
|
|
9
13
|
private _setupItems;
|
|
10
14
|
private _onKeyDown;
|
|
15
|
+
private _mapSpacingToken;
|
|
16
|
+
private _applySpacing;
|
|
11
17
|
static styles: import('lit').CSSResult[];
|
|
12
18
|
render(): TemplateResult;
|
|
13
19
|
}
|
package/scb-list/scb-list.js
CHANGED
|
@@ -1,69 +1,82 @@
|
|
|
1
|
-
import { css as
|
|
2
|
-
import { property as
|
|
1
|
+
import { css as g, LitElement as u, html as f } from "lit";
|
|
2
|
+
import { property as c, query as v, customElement as _ } from "lit/decorators.js";
|
|
3
3
|
import "./scb-list-item.js";
|
|
4
|
-
var
|
|
4
|
+
var b = Object.defineProperty, y = Object.getOwnPropertyDescriptor, d = (e) => {
|
|
5
5
|
throw TypeError(e);
|
|
6
|
-
},
|
|
7
|
-
for (var i =
|
|
8
|
-
(
|
|
9
|
-
return
|
|
10
|
-
},
|
|
11
|
-
let
|
|
6
|
+
}, o = (e, t, s, r) => {
|
|
7
|
+
for (var i = r > 1 ? void 0 : r ? y(t, s) : t, p = e.length - 1, n; p >= 0; p--)
|
|
8
|
+
(n = e[p]) && (i = (r ? n(t, s, i) : n(i)) || i);
|
|
9
|
+
return r && i && b(t, s, i), i;
|
|
10
|
+
}, h = (e, t, s) => t.has(e) || d("Cannot " + s), k = (e, t, s) => (h(e, t, "read from private field"), t.get(e)), S = (e, t, s) => t.has(e) ? d("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, s), w = (e, t, s, r) => (h(e, t, "write to private field"), t.set(e, s), s), l;
|
|
11
|
+
let a = class extends u {
|
|
12
12
|
constructor() {
|
|
13
|
-
super(...arguments),
|
|
13
|
+
super(...arguments), S(this, l, !1), this.noDivider = !1, this.spacing = "", this.spacingTop = "", this.spacingBottom = "", this._onSlotChange = () => this._setupItems();
|
|
14
14
|
}
|
|
15
15
|
async firstUpdated() {
|
|
16
|
-
|
|
16
|
+
k(this, l) || (await import("@material/web/list/list.js"), w(this, l, !0)), this._setupItems(), this._applySpacing();
|
|
17
|
+
}
|
|
18
|
+
updated(e) {
|
|
19
|
+
super.updated(e), (e.has("spacing") || e.has("spacingTop") || e.has("spacingBottom")) && this._applySpacing();
|
|
17
20
|
}
|
|
18
21
|
_getItems() {
|
|
19
22
|
var t;
|
|
20
|
-
return (((t = this._slotEl) == null ? void 0 : t.assignedElements({ flatten: !0 })) ?? []).filter((
|
|
23
|
+
return (((t = this._slotEl) == null ? void 0 : t.assignedElements({ flatten: !0 })) ?? []).filter((s) => s instanceof HTMLElement);
|
|
21
24
|
}
|
|
22
25
|
_setupItems() {
|
|
23
|
-
var
|
|
24
|
-
this._getItems().forEach((
|
|
25
|
-
|
|
26
|
+
var s;
|
|
27
|
+
this._getItems().forEach((r, i) => {
|
|
28
|
+
r.hasAttribute("role") || r.setAttribute("role", "listitem"), r.setAttribute("tabindex", i === 0 ? "0" : "-1");
|
|
26
29
|
});
|
|
27
|
-
const t = (
|
|
28
|
-
t && !t.hasAttribute("data-kbd") && (t.setAttribute("data-kbd", "true"), t.addEventListener("keydown", (
|
|
30
|
+
const t = (s = this.renderRoot) == null ? void 0 : s.querySelector("md-list");
|
|
31
|
+
t && !t.hasAttribute("data-kbd") && (t.setAttribute("data-kbd", "true"), t.addEventListener("keydown", (r) => this._onKeyDown(r)));
|
|
29
32
|
}
|
|
30
33
|
_onKeyDown(e) {
|
|
31
34
|
const t = this._getItems();
|
|
32
35
|
if (!t.length) return;
|
|
33
|
-
const
|
|
34
|
-
const
|
|
35
|
-
t.forEach((
|
|
36
|
-
const
|
|
37
|
-
|
|
36
|
+
const s = t.findIndex((i) => i.getAttribute("tabindex") === "0"), r = (i) => {
|
|
37
|
+
const p = (i % t.length + t.length) % t.length;
|
|
38
|
+
t.forEach((m) => m.setAttribute("tabindex", "-1"));
|
|
39
|
+
const n = t[p];
|
|
40
|
+
n.setAttribute("tabindex", "0"), n.focus();
|
|
38
41
|
};
|
|
39
42
|
switch (e.key) {
|
|
40
43
|
case "ArrowDown":
|
|
41
44
|
case "ArrowRight":
|
|
42
|
-
e.preventDefault(), s
|
|
45
|
+
e.preventDefault(), r(s < 0 ? 0 : s + 1);
|
|
43
46
|
break;
|
|
44
47
|
case "ArrowUp":
|
|
45
48
|
case "ArrowLeft":
|
|
46
|
-
e.preventDefault(), s
|
|
49
|
+
e.preventDefault(), r(s < 0 ? 0 : s - 1);
|
|
47
50
|
break;
|
|
48
51
|
case "Home":
|
|
49
|
-
e.preventDefault(),
|
|
52
|
+
e.preventDefault(), r(0);
|
|
50
53
|
break;
|
|
51
54
|
case "End":
|
|
52
|
-
e.preventDefault(),
|
|
55
|
+
e.preventDefault(), r(t.length - 1);
|
|
53
56
|
break;
|
|
54
57
|
}
|
|
55
58
|
}
|
|
59
|
+
_mapSpacingToken(e) {
|
|
60
|
+
if (!e) return;
|
|
61
|
+
const t = String(e).trim();
|
|
62
|
+
if (t)
|
|
63
|
+
return /^\d+$/.test(t) ? `var(--spacing-${Math.max(0, Math.min(14, parseInt(t, 10)))})` : t;
|
|
64
|
+
}
|
|
65
|
+
_applySpacing() {
|
|
66
|
+
const e = this._mapSpacingToken(this.spacing), t = this._mapSpacingToken(this.spacingTop) ?? e, s = this._mapSpacingToken(this.spacingBottom) ?? e;
|
|
67
|
+
t ? this.style.marginBlockStart = t : this.style.removeProperty("margin-block-start"), s ? this.style.marginBlockEnd = s : this.style.removeProperty("margin-block-end");
|
|
68
|
+
}
|
|
56
69
|
render() {
|
|
57
|
-
return
|
|
70
|
+
return f`
|
|
58
71
|
<md-list role="list" @slotchange=${this._onSlotChange}>
|
|
59
72
|
<slot></slot>
|
|
60
73
|
</md-list>
|
|
61
74
|
`;
|
|
62
75
|
}
|
|
63
76
|
};
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
77
|
+
l = /* @__PURE__ */ new WeakMap();
|
|
78
|
+
a.styles = [
|
|
79
|
+
g`
|
|
67
80
|
:host {
|
|
68
81
|
display: block;
|
|
69
82
|
--scb-list-bg: transparent;
|
|
@@ -85,15 +98,24 @@ n.styles = [
|
|
|
85
98
|
}
|
|
86
99
|
`
|
|
87
100
|
];
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
],
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
],
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
],
|
|
101
|
+
o([
|
|
102
|
+
c({ type: Boolean, attribute: "no-divider", reflect: !0 })
|
|
103
|
+
], a.prototype, "noDivider", 2);
|
|
104
|
+
o([
|
|
105
|
+
c({ type: String, reflect: !0 })
|
|
106
|
+
], a.prototype, "spacing", 2);
|
|
107
|
+
o([
|
|
108
|
+
c({ type: String, reflect: !0, attribute: "spacing-top" })
|
|
109
|
+
], a.prototype, "spacingTop", 2);
|
|
110
|
+
o([
|
|
111
|
+
c({ type: String, reflect: !0, attribute: "spacing-bottom" })
|
|
112
|
+
], a.prototype, "spacingBottom", 2);
|
|
113
|
+
o([
|
|
114
|
+
v("slot")
|
|
115
|
+
], a.prototype, "_slotEl", 2);
|
|
116
|
+
a = o([
|
|
117
|
+
_("scb-list")
|
|
118
|
+
], a);
|
|
97
119
|
export {
|
|
98
|
-
|
|
120
|
+
a as ScbList
|
|
99
121
|
};
|
|
@@ -20,9 +20,14 @@ export declare class ScbNotificationCard extends LitElement {
|
|
|
20
20
|
maxHeight: string;
|
|
21
21
|
fullHeight: boolean;
|
|
22
22
|
fullWidth: boolean;
|
|
23
|
+
spacing: string;
|
|
24
|
+
spacingTop: string;
|
|
25
|
+
spacingBottom: string;
|
|
23
26
|
static styles: import('lit').CSSResult[];
|
|
24
27
|
private _iconForVariant;
|
|
25
28
|
private _closeNotification;
|
|
29
|
+
private __resolveSpacingToken;
|
|
30
|
+
private __applySpacing;
|
|
26
31
|
protected updated(changed: PropertyValues): void;
|
|
27
32
|
render(): import('lit-html').TemplateResult<1>;
|
|
28
33
|
}
|