scb-wc-test 0.1.21 → 0.1.23
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 -2
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/mvc/components/all.js +1 -1
- package/mvc/components/scb-chip/scb-chip.js +48 -0
- package/mvc/components/scb-dialog/scb-dialog.js +2 -2
- package/mvc/components/scb-header/scb-header.js +9 -14
- package/mvc/components/scb-list/scb-list-item.js +7 -4
- package/mvc/components/scb-list/scb-list.js +11 -4
- package/package.json +6 -10
- package/{scb-chips → scb-chip}/scb-chip.d.ts +2 -0
- package/{scb-chips → scb-chip}/scb-chip.js +34 -24
- package/scb-dialog/scb-dialog.js +1 -1
- package/scb-header/scb-header.js +5 -10
- package/scb-list/scb-list-item.d.ts +1 -0
- package/scb-list/scb-list-item.js +9 -3
- package/scb-list/scb-list.d.ts +6 -0
- package/scb-list/scb-list.js +48 -38
- package/scb-wc-test.bundle.js +163 -156
- package/mvc/components/scb-chips/scb-chip.js +0 -46
|
@@ -11,7 +11,7 @@ var I = Object.defineProperty, L = Object.getOwnPropertyDescriptor, _ = (t) => {
|
|
|
11
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;
|
|
12
12
|
let a = class extends S {
|
|
13
13
|
constructor() {
|
|
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 = () => {
|
|
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, this.noDivider = !1, h(this, y, !1), h(this, f, !1), h(this, u, !1), this.onRowClick = () => {
|
|
15
15
|
var e, n;
|
|
16
16
|
if (this.type === "link" && (this.href || this.itemHref)) return;
|
|
17
17
|
const t = (e = this.shadowRoot) == null ? void 0 : e.querySelector("scb-checkbox"), i = (n = this.shadowRoot) == null ? void 0 : n.querySelector("scb-switch");
|
|
@@ -41,6 +41,9 @@ let a = class extends S {
|
|
|
41
41
|
font-family: var(--brand-font);
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
+
/* Per-item: ingen divider när attributet är satt */
|
|
45
|
+
:host([no-divider]) { --stroke-border: 0px; }
|
|
46
|
+
|
|
44
47
|
md-focus-ring {
|
|
45
48
|
position: absolute;
|
|
46
49
|
inset: 0;
|
|
@@ -125,11 +128,11 @@ let a = class extends S {
|
|
|
125
128
|
|
|
126
129
|
:host([trailing-variant="checkbox"]) .row,
|
|
127
130
|
:host([trailing-variant="switch"]) .row {
|
|
128
|
-
|
|
131
|
+
cursor: pointer;
|
|
129
132
|
}
|
|
130
133
|
|
|
131
134
|
:host([disabled]) .row {
|
|
132
|
-
|
|
135
|
+
cursor: default;
|
|
133
136
|
}
|
|
134
137
|
|
|
135
138
|
.link { text-decoration: none; color: inherit; display: contents; }
|
|
@@ -260,6 +263,9 @@ r([
|
|
|
260
263
|
r([
|
|
261
264
|
s({ type: Number, reflect: !0 })
|
|
262
265
|
], a.prototype, "density", 2);
|
|
266
|
+
r([
|
|
267
|
+
s({ type: Boolean, attribute: "no-divider", reflect: !0 })
|
|
268
|
+
], a.prototype, "noDivider", 2);
|
|
263
269
|
a = r([
|
|
264
270
|
V("scb-list-item")
|
|
265
271
|
], a);
|
package/scb-list/scb-list.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { LitElement, TemplateResult } from 'lit';
|
|
2
2
|
export declare class ScbList extends LitElement {
|
|
3
3
|
#private;
|
|
4
|
+
noDivider: boolean;
|
|
4
5
|
private _slotEl;
|
|
5
6
|
protected firstUpdated(): Promise<void>;
|
|
6
7
|
private _onSlotChange;
|
|
@@ -10,3 +11,8 @@ export declare class ScbList extends LitElement {
|
|
|
10
11
|
static styles: import('lit').CSSResult[];
|
|
11
12
|
render(): TemplateResult;
|
|
12
13
|
}
|
|
14
|
+
declare global {
|
|
15
|
+
interface HTMLElementTagNameMap {
|
|
16
|
+
'scb-list': ScbList;
|
|
17
|
+
}
|
|
18
|
+
}
|
package/scb-list/scb-list.js
CHANGED
|
@@ -1,69 +1,69 @@
|
|
|
1
|
-
import { css as
|
|
2
|
-
import {
|
|
1
|
+
import { css as v, LitElement as f, html as u } from "lit";
|
|
2
|
+
import { property as m, query as _, customElement as b } from "lit/decorators.js";
|
|
3
3
|
import "./scb-list-item.js";
|
|
4
|
-
var g = Object.defineProperty,
|
|
4
|
+
var g = Object.defineProperty, y = Object.getOwnPropertyDescriptor, c = (e) => {
|
|
5
5
|
throw TypeError(e);
|
|
6
|
-
},
|
|
7
|
-
for (var
|
|
8
|
-
(
|
|
9
|
-
return
|
|
10
|
-
},
|
|
11
|
-
let
|
|
6
|
+
}, l = (e, t, r, s) => {
|
|
7
|
+
for (var i = s > 1 ? void 0 : s ? y(t, r) : t, a = e.length - 1, o; a >= 0; a--)
|
|
8
|
+
(o = e[a]) && (i = (s ? o(t, r, i) : o(i)) || i);
|
|
9
|
+
return s && i && g(t, r, i), i;
|
|
10
|
+
}, p = (e, t, r) => t.has(e) || c("Cannot " + r), w = (e, t, r) => (p(e, t, "read from private field"), t.get(e)), A = (e, t, r) => t.has(e) ? c("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, r), k = (e, t, r, s) => (p(e, t, "write to private field"), t.set(e, r), r), d;
|
|
11
|
+
let n = class extends f {
|
|
12
12
|
constructor() {
|
|
13
|
-
super(...arguments),
|
|
13
|
+
super(...arguments), A(this, d, !1), this.noDivider = !1, this._onSlotChange = () => this._setupItems();
|
|
14
14
|
}
|
|
15
15
|
async firstUpdated() {
|
|
16
|
-
w(this,
|
|
16
|
+
w(this, d) || (await import("@material/web/list/list.js"), k(this, d, !0)), this._setupItems();
|
|
17
17
|
}
|
|
18
18
|
_getItems() {
|
|
19
19
|
var t;
|
|
20
|
-
return (((t = this._slotEl) == null ? void 0 : t.assignedElements({ flatten: !0 })) ?? []).filter((
|
|
20
|
+
return (((t = this._slotEl) == null ? void 0 : t.assignedElements({ flatten: !0 })) ?? []).filter((r) => r instanceof HTMLElement);
|
|
21
21
|
}
|
|
22
22
|
_setupItems() {
|
|
23
|
-
var
|
|
24
|
-
this._getItems().forEach((
|
|
25
|
-
|
|
23
|
+
var r;
|
|
24
|
+
this._getItems().forEach((s, i) => {
|
|
25
|
+
s.hasAttribute("role") || s.setAttribute("role", "listitem"), s.setAttribute("tabindex", i === 0 ? "0" : "-1");
|
|
26
26
|
});
|
|
27
|
-
const t = (
|
|
28
|
-
t && !t.hasAttribute("data-kbd") && (t.setAttribute("data-kbd", "true"), t.addEventListener("keydown", (
|
|
27
|
+
const t = (r = this.renderRoot) == null ? void 0 : r.querySelector("md-list");
|
|
28
|
+
t && !t.hasAttribute("data-kbd") && (t.setAttribute("data-kbd", "true"), t.addEventListener("keydown", (s) => this._onKeyDown(s)));
|
|
29
29
|
}
|
|
30
30
|
_onKeyDown(e) {
|
|
31
31
|
const t = this._getItems();
|
|
32
32
|
if (!t.length) return;
|
|
33
|
-
const
|
|
34
|
-
const
|
|
35
|
-
t.forEach((
|
|
36
|
-
const
|
|
37
|
-
|
|
33
|
+
const r = t.findIndex((i) => i.getAttribute("tabindex") === "0"), s = (i) => {
|
|
34
|
+
const a = (i % t.length + t.length) % t.length;
|
|
35
|
+
t.forEach((h) => h.setAttribute("tabindex", "-1"));
|
|
36
|
+
const o = t[a];
|
|
37
|
+
o.setAttribute("tabindex", "0"), o.focus();
|
|
38
38
|
};
|
|
39
39
|
switch (e.key) {
|
|
40
40
|
case "ArrowDown":
|
|
41
41
|
case "ArrowRight":
|
|
42
|
-
e.preventDefault(), r
|
|
42
|
+
e.preventDefault(), s(r < 0 ? 0 : r + 1);
|
|
43
43
|
break;
|
|
44
44
|
case "ArrowUp":
|
|
45
45
|
case "ArrowLeft":
|
|
46
|
-
e.preventDefault(), r
|
|
46
|
+
e.preventDefault(), s(r < 0 ? 0 : r - 1);
|
|
47
47
|
break;
|
|
48
48
|
case "Home":
|
|
49
|
-
e.preventDefault(),
|
|
49
|
+
e.preventDefault(), s(0);
|
|
50
50
|
break;
|
|
51
51
|
case "End":
|
|
52
|
-
e.preventDefault(),
|
|
52
|
+
e.preventDefault(), s(t.length - 1);
|
|
53
53
|
break;
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
render() {
|
|
57
|
-
return
|
|
57
|
+
return u`
|
|
58
58
|
<md-list role="list" @slotchange=${this._onSlotChange}>
|
|
59
59
|
<slot></slot>
|
|
60
60
|
</md-list>
|
|
61
61
|
`;
|
|
62
62
|
}
|
|
63
63
|
};
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
64
|
+
d = /* @__PURE__ */ new WeakMap();
|
|
65
|
+
n.styles = [
|
|
66
|
+
v`
|
|
67
67
|
:host {
|
|
68
68
|
display: block;
|
|
69
69
|
--scb-list-bg: var(--md-sys-color-surface-container-lowest);
|
|
@@ -73,17 +73,27 @@ l.styles = [
|
|
|
73
73
|
background: var(--scb-list-bg);
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
|
|
76
|
+
/* Visa top-border på första raden endast när listan saknar no-divider
|
|
77
|
+
och endast om första item inte själv är markerad med no-divider. */
|
|
78
|
+
:host(:not([no-divider])) ::slotted(scb-list-item:first-of-type:not([no-divider])) {
|
|
77
79
|
border-top: 1px solid var(--md-sys-color-outline-variant);
|
|
78
80
|
}
|
|
81
|
+
|
|
82
|
+
/* När listan har no-divider, tryck ned variabeln till alla barn */
|
|
83
|
+
:host([no-divider]) ::slotted(scb-list-item) {
|
|
84
|
+
--stroke-border: 0px;
|
|
85
|
+
}
|
|
79
86
|
`
|
|
80
87
|
];
|
|
81
|
-
|
|
82
|
-
m("
|
|
83
|
-
],
|
|
84
|
-
l
|
|
85
|
-
|
|
86
|
-
],
|
|
88
|
+
l([
|
|
89
|
+
m({ type: Boolean, attribute: "no-divider", reflect: !0 })
|
|
90
|
+
], n.prototype, "noDivider", 2);
|
|
91
|
+
l([
|
|
92
|
+
_("slot")
|
|
93
|
+
], n.prototype, "_slotEl", 2);
|
|
94
|
+
n = l([
|
|
95
|
+
b("scb-list")
|
|
96
|
+
], n);
|
|
87
97
|
export {
|
|
88
|
-
|
|
98
|
+
n as ScbList
|
|
89
99
|
};
|