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
package/scb-link/scb-link.js
CHANGED
|
@@ -1,72 +1,99 @@
|
|
|
1
|
-
import { css as h, LitElement as
|
|
2
|
-
import { property as
|
|
3
|
-
import { ifDefined as
|
|
4
|
-
|
|
1
|
+
import { css as h, LitElement as u, html as v } from "lit";
|
|
2
|
+
import { property as s, customElement as y } from "lit/decorators.js";
|
|
3
|
+
import { ifDefined as n } from "lit/directives/if-defined.js";
|
|
4
|
+
import "@material/web/focus/md-focus-ring.js";
|
|
5
|
+
var m = Object.defineProperty, b = Object.getOwnPropertyDescriptor, f = (e) => {
|
|
5
6
|
throw TypeError(e);
|
|
6
|
-
},
|
|
7
|
-
for (var a = l > 1 ? void 0 : l ?
|
|
8
|
-
(c = e[
|
|
9
|
-
return l && a &&
|
|
10
|
-
},
|
|
11
|
-
let o = class extends
|
|
7
|
+
}, i = (e, r, t, l) => {
|
|
8
|
+
for (var a = l > 1 ? void 0 : l ? b(r, t) : r, d = e.length - 1, c; d >= 0; d--)
|
|
9
|
+
(c = e[d]) && (a = (l ? c(r, t, a) : c(a)) || a);
|
|
10
|
+
return l && a && m(r, t, a), a;
|
|
11
|
+
}, g = (e, r, t) => r.has(e) || f("Cannot " + t), _ = (e, r, t) => (g(e, r, "read from private field"), t ? t.call(e) : r.get(e)), x = (e, r, t) => r.has(e) ? f("Cannot add the same private member more than once") : r instanceof WeakSet ? r.add(e) : r.set(e, t), p;
|
|
12
|
+
let o = class extends u {
|
|
12
13
|
constructor() {
|
|
13
|
-
super(...arguments), this.href = "", this.disabled = !1,
|
|
14
|
+
super(...arguments), this.href = "", this.disabled = !1, this.ariaLabel = "", x(this, p, (e) => {
|
|
14
15
|
this.disabled && (e.preventDefault(), e.stopPropagation());
|
|
15
16
|
});
|
|
16
17
|
}
|
|
17
18
|
render() {
|
|
18
19
|
const e = this.target === "_blank" && !this.rel ? "noopener noreferrer" : this.rel;
|
|
19
|
-
return
|
|
20
|
+
return v`
|
|
20
21
|
<a
|
|
21
22
|
part="anchor"
|
|
22
|
-
href=${
|
|
23
|
-
target=${
|
|
24
|
-
rel=${
|
|
25
|
-
download=${
|
|
23
|
+
href=${n(this.disabled ? void 0 : this.href || void 0)}
|
|
24
|
+
target=${n(this.target)}
|
|
25
|
+
rel=${n(e)}
|
|
26
|
+
download=${n(this.download)}
|
|
26
27
|
aria-disabled=${this.disabled ? "true" : "false"}
|
|
27
|
-
aria-label=${
|
|
28
|
-
@click=${
|
|
28
|
+
aria-label=${n(this.ariaLabel || void 0)}
|
|
29
|
+
@click=${_(this, p)}
|
|
29
30
|
><slot></slot></a>
|
|
31
|
+
|
|
32
|
+
<md-focus-ring></md-focus-ring>
|
|
30
33
|
`;
|
|
31
34
|
}
|
|
32
35
|
};
|
|
33
|
-
|
|
36
|
+
p = /* @__PURE__ */ new WeakMap();
|
|
34
37
|
o.styles = h`
|
|
35
|
-
:host {
|
|
38
|
+
:host {
|
|
39
|
+
display: inline-block;
|
|
40
|
+
position: relative;
|
|
41
|
+
padding: var(--scb-link-focus-ring-gap, 4px);
|
|
42
|
+
font-family: var(--brand-font, inherit);
|
|
43
|
+
color: var(--md-sys-color-on-surface);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
md-focus-ring {
|
|
47
|
+
position: absolute;
|
|
48
|
+
inset: 0;
|
|
49
|
+
pointer-events: none;
|
|
50
|
+
display: none;
|
|
51
|
+
border-radius: var(--scb-link-focus-ring-radius, var(--md-sys-shape-corner-small, 1px));
|
|
52
|
+
}
|
|
53
|
+
:host(:focus-within) md-focus-ring {
|
|
54
|
+
display: block;
|
|
55
|
+
}
|
|
56
|
+
|
|
36
57
|
a {
|
|
37
58
|
text-decoration: underline;
|
|
38
59
|
text-underline-offset: .22em;
|
|
39
60
|
text-decoration-thickness: 1px;
|
|
40
61
|
color: var(--scb-link-color, var(--md-sys-color-primary));
|
|
41
|
-
border-radius: 2px;
|
|
42
|
-
outline: none;
|
|
62
|
+
border-radius: var(--radius-2, 2px);
|
|
63
|
+
outline: none;
|
|
43
64
|
cursor: pointer;
|
|
44
65
|
transition: text-decoration-thickness .12s ease;
|
|
45
66
|
}
|
|
46
67
|
a:hover { text-decoration-thickness: 2px; }
|
|
47
|
-
a:focus
|
|
48
|
-
outline: 2px solid var(--scb-link-focus, var(--md-sys-color-primary));
|
|
49
|
-
outline-offset: 3px;
|
|
50
|
-
}
|
|
68
|
+
a:focus { outline: none; }
|
|
51
69
|
a:visited { color: var(--scb-link-visited-color, var(--md-sys-color-on-surface)); }
|
|
52
|
-
|
|
70
|
+
|
|
71
|
+
:host([disabled]) a {
|
|
72
|
+
pointer-events: none;
|
|
73
|
+
opacity: .64;
|
|
74
|
+
text-decoration: none;
|
|
75
|
+
cursor: default;
|
|
76
|
+
}
|
|
53
77
|
`;
|
|
54
|
-
|
|
55
|
-
|
|
78
|
+
i([
|
|
79
|
+
s({ type: String, reflect: !0 })
|
|
56
80
|
], o.prototype, "href", 2);
|
|
57
|
-
|
|
58
|
-
|
|
81
|
+
i([
|
|
82
|
+
s({ type: String, reflect: !0 })
|
|
59
83
|
], o.prototype, "target", 2);
|
|
60
|
-
|
|
61
|
-
|
|
84
|
+
i([
|
|
85
|
+
s({ type: String, reflect: !0 })
|
|
62
86
|
], o.prototype, "rel", 2);
|
|
63
|
-
|
|
64
|
-
|
|
87
|
+
i([
|
|
88
|
+
s({ type: String, reflect: !0 })
|
|
65
89
|
], o.prototype, "download", 2);
|
|
66
|
-
|
|
67
|
-
|
|
90
|
+
i([
|
|
91
|
+
s({ type: Boolean, reflect: !0 })
|
|
68
92
|
], o.prototype, "disabled", 2);
|
|
69
|
-
|
|
93
|
+
i([
|
|
94
|
+
s({ type: String, attribute: "aria-label" })
|
|
95
|
+
], o.prototype, "ariaLabel", 2);
|
|
96
|
+
o = i([
|
|
70
97
|
y("scb-link")
|
|
71
98
|
], o);
|
|
72
99
|
export {
|
|
@@ -2,7 +2,6 @@ import { LitElement, TemplateResult, PropertyValues } from 'lit';
|
|
|
2
2
|
export declare class ScbListItem extends LitElement {
|
|
3
3
|
#private;
|
|
4
4
|
type: 'text' | 'link';
|
|
5
|
-
/** Alias till item-href (href får företräde om båda sätts) */
|
|
6
5
|
href: string;
|
|
7
6
|
itemHref: string;
|
|
8
7
|
target: string;
|
|
@@ -11,17 +10,21 @@ export declare class ScbListItem extends LitElement {
|
|
|
11
10
|
supportingText: string;
|
|
12
11
|
overline: string;
|
|
13
12
|
leading: boolean;
|
|
13
|
+
leadingVariant: '' | 'icon' | 'avatar' | 'image';
|
|
14
14
|
leadingIcon: string;
|
|
15
|
-
|
|
15
|
+
avatarLabel: string;
|
|
16
|
+
avatarAlt: string;
|
|
17
|
+
avatarVariant: 'icon' | 'image';
|
|
18
|
+
avatarSrc: string;
|
|
16
19
|
imgHrefImage: string;
|
|
17
|
-
leadingVariant: 'icon' | 'avatar' | 'image';
|
|
18
20
|
trailing: boolean;
|
|
21
|
+
trailingVariant: '' | 'icon' | 'checkbox' | 'switch';
|
|
19
22
|
trailingIcon: string;
|
|
20
|
-
|
|
23
|
+
density: -4 | -2 | 0;
|
|
21
24
|
static get styles(): import('lit').CSSResult;
|
|
22
25
|
protected firstUpdated(): Promise<void>;
|
|
23
26
|
protected updated(changed: PropertyValues): void;
|
|
24
|
-
private
|
|
27
|
+
private onRowClick;
|
|
25
28
|
render(): TemplateResult;
|
|
26
29
|
}
|
|
27
30
|
declare global {
|
|
@@ -1,93 +1,191 @@
|
|
|
1
|
-
import { LitElement as S, css as $,
|
|
2
|
-
import { property as s, customElement as
|
|
3
|
-
|
|
1
|
+
import { LitElement as S, css as $, nothing as l, html as o } from "lit";
|
|
2
|
+
import { property as s, customElement as V } from "lit/decorators.js";
|
|
3
|
+
import "@material/web/focus/md-focus-ring.js";
|
|
4
|
+
import "@material/web/ripple/ripple.js";
|
|
5
|
+
var I = Object.defineProperty, L = Object.getOwnPropertyDescriptor, _ = (t) => {
|
|
4
6
|
throw TypeError(t);
|
|
5
7
|
}, r = (t, i, e, n) => {
|
|
6
|
-
for (var
|
|
7
|
-
(
|
|
8
|
-
return n &&
|
|
9
|
-
},
|
|
8
|
+
for (var p = n > 1 ? void 0 : n ? L(i, e) : i, d = t.length - 1, c; d >= 0; d--)
|
|
9
|
+
(c = t[d]) && (p = (n ? c(i, e, p) : c(p)) || p);
|
|
10
|
+
return n && p && I(i, e, p), p;
|
|
11
|
+
}, w = (t, i, e) => i.has(t) || _("Cannot " + e), g = (t, i, e) => (w(t, i, "read from private field"), e ? e.call(t) : i.get(t)), h = (t, i, e) => i.has(t) ? _("Cannot add the same private member more than once") : i instanceof WeakSet ? i.add(t) : i.set(t, e), m = (t, i, e, n) => (w(t, i, "write to private field"), i.set(t, e), e), x = (t, i, e) => (w(t, i, "access private method"), e), y, f, u, v, b, k;
|
|
10
12
|
let a = class extends S {
|
|
11
13
|
constructor() {
|
|
12
|
-
super(...arguments),
|
|
14
|
+
super(...arguments), h(this, v), this.type = "text", this.href = "", this.itemHref = "", this.target = "", this.disabled = !1, this.label = "", this.supportingText = "", this.overline = "", this.leading = !1, this.leadingVariant = "", this.leadingIcon = "", this.avatarLabel = "", this.avatarAlt = "", this.avatarVariant = "icon", this.avatarSrc = "", this.imgHrefImage = "", this.trailing = !1, this.trailingVariant = "", this.trailingIcon = "", this.density = 0, h(this, y, !1), h(this, f, !1), h(this, u, !1), this.onRowClick = () => {
|
|
15
|
+
var e, n;
|
|
16
|
+
if (this.type === "link" && (this.href || this.itemHref)) return;
|
|
17
|
+
const t = (e = this.shadowRoot) == null ? void 0 : e.querySelector("scb-checkbox"), i = (n = this.shadowRoot) == null ? void 0 : n.querySelector("scb-switch");
|
|
18
|
+
t && (t.checked = !t.checked), i && (i.selected = !i.selected);
|
|
19
|
+
}, h(this, k, (t) => {
|
|
20
|
+
var i;
|
|
21
|
+
if (!t.defaultPrevented && (t.key === "Enter" || t.key === " ")) {
|
|
22
|
+
if (this.type === "link") {
|
|
23
|
+
const e = (i = this.shadowRoot) == null ? void 0 : i.querySelector("a[href]");
|
|
24
|
+
if (e) {
|
|
25
|
+
t.preventDefault(), e.click();
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
t.preventDefault(), this.onRowClick();
|
|
30
|
+
}
|
|
31
|
+
});
|
|
13
32
|
}
|
|
14
33
|
static get styles() {
|
|
15
34
|
return $`
|
|
16
|
-
:host {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
35
|
+
:host {
|
|
36
|
+
border-bottom: var(--stroke-border, 1px) solid var(--md-sys-color-outline-variant);
|
|
37
|
+
margin-bottom: calc(var(--stroke-border, 1px) * -1);
|
|
38
|
+
outline: none;
|
|
39
|
+
position: relative;
|
|
40
|
+
color: var(--md-sys-color-on-surface);
|
|
41
|
+
font-family: var(--brand-font);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
md-focus-ring {
|
|
45
|
+
position: absolute;
|
|
46
|
+
inset: 0;
|
|
47
|
+
pointer-events: none;
|
|
48
|
+
display: none;
|
|
49
|
+
border-radius: var(--scb-list-item-focus-ring-radius, var(--md-sys-shape-corner-small, 8px));
|
|
50
|
+
}
|
|
51
|
+
:host(:focus-visible) md-focus-ring { display: block; }
|
|
52
|
+
|
|
53
|
+
.row {
|
|
54
|
+
display: flex;
|
|
55
|
+
align-items: center;
|
|
56
|
+
gap: var(--spacing-5, 16px);
|
|
57
|
+
padding-block: var(--spacing-7, 24px);
|
|
58
|
+
padding-inline: var(--spacing-5, 16px);
|
|
59
|
+
border-radius: var(--radius-none, 0px);
|
|
60
|
+
-webkit-tap-highlight-color: transparent;
|
|
61
|
+
position: relative;
|
|
62
|
+
overflow: hidden;
|
|
63
|
+
cursor: default;
|
|
64
|
+
}
|
|
65
|
+
:host([type="link"]) .row { cursor: pointer; }
|
|
66
|
+
|
|
67
|
+
:host([density="-2"]) .row,
|
|
68
|
+
:host-context([data-density="-2"]) .row {
|
|
69
|
+
padding-block: var(--spacing-5, 16px);
|
|
70
|
+
}
|
|
71
|
+
:host([density="-4"]) .row,
|
|
72
|
+
:host-context([data-density="-4"]) .row {
|
|
73
|
+
padding-block: var(--spacing-4, 12px);
|
|
74
|
+
}
|
|
24
75
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
76
|
+
md-ripple {
|
|
77
|
+
border-radius: inherit;
|
|
78
|
+
inset: 0;
|
|
79
|
+
position: absolute;
|
|
80
|
+
pointer-events: none;
|
|
30
81
|
}
|
|
31
|
-
|
|
32
|
-
.
|
|
82
|
+
|
|
83
|
+
.leading { align-self: center; display: grid; place-items: center; }
|
|
84
|
+
.img {
|
|
85
|
+
width: calc(var(--icon-size-large, 40px) + var(--spacing-5, 16px));
|
|
86
|
+
height: calc(var(--icon-size-large, 40px) + var(--spacing-5, 16px));
|
|
87
|
+
object-fit: contain;
|
|
88
|
+
border-radius: var(--radius-s, 8px);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.texts { display: grid; gap: var(--spacing-1, 2px); min-inline-size: 0; }
|
|
92
|
+
|
|
93
|
+
.overline {
|
|
94
|
+
font-family: var(--brand-font);
|
|
95
|
+
font-size: var(--md-sys-typescale-label-medium-size);
|
|
96
|
+
line-height: var(--md-sys-typescale-label-medium-line-height);
|
|
97
|
+
font-weight: var(--weight-regular);
|
|
98
|
+
letter-spacing: var(--md-sys-typescale-label-medium-tracking);
|
|
99
|
+
color: var(--md-sys-color-on-surface-variant);
|
|
100
|
+
}
|
|
101
|
+
.label {
|
|
102
|
+
font-family: var(--brand-font);
|
|
103
|
+
font-size: var(--md-sys-typescale-title-large-size);
|
|
104
|
+
line-height: var(--md-sys-typescale-title-large-line-height);
|
|
105
|
+
font-weight: var(--weight-semibold);
|
|
106
|
+
letter-spacing: var(--md-sys-typescale-title-large-tracking);
|
|
107
|
+
color: var(--md-sys-color-on-surface);
|
|
108
|
+
}
|
|
109
|
+
.supporting-text {
|
|
110
|
+
font-family: var(--brand-font);
|
|
111
|
+
font-size: var(--md-sys-typescale-body-medium-size);
|
|
112
|
+
line-height: var(--md-sys-typescale-body-medium-line-height);
|
|
113
|
+
font-weight: var(--weight-regular);
|
|
114
|
+
letter-spacing: var(--md-sys-typescale-body-medium-tracking);
|
|
115
|
+
color: var(--md-sys-color-on-surface-variant);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.trailing { margin-left: auto; align-self: center; }
|
|
119
|
+
.trailing scb-checkbox { margin-right: 11px; }
|
|
120
|
+
|
|
121
|
+
.link { text-decoration: none; color: inherit; display: contents; }
|
|
33
122
|
`;
|
|
34
123
|
}
|
|
35
|
-
// Ladda in rätt beroenden första gången
|
|
36
124
|
async firstUpdated() {
|
|
37
|
-
await
|
|
125
|
+
await x(this, v, b).call(this), this.addEventListener("keydown", g(this, k));
|
|
38
126
|
}
|
|
39
|
-
// Ladda om/utöka beroenden om varianter ändras
|
|
40
127
|
updated(t) {
|
|
41
|
-
super.updated(t), (t.has("leading") || t.has("leadingVariant") || t.has("trailing") || t.has("trailingVariant") || t.has("type") || t.has("target")) &&
|
|
42
|
-
}
|
|
43
|
-
onListClick() {
|
|
44
|
-
var e, n;
|
|
45
|
-
if (this.type === "link" && (this.href || this.itemHref)) return;
|
|
46
|
-
const t = (e = this.shadowRoot) == null ? void 0 : e.querySelector("scb-checkbox"), i = (n = this.shadowRoot) == null ? void 0 : n.querySelector("scb-switch");
|
|
47
|
-
t && (t.checked = !t.checked), i && (i.selected = !i.selected);
|
|
128
|
+
super.updated(t), (t.has("leading") || t.has("leadingVariant") || t.has("trailing") || t.has("trailingVariant") || t.has("type") || t.has("target")) && x(this, v, b).call(this);
|
|
48
129
|
}
|
|
49
130
|
render() {
|
|
50
|
-
const t = this.
|
|
51
|
-
|
|
131
|
+
const t = this.leading ? (() => {
|
|
132
|
+
switch (this.leadingVariant) {
|
|
133
|
+
case "icon":
|
|
134
|
+
return this.leadingIcon ? o`<div class="leading"><md-icon>${this.leadingIcon}</md-icon></div>` : l;
|
|
135
|
+
case "avatar":
|
|
136
|
+
return o`
|
|
137
|
+
<div class="leading">
|
|
138
|
+
<scb-avatar
|
|
139
|
+
label=${this.avatarLabel}
|
|
140
|
+
alt=${this.avatarAlt}
|
|
141
|
+
src=${this.avatarVariant === "image" ? this.avatarSrc : ""}
|
|
142
|
+
size="medium"
|
|
143
|
+
shape="circular"
|
|
144
|
+
variant=${this.avatarVariant}
|
|
145
|
+
></scb-avatar>
|
|
146
|
+
</div>
|
|
147
|
+
`;
|
|
148
|
+
case "image":
|
|
149
|
+
return this.imgHrefImage ? o`<div class="leading"><img class="img" src="${this.imgHrefImage}" alt="" /></div>` : l;
|
|
150
|
+
default:
|
|
151
|
+
return l;
|
|
152
|
+
}
|
|
153
|
+
})() : l, i = this.href || this.itemHref || "", e = this.target === "_blank" ? "open_in_new" : "chevron_right";
|
|
154
|
+
let n = l;
|
|
52
155
|
if (this.trailing)
|
|
53
156
|
if (this.trailingVariant === "icon") {
|
|
54
|
-
const
|
|
55
|
-
n =
|
|
56
|
-
} else this.trailingVariant === "checkbox" ? n =
|
|
57
|
-
else this.type === "link" && (n =
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
<
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
${n}
|
|
75
|
-
</div>
|
|
76
|
-
</md-list-item>
|
|
157
|
+
const c = this.trailingIcon || (this.type === "link" ? e : "");
|
|
158
|
+
n = c ? o`<div class="trailing"><md-icon>${c}</md-icon></div>` : l;
|
|
159
|
+
} else this.trailingVariant === "checkbox" ? n = o`<div class="trailing"><scb-checkbox @click=${(c) => c.stopPropagation()}></scb-checkbox></div>` : this.trailingVariant === "switch" && (n = o`<div class="trailing"><scb-switch @click=${(c) => c.stopPropagation()}></scb-switch></div>`);
|
|
160
|
+
else this.type === "link" && (n = o`<div class="trailing"><md-icon>${e}</md-icon></div>`);
|
|
161
|
+
const p = this.type === "link" && this.target === "_blank" ? "noopener noreferrer" : l, d = o`
|
|
162
|
+
${t}
|
|
163
|
+
<div class="texts">
|
|
164
|
+
${this.overline ? o`<div class="overline">${this.overline}</div>` : l}
|
|
165
|
+
<div class="label">${this.label}</div>
|
|
166
|
+
${this.supportingText ? o`<div class="supporting-text">${this.supportingText}</div>` : l}
|
|
167
|
+
</div>
|
|
168
|
+
${n}
|
|
169
|
+
`;
|
|
170
|
+
return o`
|
|
171
|
+
<div class="row" @click=${this.onRowClick} ?inert=${this.disabled} aria-disabled=${this.disabled ? "true" : "false"}>
|
|
172
|
+
${this.type === "link" && i ? o`<a class="link" href=${i} target=${this.target || l} rel=${p}>${d}</a>` : d}
|
|
173
|
+
${this.type === "link" ? o`<md-ripple></md-ripple>` : l}
|
|
174
|
+
</div>
|
|
175
|
+
|
|
176
|
+
<md-focus-ring></md-focus-ring>
|
|
77
177
|
`;
|
|
78
178
|
}
|
|
79
179
|
};
|
|
80
|
-
f = /* @__PURE__ */ new WeakMap();
|
|
81
|
-
m = /* @__PURE__ */ new WeakMap();
|
|
82
180
|
y = /* @__PURE__ */ new WeakMap();
|
|
181
|
+
f = /* @__PURE__ */ new WeakMap();
|
|
83
182
|
u = /* @__PURE__ */ new WeakMap();
|
|
84
183
|
v = /* @__PURE__ */ new WeakSet();
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
this.trailingVariant === "icon");
|
|
89
|
-
(this.leading && this.leadingVariant === "icon" || this.trailing && this.trailingVariant === "icon" || t) && !g(this, m) && (await import("@material/web/icon/icon.js"), d(this, m, !0)), this.trailing && this.trailingVariant === "checkbox" && !g(this, y) && (await import("../scb-checkbox/scb-checkbox.js"), d(this, y, !0)), this.trailing && this.trailingVariant === "switch" && !g(this, u) && (await import("../scb-switch/scb-switch.js"), d(this, u, !0));
|
|
184
|
+
b = async function() {
|
|
185
|
+
const t = this.type === "link" && (!this.trailing || this.trailingVariant === "icon");
|
|
186
|
+
(this.leading && this.leadingVariant === "icon" || this.trailing && this.trailingVariant === "icon" || t) && !g(this, y) && (await import("@material/web/icon/icon.js"), m(this, y, !0)), this.trailing && this.trailingVariant === "checkbox" && !g(this, f) && (await import("../scb-checkbox/scb-checkbox.js"), m(this, f, !0)), this.trailing && this.trailingVariant === "switch" && !g(this, u) && (await import("../scb-switch/scb-switch.js"), m(this, u, !0));
|
|
90
187
|
};
|
|
188
|
+
k = /* @__PURE__ */ new WeakMap();
|
|
91
189
|
r([
|
|
92
190
|
s({ type: String, reflect: !0, attribute: "type" })
|
|
93
191
|
], a.prototype, "type", 2);
|
|
@@ -115,29 +213,41 @@ r([
|
|
|
115
213
|
r([
|
|
116
214
|
s({ type: Boolean })
|
|
117
215
|
], a.prototype, "leading", 2);
|
|
216
|
+
r([
|
|
217
|
+
s({ type: String, attribute: "leading-variant", reflect: !0 })
|
|
218
|
+
], a.prototype, "leadingVariant", 2);
|
|
118
219
|
r([
|
|
119
220
|
s({ type: String, attribute: "leading-icon" })
|
|
120
221
|
], a.prototype, "leadingIcon", 2);
|
|
121
222
|
r([
|
|
122
|
-
s({ type: String,
|
|
123
|
-
], a.prototype, "
|
|
223
|
+
s({ type: String, attribute: "avatar-label" })
|
|
224
|
+
], a.prototype, "avatarLabel", 2);
|
|
225
|
+
r([
|
|
226
|
+
s({ type: String, attribute: "avatar-alt" })
|
|
227
|
+
], a.prototype, "avatarAlt", 2);
|
|
228
|
+
r([
|
|
229
|
+
s({ type: String, attribute: "avatar-variant" })
|
|
230
|
+
], a.prototype, "avatarVariant", 2);
|
|
231
|
+
r([
|
|
232
|
+
s({ type: String, attribute: "avatar-src" })
|
|
233
|
+
], a.prototype, "avatarSrc", 2);
|
|
124
234
|
r([
|
|
125
235
|
s({ type: String, reflect: !0, attribute: "img-href-image" })
|
|
126
236
|
], a.prototype, "imgHrefImage", 2);
|
|
127
|
-
r([
|
|
128
|
-
s({ type: String, reflect: !0, attribute: "leading-variant" })
|
|
129
|
-
], a.prototype, "leadingVariant", 2);
|
|
130
237
|
r([
|
|
131
238
|
s({ type: Boolean })
|
|
132
239
|
], a.prototype, "trailing", 2);
|
|
240
|
+
r([
|
|
241
|
+
s({ type: String, attribute: "trailing-variant", reflect: !0 })
|
|
242
|
+
], a.prototype, "trailingVariant", 2);
|
|
133
243
|
r([
|
|
134
244
|
s({ type: String, attribute: "trailing-icon" })
|
|
135
245
|
], a.prototype, "trailingIcon", 2);
|
|
136
246
|
r([
|
|
137
|
-
s({ type:
|
|
138
|
-
], a.prototype, "
|
|
247
|
+
s({ type: Number, reflect: !0 })
|
|
248
|
+
], a.prototype, "density", 2);
|
|
139
249
|
a = r([
|
|
140
|
-
|
|
250
|
+
V("scb-list-item")
|
|
141
251
|
], a);
|
|
142
252
|
export {
|
|
143
253
|
a as ScbListItem
|
package/scb-list/scb-list.d.ts
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import { LitElement, TemplateResult } from 'lit';
|
|
2
2
|
export declare class ScbList extends LitElement {
|
|
3
3
|
#private;
|
|
4
|
+
private _slotEl;
|
|
4
5
|
protected firstUpdated(): Promise<void>;
|
|
6
|
+
private _onSlotChange;
|
|
7
|
+
private _getItems;
|
|
8
|
+
private _setupItems;
|
|
9
|
+
private _onKeyDown;
|
|
5
10
|
static styles: import('lit').CSSResult[];
|
|
6
11
|
render(): TemplateResult;
|
|
7
12
|
}
|
package/scb-list/scb-list.js
CHANGED
|
@@ -1,38 +1,88 @@
|
|
|
1
|
-
import { css as
|
|
2
|
-
import { customElement as
|
|
1
|
+
import { css as u, LitElement as f, html as _ } from "lit";
|
|
2
|
+
import { query as m, customElement as v } from "lit/decorators.js";
|
|
3
3
|
import "./scb-list-item.js";
|
|
4
|
-
var
|
|
5
|
-
throw TypeError(
|
|
6
|
-
},
|
|
7
|
-
for (var
|
|
8
|
-
(
|
|
9
|
-
return s;
|
|
10
|
-
},
|
|
11
|
-
let l = class extends
|
|
4
|
+
var g = Object.defineProperty, b = Object.getOwnPropertyDescriptor, c = (e) => {
|
|
5
|
+
throw TypeError(e);
|
|
6
|
+
}, d = (e, t, s, r) => {
|
|
7
|
+
for (var a = r > 1 ? void 0 : r ? b(t, s) : t, o = e.length - 1, i; o >= 0; o--)
|
|
8
|
+
(i = e[o]) && (a = (r ? i(t, s, a) : i(a)) || a);
|
|
9
|
+
return r && a && g(t, s, a), a;
|
|
10
|
+
}, h = (e, t, s) => t.has(e) || c("Cannot " + s), w = (e, t, s) => (h(e, t, "read from private field"), t.get(e)), y = (e, t, s) => t.has(e) ? c("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, s), A = (e, t, s, r) => (h(e, t, "write to private field"), t.set(e, s), s), n;
|
|
11
|
+
let l = class extends f {
|
|
12
12
|
constructor() {
|
|
13
|
-
super(...arguments), y(this,
|
|
13
|
+
super(...arguments), y(this, n, !1), this._onSlotChange = () => this._setupItems();
|
|
14
14
|
}
|
|
15
15
|
async firstUpdated() {
|
|
16
|
-
|
|
16
|
+
w(this, n) || (await import("@material/web/list/list.js"), A(this, n, !0)), this._setupItems();
|
|
17
|
+
}
|
|
18
|
+
_getItems() {
|
|
19
|
+
var t;
|
|
20
|
+
return (((t = this._slotEl) == null ? void 0 : t.assignedElements({ flatten: !0 })) ?? []).filter((s) => s instanceof HTMLElement);
|
|
21
|
+
}
|
|
22
|
+
_setupItems() {
|
|
23
|
+
var s;
|
|
24
|
+
this._getItems().forEach((r, a) => {
|
|
25
|
+
r.hasAttribute("role") || r.setAttribute("role", "listitem"), r.setAttribute("tabindex", a === 0 ? "0" : "-1");
|
|
26
|
+
});
|
|
27
|
+
const t = (s = this.renderRoot) == null ? void 0 : s.querySelector("md-list");
|
|
28
|
+
t && !t.hasAttribute("data-kbd") && (t.setAttribute("data-kbd", "true"), t.addEventListener("keydown", (r) => this._onKeyDown(r)));
|
|
29
|
+
}
|
|
30
|
+
_onKeyDown(e) {
|
|
31
|
+
const t = this._getItems();
|
|
32
|
+
if (!t.length) return;
|
|
33
|
+
const s = t.findIndex((a) => a.getAttribute("tabindex") === "0"), r = (a) => {
|
|
34
|
+
const o = (a % t.length + t.length) % t.length;
|
|
35
|
+
t.forEach((p) => p.setAttribute("tabindex", "-1"));
|
|
36
|
+
const i = t[o];
|
|
37
|
+
i.setAttribute("tabindex", "0"), i.focus();
|
|
38
|
+
};
|
|
39
|
+
switch (e.key) {
|
|
40
|
+
case "ArrowDown":
|
|
41
|
+
case "ArrowRight":
|
|
42
|
+
e.preventDefault(), r(s < 0 ? 0 : s + 1);
|
|
43
|
+
break;
|
|
44
|
+
case "ArrowUp":
|
|
45
|
+
case "ArrowLeft":
|
|
46
|
+
e.preventDefault(), r(s < 0 ? 0 : s - 1);
|
|
47
|
+
break;
|
|
48
|
+
case "Home":
|
|
49
|
+
e.preventDefault(), r(0);
|
|
50
|
+
break;
|
|
51
|
+
case "End":
|
|
52
|
+
e.preventDefault(), r(t.length - 1);
|
|
53
|
+
break;
|
|
54
|
+
}
|
|
17
55
|
}
|
|
18
56
|
render() {
|
|
19
57
|
return _`
|
|
20
|
-
<md-list role="list">
|
|
58
|
+
<md-list role="list" @slotchange=${this._onSlotChange}>
|
|
21
59
|
<slot></slot>
|
|
22
60
|
</md-list>
|
|
23
61
|
`;
|
|
24
62
|
}
|
|
25
63
|
};
|
|
26
|
-
|
|
64
|
+
n = /* @__PURE__ */ new WeakMap();
|
|
27
65
|
l.styles = [
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
66
|
+
u`
|
|
67
|
+
:host {
|
|
68
|
+
display: block;
|
|
69
|
+
--scb-list-bg: var(--md-sys-color-surface-container-lowest);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
md-list {
|
|
73
|
+
background: var(--scb-list-bg);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
::slotted(scb-list-item:first-of-type) {
|
|
77
|
+
border-top: 1px solid var(--md-sys-color-outline-variant);
|
|
78
|
+
}
|
|
79
|
+
`
|
|
33
80
|
];
|
|
34
|
-
|
|
35
|
-
|
|
81
|
+
d([
|
|
82
|
+
m("slot")
|
|
83
|
+
], l.prototype, "_slotEl", 2);
|
|
84
|
+
l = d([
|
|
85
|
+
v("scb-list")
|
|
36
86
|
], l);
|
|
37
87
|
export {
|
|
38
88
|
l as ScbList
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
export declare class ScbNotificationCard extends LitElement {
|
|
3
|
+
type: string;
|
|
4
|
+
direction: 'horizontal' | 'vertical';
|
|
5
|
+
title: string;
|
|
6
|
+
subtitle: string;
|
|
7
|
+
supportingText: string;
|
|
8
|
+
open: boolean;
|
|
9
|
+
linkText: string;
|
|
10
|
+
linkhref: string;
|
|
11
|
+
showIcon: boolean;
|
|
12
|
+
showCloseButton: boolean;
|
|
13
|
+
static styles: import('lit').CSSResult[];
|
|
14
|
+
/** Return icon name for notification type */
|
|
15
|
+
private _iconForType;
|
|
16
|
+
private _closeNotification;
|
|
17
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
18
|
+
}
|