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.
@@ -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
- cursor: pointer;
131
+ cursor: pointer;
129
132
  }
130
133
 
131
134
  :host([disabled]) .row {
132
- cursor: default;
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);
@@ -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
+ }
@@ -1,69 +1,69 @@
1
- import { css as u, LitElement as f, html as _ } from "lit";
2
- import { query as m, customElement as v } from "lit/decorators.js";
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, b = Object.getOwnPropertyDescriptor, c = (e) => {
4
+ var g = Object.defineProperty, y = Object.getOwnPropertyDescriptor, c = (e) => {
5
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 {
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), y(this, n, !1), this._onSlotChange = () => this._setupItems();
13
+ super(...arguments), A(this, d, !1), this.noDivider = !1, this._onSlotChange = () => this._setupItems();
14
14
  }
15
15
  async firstUpdated() {
16
- w(this, n) || (await import("@material/web/list/list.js"), A(this, n, !0)), this._setupItems();
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((s) => s instanceof HTMLElement);
20
+ return (((t = this._slotEl) == null ? void 0 : t.assignedElements({ flatten: !0 })) ?? []).filter((r) => r instanceof HTMLElement);
21
21
  }
22
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");
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 = (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)));
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 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();
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(s < 0 ? 0 : s + 1);
42
+ e.preventDefault(), s(r < 0 ? 0 : r + 1);
43
43
  break;
44
44
  case "ArrowUp":
45
45
  case "ArrowLeft":
46
- e.preventDefault(), r(s < 0 ? 0 : s - 1);
46
+ e.preventDefault(), s(r < 0 ? 0 : r - 1);
47
47
  break;
48
48
  case "Home":
49
- e.preventDefault(), r(0);
49
+ e.preventDefault(), s(0);
50
50
  break;
51
51
  case "End":
52
- e.preventDefault(), r(t.length - 1);
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
- n = /* @__PURE__ */ new WeakMap();
65
- l.styles = [
66
- u`
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
- ::slotted(scb-list-item:first-of-type) {
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
- d([
82
- m("slot")
83
- ], l.prototype, "_slotEl", 2);
84
- l = d([
85
- v("scb-list")
86
- ], l);
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
- l as ScbList
98
+ n as ScbList
89
99
  };