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.
Files changed (85) hide show
  1. package/mvc/components/scb-accordion/scb-accordion.js +8 -2
  2. package/mvc/components/scb-avatar/scb-avatar.js +19 -10
  3. package/mvc/components/scb-breadcrumb/scb-breadcrumb-item.js +2 -3
  4. package/mvc/components/scb-breadcrumb/scb-breadcrumb.js +13 -7
  5. package/mvc/components/scb-button/scb-button.js +34 -32
  6. package/mvc/components/scb-calendar-card/scb-calendar-card.js +13 -11
  7. package/mvc/components/scb-card/scb-card.js +44 -41
  8. package/mvc/components/scb-checkbox/scb-checkbox-group.js +15 -13
  9. package/mvc/components/scb-checkbox/scb-checkbox.js +6 -6
  10. package/mvc/components/scb-chip/scb-chip.js +27 -7
  11. package/mvc/components/scb-divider/scb-divider.js +41 -15
  12. package/mvc/components/scb-fact-card/scb-fact-card.js +37 -18
  13. package/mvc/components/scb-horizontal-scroller/scb-horizontal-scroller.js +71 -43
  14. package/mvc/components/scb-icon-button/scb-icon-button.js +15 -10
  15. package/mvc/components/scb-keyfigure-card/scb-keyfigure-card.js +6 -4
  16. package/mvc/components/scb-list/scb-list.js +3 -3
  17. package/mvc/components/scb-notification-card/scb-notification-card.js +5 -5
  18. package/mvc/components/scb-pagination/scb-pagination.js +165 -107
  19. package/mvc/components/scb-radio-button/scb-radio-group.js +22 -11
  20. package/mvc/components/scb-search/scb-search.js +84 -32
  21. package/mvc/components/scb-segmented-button/scb-segmented-button.js +3 -2
  22. package/mvc/components/scb-status-pill/scb-status-pill.js +17 -13
  23. package/mvc/components/scb-stepper/scb-stepper.js +32 -29
  24. package/mvc/components/scb-switch/scb-switch.js +11 -8
  25. package/mvc/components/scb-tabs/scb-tabs.js +22 -19
  26. package/mvc/components/scb-textfield/scb-textfield.js +14 -10
  27. package/mvc/components/scb-toc/scb-toc.js +6 -3
  28. package/mvc/components/scb-viz/scb-viz.js +188 -178
  29. package/package.json +2 -2
  30. package/scb-accordion/scb-accordion.d.ts +13 -0
  31. package/scb-accordion/scb-accordion.js +53 -21
  32. package/scb-avatar/scb-avatar.d.ts +6 -0
  33. package/scb-avatar/scb-avatar.js +96 -61
  34. package/scb-breadcrumb/scb-breadcrumb-item.js +8 -9
  35. package/scb-breadcrumb/scb-breadcrumb.d.ts +6 -0
  36. package/scb-breadcrumb/scb-breadcrumb.js +61 -30
  37. package/scb-button/scb-button.d.ts +10 -0
  38. package/scb-button/scb-button.js +89 -65
  39. package/scb-calendar-card/scb-calendar-card.d.ts +5 -0
  40. package/scb-calendar-card/scb-calendar-card.js +79 -55
  41. package/scb-card/scb-card.d.ts +5 -0
  42. package/scb-card/scb-card.js +165 -140
  43. package/scb-checkbox/scb-checkbox-group.d.ts +3 -1
  44. package/scb-checkbox/scb-checkbox-group.js +59 -40
  45. package/scb-checkbox/scb-checkbox.d.ts +11 -0
  46. package/scb-checkbox/scb-checkbox.js +78 -56
  47. package/scb-chip/scb-chip.d.ts +24 -0
  48. package/scb-chip/scb-chip.js +137 -65
  49. package/scb-divider/scb-divider.d.ts +14 -0
  50. package/scb-divider/scb-divider.js +91 -43
  51. package/scb-fact-card/scb-fact-card.d.ts +10 -0
  52. package/scb-fact-card/scb-fact-card.js +135 -94
  53. package/scb-horizontal-scroller/scb-horizontal-scroller.d.ts +10 -0
  54. package/scb-horizontal-scroller/scb-horizontal-scroller.js +179 -120
  55. package/scb-icon-button/scb-icon-button.d.ts +6 -1
  56. package/scb-icon-button/scb-icon-button.js +81 -59
  57. package/scb-keyfigure-card/scb-keyfigure-card.d.ts +10 -0
  58. package/scb-keyfigure-card/scb-keyfigure-card.js +76 -52
  59. package/scb-list/scb-list.d.ts +7 -1
  60. package/scb-list/scb-list.js +62 -40
  61. package/scb-notification-card/scb-notification-card.d.ts +5 -0
  62. package/scb-notification-card/scb-notification-card.js +56 -39
  63. package/scb-pagination/scb-pagination.d.ts +12 -1
  64. package/scb-pagination/scb-pagination.js +235 -147
  65. package/scb-radio-button/scb-radio-group.d.ts +14 -3
  66. package/scb-radio-button/scb-radio-group.js +120 -67
  67. package/scb-search/scb-search.d.ts +15 -2
  68. package/scb-search/scb-search.js +152 -69
  69. package/scb-segmented-button/scb-segmented-button.d.ts +41 -4
  70. package/scb-segmented-button/scb-segmented-button.js +145 -61
  71. package/scb-status-pill/scb-status-pill.d.ts +12 -1
  72. package/scb-status-pill/scb-status-pill.js +51 -27
  73. package/scb-stepper/scb-stepper.d.ts +11 -3
  74. package/scb-stepper/scb-stepper.js +134 -101
  75. package/scb-switch/scb-switch.d.ts +21 -2
  76. package/scb-switch/scb-switch.js +97 -45
  77. package/scb-tabs/scb-tabs.d.ts +8 -0
  78. package/scb-tabs/scb-tabs.js +74 -44
  79. package/scb-textfield/scb-textfield.d.ts +7 -0
  80. package/scb-textfield/scb-textfield.js +43 -16
  81. package/scb-toc/scb-toc.d.ts +10 -1
  82. package/scb-toc/scb-toc.js +49 -18
  83. package/scb-viz/scb-viz.d.ts +10 -3
  84. package/scb-viz/scb-viz.js +278 -236
  85. package/scb-wc-test.bundle.js +1171 -890
@@ -1,41 +1,43 @@
1
- import { css as m, LitElement as u, html as i } from "lit";
2
- import { property as s, customElement as b } from "lit/decorators.js";
1
+ import { css as v, LitElement as y, html as s } from "lit";
2
+ import { property as r, customElement as f } from "lit/decorators.js";
3
3
  import "@material/web/focus/md-focus-ring.js";
4
4
  import "../scb-list/scb-list.js";
5
5
  import "../scb-button/scb-button.js";
6
6
  import "../scb-link/scb-link.js";
7
7
  import "../scb-avatar/scb-avatar.js";
8
- var v = Object.defineProperty, g = Object.getOwnPropertyDescriptor, e = (o, r, n, a) => {
9
- for (var l = a > 1 ? void 0 : a ? g(r, n) : r, d = o.length - 1, c; d >= 0; d--)
10
- (c = o[d]) && (l = (a ? c(r, n, l) : c(l)) || l);
11
- return a && l && v(r, n, l), l;
12
- };
13
- let t = class extends u {
8
+ var x = Object.defineProperty, $ = Object.getOwnPropertyDescriptor, b = (i) => {
9
+ throw TypeError(i);
10
+ }, a = (i, e, o, n) => {
11
+ for (var c = n > 1 ? void 0 : n ? $(e, o) : e, d = i.length - 1, l; d >= 0; d--)
12
+ (l = i[d]) && (c = (n ? l(e, o, c) : l(c)) || c);
13
+ return n && c && x(e, o, c), c;
14
+ }, z = (i, e, o) => e.has(i) || b("Cannot " + o), w = (i, e, o) => e.has(i) ? b("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(i) : e.set(i, o), u = (i, e, o) => (z(i, e, "access private method"), o), h, m;
15
+ let t = class extends y {
14
16
  constructor() {
15
- super(...arguments), this.type = "", this.variant = "", this.direction = "", this.mediaType = "", this.mediaHref = "", this.mediaAlt = "", this.mediaSrcset = "", this.mediaSizes = "", this.mediaLoading = "auto", this.mediaDecoding = "async", this.mediaFetchPriority = "auto", this.mediaFit = "cover", this.mediaPosition = "center", this.mediaWidth = "", this.mediaHeight = "", this.mediaAspect = "", this.mediaPlaceholder = !1, this.cardHref = "", this.title = "", this.subtitle = "", this.supportingText = "", this.commentsText = "", this.comments = 0, this.likesText = "", this.likes = 0, this.sizing = "stretch", this.width = "", this.maxWidth = "", this.height = "", this.maxHeight = "", this.__onImgLoad = (o) => {
16
- const r = o.currentTarget.closest(".media");
17
- r && r.classList.add("is-loaded");
18
- }, this.__onKeyDown = (o) => {
19
- (o.key === "Enter" || o.key === " ") && this.cardHref && (o.preventDefault(), window.open(this.cardHref, "_self"));
20
- }, this.__handleHrefNavigation = (o) => {
21
- this.cardHref && (o.target.closest("a") || window.open(this.cardHref, "_self"));
17
+ super(...arguments), w(this, h), this.type = "", this.variant = "", this.direction = "", this.mediaType = "", this.mediaHref = "", this.mediaAlt = "", this.mediaSrcset = "", this.mediaSizes = "", this.mediaLoading = "auto", this.mediaDecoding = "async", this.mediaFetchPriority = "auto", this.mediaFit = "cover", this.mediaPosition = "center", this.mediaWidth = "", this.mediaHeight = "", this.mediaAspect = "", this.mediaPlaceholder = !1, this.cardHref = "", this.title = "", this.subtitle = "", this.supportingText = "", this.commentsText = "", this.comments = 0, this.likesText = "", this.likes = 0, this.sizing = "stretch", this.width = "", this.maxWidth = "", this.height = "", this.maxHeight = "", this.spacing = "", this.spacingTop = "", this.spacingBottom = "", this.__onImgLoad = (i) => {
18
+ const e = i.currentTarget.closest(".media");
19
+ e && e.classList.add("is-loaded");
20
+ }, this.__onKeyDown = (i) => {
21
+ (i.key === "Enter" || i.key === " ") && this.cardHref && (i.preventDefault(), window.open(this.cardHref, "_self"));
22
+ }, this.__handleHrefNavigation = (i) => {
23
+ this.cardHref && (i.target.closest("a") || window.open(this.cardHref, "_self"));
22
24
  };
23
25
  }
24
26
  /* Beräkna fallback-mått från media-aspect. Används endast om width/height saknas. */
25
- __calcAspectWH(o) {
26
- const r = (o || "").trim();
27
- if (!r) return { w: 640, h: 360 };
28
- const n = r.includes("/") ? r.split("/") : r.includes(":") ? r.split(":") : r.includes("x") ? r.split("x") : null;
29
- if (n && n.length === 2) {
30
- const l = Number(n[0]), d = Number(n[1]);
31
- if (l > 0 && d > 0) return { w: l, h: d };
32
- }
33
- const a = Number(r);
34
- return isFinite(a) && a > 0 ? { w: 1e3, h: Math.round(1e3 / a) } : { w: 640, h: 360 };
27
+ __calcAspectWH(i) {
28
+ const e = (i || "").trim();
29
+ if (!e) return { w: 640, h: 360 };
30
+ const o = e.includes("/") ? e.split("/") : e.includes(":") ? e.split(":") : e.includes("x") ? e.split("x") : null;
31
+ if (o && o.length === 2) {
32
+ const c = Number(o[0]), d = Number(o[1]);
33
+ if (c > 0 && d > 0) return { w: c, h: d };
34
+ }
35
+ const n = Number(e);
36
+ return isFinite(n) && n > 0 ? { w: 1e3, h: Math.round(1e3 / n) } : { w: 640, h: 360 };
35
37
  }
36
38
  __mediaTemplate() {
37
39
  if ((this.mediaType || "").toLowerCase() === "avatar")
38
- return i`
40
+ return s`
39
41
  <div class="media">
40
42
  <slot name="media">
41
43
  <scb-avatar variant="icon" label="${this.title}" icon-name="person"></scb-avatar>
@@ -43,15 +45,15 @@ let t = class extends u {
43
45
  </div>
44
46
  `;
45
47
  if (this.mediaHref || this.mediaSrcset) {
46
- let r = Number(this.mediaWidth) || 0, n = Number(this.mediaHeight) || 0;
47
- const a = (this.mediaAspect || "").trim();
48
- if (!r || !n) {
49
- const h = this.__calcAspectWH(a || "16/9");
50
- r || (r = h.w), n || (n = h.h);
48
+ let e = Number(this.mediaWidth) || 0, o = Number(this.mediaHeight) || 0;
49
+ const n = (this.mediaAspect || "").trim();
50
+ if (!e || !o) {
51
+ const g = this.__calcAspectWH(n || "16/9");
52
+ e || (e = g.w), o || (o = g.h);
51
53
  }
52
- const l = `aspect-ratio:${a || `${r}/${n}`};`, d = this.mediaPlaceholder ? "has-ph" : "", c = this.mediaFit || "cover", p = this.mediaPosition || "center";
53
- return i`
54
- <div class="media ${d}" style="${l}">
54
+ const c = `aspect-ratio:${n || `${e}/${o}`};`, d = this.mediaPlaceholder ? "has-ph" : "", l = this.mediaFit || "cover", p = this.mediaPosition || "center";
55
+ return s`
56
+ <div class="media ${d}" style="${c}">
55
57
  <slot name="media-sources"></slot>
56
58
  <img
57
59
  src="${this.mediaHref || ""}"
@@ -61,9 +63,9 @@ let t = class extends u {
61
63
  loading="${this.mediaLoading}"
62
64
  decoding="${this.mediaDecoding}"
63
65
  fetchpriority="${this.mediaFetchPriority}"
64
- style="object-fit:${c};object-position:${p};"
65
- width="${r}"
66
- height="${n}"
66
+ style="object-fit:${l};object-position:${p};"
67
+ width="${e}"
68
+ height="${o}"
67
69
  @load=${this.__onImgLoad}
68
70
  />
69
71
  </div>
@@ -71,12 +73,18 @@ let t = class extends u {
71
73
  }
72
74
  return null;
73
75
  }
76
+ mapSpacingToken(i) {
77
+ if (!i) return;
78
+ const e = String(i).trim();
79
+ if (e)
80
+ return /^\d+$/.test(e) ? `var(--spacing-${Math.max(0, Math.min(14, parseInt(e, 10)))})` : e;
81
+ }
74
82
  render() {
75
- const o = this.variant ? `${this.variant.toLowerCase()}` : "", r = this.type === "list" ? "vertical" : this.direction ? this.direction.toLowerCase() : "", n = this.cardHref ? "clickable" : "", a = this.date instanceof Date ? this.date.toISOString().slice(0, 10) : this.date || "", l = (p = !1) => p ? i`<a class="title" href="${this.cardHref}" tabindex="0"
83
+ const i = this.variant ? `${this.variant.toLowerCase()}` : "", e = this.type === "list" ? "vertical" : this.direction ? this.direction.toLowerCase() : "", o = this.cardHref ? "clickable" : "", n = this.date instanceof Date ? this.date.toISOString().slice(0, 10) : this.date || "", c = (p = !1) => p ? s`<a class="title" href="${this.cardHref}" tabindex="0"
76
84
  >${this.title}</a
77
- ><md-icon>arrow_forward</md-icon>` : i`<span class="title">${this.title}</span>`, d = () => this.__mediaTemplate(), c = (p) => i`
85
+ ><md-icon>arrow_forward</md-icon>` : s`<span class="title">${this.title}</span>`, d = () => this.__mediaTemplate(), l = (p) => s`
78
86
  <div
79
- class="scb-card ${o} ${r} ${n}"
87
+ class="scb-card ${i} ${e} ${o}"
80
88
  @click=${this.cardHref ? this.__handleHrefNavigation : null}
81
89
  @keydown=${this.cardHref ? this.__onKeyDown : null}
82
90
  style="cursor:${this.cardHref ? "pointer" : "default"};"
@@ -84,7 +92,7 @@ let t = class extends u {
84
92
  tabindex=${this.cardHref ? "0" : "-1"}
85
93
  aria-label=${this.title || "Kort"}
86
94
  >
87
- ${this.cardHref ? i`<md-ripple></md-ripple>` : ""}
95
+ ${this.cardHref ? s`<md-ripple></md-ripple>` : ""}
88
96
  ${d()}
89
97
  ${p}
90
98
  </div>
@@ -92,24 +100,24 @@ let t = class extends u {
92
100
  `;
93
101
  switch (this.type) {
94
102
  case "standard":
95
- return c(i`
103
+ return l(s`
96
104
  <div class="full-content">
97
105
  <div class="top-content">
98
- ${this.title ? i`<div class="header">${l(!!this.cardHref)}</div>` : ""}
99
- ${this.subtitle ? i`<div class="sub-label">${this.subtitle}</div>` : ""}
100
- ${this.supportingText ? i`<div class="supporting-text">${this.supportingText}</div>` : ""}
101
- ${a ? i`<div class="date">${a}</div>` : ""}
106
+ ${this.title ? s`<div class="header">${c(!!this.cardHref)}</div>` : ""}
107
+ ${this.subtitle ? s`<div class="sub-label">${this.subtitle}</div>` : ""}
108
+ ${this.supportingText ? s`<div class="supporting-text">${this.supportingText}</div>` : ""}
109
+ ${n ? s`<div class="date">${n}</div>` : ""}
102
110
  </div>
103
111
  </div>
104
112
  `);
105
113
  case "list":
106
- return c(i`
114
+ return l(s`
107
115
  <div class="full-content">
108
116
  <div class="top-content">
109
- ${this.title ? i`<div class="header"><span class="title">${this.title}</span></div>` : ""}
110
- ${this.subtitle ? i`<div class="sub-label">${this.subtitle}</div>` : ""}
111
- ${this.supportingText ? i`<div class="supporting-text">${this.supportingText}</div>` : ""}
112
- ${a ? i`<div class="date">${a}</div>` : ""}
117
+ ${this.title ? s`<div class="header"><span class="title">${this.title}</span></div>` : ""}
118
+ ${this.subtitle ? s`<div class="sub-label">${this.subtitle}</div>` : ""}
119
+ ${this.supportingText ? s`<div class="supporting-text">${this.supportingText}</div>` : ""}
120
+ ${n ? s`<div class="date">${n}</div>` : ""}
113
121
  </div>
114
122
  <div class="content list">
115
123
  <slot></slot>
@@ -117,13 +125,13 @@ let t = class extends u {
117
125
  </div>
118
126
  `);
119
127
  case "social":
120
- return c(i`
128
+ return l(s`
121
129
  <div class="full-content">
122
130
  <div class="top-content">
123
- ${this.title ? i`<div class="header">${l(!!this.cardHref)}</div>` : ""}
124
- ${this.subtitle ? i`<div class="sub-label">${this.subtitle}</div>` : ""}
125
- ${this.supportingText ? i`<div class="supporting-text">${this.supportingText}</div>` : ""}
126
- ${a ? i`<div class="date">${a}</div>` : ""}
131
+ ${this.title ? s`<div class="header">${c(!!this.cardHref)}</div>` : ""}
132
+ ${this.subtitle ? s`<div class="sub-label">${this.subtitle}</div>` : ""}
133
+ ${this.supportingText ? s`<div class="supporting-text">${this.supportingText}</div>` : ""}
134
+ ${n ? s`<div class="date">${n}</div>` : ""}
127
135
  </div>
128
136
  <div class="content">
129
137
  <div class="social-metrics">
@@ -140,13 +148,13 @@ let t = class extends u {
140
148
  </div>
141
149
  `);
142
150
  case "link":
143
- return c(i`
151
+ return l(s`
144
152
  <div class="full-content">
145
153
  <div class="top-content">
146
- ${this.title ? i`<div class="header"><span class="title">${this.title}</span></div>` : ""}
147
- ${this.subtitle ? i`<div class="sub-label">${this.subtitle}</div>` : ""}
148
- ${this.supportingText ? i`<div class="supporting-text">${this.supportingText}</div>` : ""}
149
- ${a ? i`<div class="date">${a}</div>` : ""}
154
+ ${this.title ? s`<div class="header"><span class="title">${this.title}</span></div>` : ""}
155
+ ${this.subtitle ? s`<div class="sub-label">${this.subtitle}</div>` : ""}
156
+ ${this.supportingText ? s`<div class="supporting-text">${this.supportingText}</div>` : ""}
157
+ ${n ? s`<div class="date">${n}</div>` : ""}
150
158
  </div>
151
159
  <div class="content links">
152
160
  <slot></slot>
@@ -154,13 +162,13 @@ let t = class extends u {
154
162
  </div>
155
163
  `);
156
164
  case "action":
157
- return c(i`
165
+ return l(s`
158
166
  <div class="full-content">
159
167
  <div class="top-content">
160
- ${this.title ? i`<div class="header"><span class="title">${this.title}</span></div>` : ""}
161
- ${this.subtitle ? i`<div class="sub-label">${this.subtitle}</div>` : ""}
162
- ${this.supportingText ? i`<div class="supporting-text">${this.supportingText}</div>` : ""}
163
- ${a ? i`<div class="date">${a}</div>` : ""}
168
+ ${this.title ? s`<div class="header"><span class="title">${this.title}</span></div>` : ""}
169
+ ${this.subtitle ? s`<div class="sub-label">${this.subtitle}</div>` : ""}
170
+ ${this.supportingText ? s`<div class="supporting-text">${this.supportingText}</div>` : ""}
171
+ ${n ? s`<div class="date">${n}</div>` : ""}
164
172
  </div>
165
173
  <div class="content actions">
166
174
  <slot></slot>
@@ -168,28 +176,33 @@ let t = class extends u {
168
176
  </div>
169
177
  `);
170
178
  default:
171
- return c(i`
179
+ return l(s`
172
180
  <div class="full-content">
173
181
  <div class="top-content">
174
- ${this.title ? i`<div class="header">${l(!!this.cardHref)}</div>` : ""}
175
- ${this.subtitle ? i`<div class="sub-label">${this.subtitle}</div>` : ""}
176
- ${this.supportingText ? i`<div class="supporting-text">${this.supportingText}</div>` : ""}
177
- ${a ? i`<div class="date">${a}</div>` : ""}
182
+ ${this.title ? s`<div class="header">${c(!!this.cardHref)}</div>` : ""}
183
+ ${this.subtitle ? s`<div class="sub-label">${this.subtitle}</div>` : ""}
184
+ ${this.supportingText ? s`<div class="supporting-text">${this.supportingText}</div>` : ""}
185
+ ${n ? s`<div class="date">${n}</div>` : ""}
178
186
  </div>
179
187
  </div>
180
188
  `);
181
189
  }
182
190
  }
183
- updated(o) {
184
- super.updated(o), o.has("width") && (this.width ? this.style.inlineSize = this.width : this.style.removeProperty("inline-size")), o.has("maxWidth") && (this.maxWidth ? this.style.maxInlineSize = this.maxWidth : this.style.removeProperty("max-inline-size")), o.has("height") && (this.height ? this.style.blockSize = this.height : this.style.removeProperty("block-size")), o.has("maxHeight") && (this.maxHeight ? this.style.maxBlockSize = this.maxHeight : this.style.removeProperty("max-block-size")), o.has("type") && (this.type === "list" ? this.setAttribute("data-density", "-2") : this.removeAttribute("data-density")), this.style.setProperty("--scb-card-media-fit", this.mediaFit || "cover"), this.style.setProperty("--scb-card-media-position", this.mediaPosition || "center");
191
+ updated(i) {
192
+ super.updated(i), i.has("width") && (this.width ? this.style.inlineSize = this.width : this.style.removeProperty("inline-size")), i.has("maxWidth") && (this.maxWidth ? this.style.maxInlineSize = this.maxWidth : this.style.removeProperty("max-inline-size")), i.has("height") && (this.height ? this.style.blockSize = this.height : this.style.removeProperty("block-size")), i.has("maxHeight") && (this.maxHeight ? this.style.maxBlockSize = this.maxHeight : this.style.removeProperty("max-block-size")), i.has("type") && (this.type === "list" ? this.setAttribute("data-density", "-2") : this.removeAttribute("data-density")), this.style.setProperty("--scb-card-media-fit", this.mediaFit || "cover"), this.style.setProperty("--scb-card-media-position", this.mediaPosition || "center"), (i.has("spacing") || i.has("spacingTop") || i.has("spacingBottom")) && u(this, h, m).call(this);
185
193
  }
186
- async firstUpdated(o) {
187
- t.__iconLoaded || (await import("@material/web/icon/icon.js"), t.__iconLoaded = !0), t.__rippleLoaded || (await import("@material/web/ripple/ripple.js"), t.__rippleLoaded = !0);
194
+ async firstUpdated(i) {
195
+ t.__iconLoaded || (await import("@material/web/icon/icon.js"), t.__iconLoaded = !0), t.__rippleLoaded || (await import("@material/web/ripple/ripple.js"), t.__rippleLoaded = !0), u(this, h, m).call(this);
188
196
  }
189
197
  };
198
+ h = /* @__PURE__ */ new WeakSet();
199
+ m = function() {
200
+ const i = this.mapSpacingToken(this.spacing), e = this.mapSpacingToken(this.spacingTop) ?? i, o = this.mapSpacingToken(this.spacingBottom) ?? i;
201
+ e ? this.style.setProperty("--scb-card-spacing-block-start", e) : this.style.removeProperty("--scb-card-spacing-block-start"), o ? this.style.setProperty("--scb-card-spacing-block-end", o) : this.style.removeProperty("--scb-card-spacing-block-end");
202
+ };
190
203
  t.__iconLoaded = !1;
191
204
  t.__rippleLoaded = !1;
192
- t.styles = m`
205
+ t.styles = v`
193
206
  :host {
194
207
  display: block;
195
208
  box-sizing: border-box;
@@ -202,6 +215,9 @@ t.styles = m`
202
215
  --scb-card-horizontal-media-max: 176px;
203
216
  --scb-card-horizontal-media-min: 96px;
204
217
  --scb-card-horizontal-media-aspect: 16 / 9;
218
+
219
+ margin-block-start: var(--scb-card-spacing-block-start, 0);
220
+ margin-block-end: var(--scb-card-spacing-block-end, 0);
205
221
  }
206
222
  :host([type='standard']) {
207
223
  --scb-card-max-w: var(--scb-card-standard-max-w);
@@ -492,101 +508,110 @@ t.styles = m`
492
508
  --scb-list-bg: var(--md-sys-color-surface-dim);
493
509
  }
494
510
  `;
495
- e([
496
- s({ type: String, reflect: !0 })
511
+ a([
512
+ r({ type: String, reflect: !0 })
497
513
  ], t.prototype, "type", 2);
498
- e([
499
- s({ type: String, reflect: !0 })
514
+ a([
515
+ r({ type: String, reflect: !0 })
500
516
  ], t.prototype, "variant", 2);
501
- e([
502
- s({ type: String, reflect: !0 })
517
+ a([
518
+ r({ type: String, reflect: !0 })
503
519
  ], t.prototype, "direction", 2);
504
- e([
505
- s({ type: String, attribute: "media-type" })
520
+ a([
521
+ r({ type: String, attribute: "media-type" })
506
522
  ], t.prototype, "mediaType", 2);
507
- e([
508
- s({ type: String, attribute: "media-href" })
523
+ a([
524
+ r({ type: String, attribute: "media-href" })
509
525
  ], t.prototype, "mediaHref", 2);
510
- e([
511
- s({ type: String, attribute: "media-alt" })
526
+ a([
527
+ r({ type: String, attribute: "media-alt" })
512
528
  ], t.prototype, "mediaAlt", 2);
513
- e([
514
- s({ type: String, attribute: "media-srcset" })
529
+ a([
530
+ r({ type: String, attribute: "media-srcset" })
515
531
  ], t.prototype, "mediaSrcset", 2);
516
- e([
517
- s({ type: String, attribute: "media-sizes" })
532
+ a([
533
+ r({ type: String, attribute: "media-sizes" })
518
534
  ], t.prototype, "mediaSizes", 2);
519
- e([
520
- s({ type: String, attribute: "media-loading" })
535
+ a([
536
+ r({ type: String, attribute: "media-loading" })
521
537
  ], t.prototype, "mediaLoading", 2);
522
- e([
523
- s({ type: String, attribute: "media-decoding" })
538
+ a([
539
+ r({ type: String, attribute: "media-decoding" })
524
540
  ], t.prototype, "mediaDecoding", 2);
525
- e([
526
- s({ type: String, attribute: "media-fetchpriority" })
541
+ a([
542
+ r({ type: String, attribute: "media-fetchpriority" })
527
543
  ], t.prototype, "mediaFetchPriority", 2);
528
- e([
529
- s({ type: String, attribute: "media-fit" })
544
+ a([
545
+ r({ type: String, attribute: "media-fit" })
530
546
  ], t.prototype, "mediaFit", 2);
531
- e([
532
- s({ type: String, attribute: "media-position" })
547
+ a([
548
+ r({ type: String, attribute: "media-position" })
533
549
  ], t.prototype, "mediaPosition", 2);
534
- e([
535
- s({ type: String, attribute: "media-width" })
550
+ a([
551
+ r({ type: String, attribute: "media-width" })
536
552
  ], t.prototype, "mediaWidth", 2);
537
- e([
538
- s({ type: String, attribute: "media-height" })
553
+ a([
554
+ r({ type: String, attribute: "media-height" })
539
555
  ], t.prototype, "mediaHeight", 2);
540
- e([
541
- s({ type: String, attribute: "media-aspect" })
556
+ a([
557
+ r({ type: String, attribute: "media-aspect" })
542
558
  ], t.prototype, "mediaAspect", 2);
543
- e([
544
- s({ type: Boolean, attribute: "media-placeholder" })
559
+ a([
560
+ r({ type: Boolean, attribute: "media-placeholder" })
545
561
  ], t.prototype, "mediaPlaceholder", 2);
546
- e([
547
- s({ type: String, attribute: "card-href", reflect: !0 })
562
+ a([
563
+ r({ type: String, attribute: "card-href", reflect: !0 })
548
564
  ], t.prototype, "cardHref", 2);
549
- e([
550
- s({ type: String, reflect: !0 })
565
+ a([
566
+ r({ type: String, reflect: !0 })
551
567
  ], t.prototype, "title", 2);
552
- e([
553
- s({ type: String, reflect: !0 })
568
+ a([
569
+ r({ type: String, reflect: !0 })
554
570
  ], t.prototype, "subtitle", 2);
555
- e([
556
- s({ type: String, attribute: "supporting-text", reflect: !0 })
571
+ a([
572
+ r({ type: String, attribute: "supporting-text", reflect: !0 })
557
573
  ], t.prototype, "supportingText", 2);
558
- e([
559
- s({ type: Date, reflect: !0 })
574
+ a([
575
+ r({ type: Date, reflect: !0 })
560
576
  ], t.prototype, "date", 2);
561
- e([
562
- s({ type: String, attribute: "social-comments-text", reflect: !0 })
577
+ a([
578
+ r({ type: String, attribute: "social-comments-text", reflect: !0 })
563
579
  ], t.prototype, "commentsText", 2);
564
- e([
565
- s({ type: Number, attribute: "social-comments", reflect: !0 })
580
+ a([
581
+ r({ type: Number, attribute: "social-comments", reflect: !0 })
566
582
  ], t.prototype, "comments", 2);
567
- e([
568
- s({ type: String, attribute: "social-likes-text", reflect: !0 })
583
+ a([
584
+ r({ type: String, attribute: "social-likes-text", reflect: !0 })
569
585
  ], t.prototype, "likesText", 2);
570
- e([
571
- s({ type: Number, attribute: "social-likes", reflect: !0 })
586
+ a([
587
+ r({ type: Number, attribute: "social-likes", reflect: !0 })
572
588
  ], t.prototype, "likes", 2);
573
- e([
574
- s({ type: String, reflect: !0 })
589
+ a([
590
+ r({ type: String, reflect: !0 })
575
591
  ], t.prototype, "sizing", 2);
576
- e([
577
- s({ type: String, reflect: !0 })
592
+ a([
593
+ r({ type: String, reflect: !0 })
578
594
  ], t.prototype, "width", 2);
579
- e([
580
- s({ type: String, reflect: !0, attribute: "max-width" })
595
+ a([
596
+ r({ type: String, reflect: !0, attribute: "max-width" })
581
597
  ], t.prototype, "maxWidth", 2);
582
- e([
583
- s({ type: String, reflect: !0 })
598
+ a([
599
+ r({ type: String, reflect: !0 })
584
600
  ], t.prototype, "height", 2);
585
- e([
586
- s({ type: String, reflect: !0, attribute: "max-height" })
601
+ a([
602
+ r({ type: String, reflect: !0, attribute: "max-height" })
587
603
  ], t.prototype, "maxHeight", 2);
588
- t = e([
589
- b("scb-card")
604
+ a([
605
+ r({ type: String, reflect: !0 })
606
+ ], t.prototype, "spacing", 2);
607
+ a([
608
+ r({ type: String, attribute: "spacing-top", reflect: !0 })
609
+ ], t.prototype, "spacingTop", 2);
610
+ a([
611
+ r({ type: String, attribute: "spacing-bottom", reflect: !0 })
612
+ ], t.prototype, "spacingBottom", 2);
613
+ t = a([
614
+ f("scb-card")
590
615
  ], t);
591
616
  export {
592
617
  t as ScbCard
@@ -3,7 +3,9 @@ export declare class ScbCheckboxGroup extends LitElement {
3
3
  #private;
4
4
  orientation: 'vertical' | 'horizontal';
5
5
  disabled: boolean;
6
- spacing: 'item' | 'group';
6
+ spacing: string;
7
+ spacingTop: string;
8
+ spacingBottom: string;
7
9
  static styles: import('lit').CSSResult;
8
10
  render(): import('lit-html').TemplateResult<1>;
9
11
  firstUpdated(): void;
@@ -1,76 +1,95 @@
1
- import { css as g, LitElement as b, html as f } from "lit";
2
- import { property as h, customElement as u } from "lit/decorators.js";
3
- var v = Object.defineProperty, y = Object.getOwnPropertyDescriptor, d = (t) => {
1
+ import { css as k, LitElement as y, html as x } from "lit";
2
+ import { property as l, customElement as _ } from "lit/decorators.js";
3
+ var S = Object.defineProperty, C = Object.getOwnPropertyDescriptor, v = (t) => {
4
4
  throw TypeError(t);
5
- }, c = (t, e, r, s) => {
6
- for (var o = s > 1 ? void 0 : s ? y(e, r) : e, n = t.length - 1, l; n >= 0; n--)
7
- (l = t[n]) && (o = (s ? l(e, r, o) : l(o)) || o);
8
- return s && o && v(e, r, o), o;
9
- }, x = (t, e, r) => e.has(t) || d("Cannot " + r), p = (t, e, r) => (x(t, e, "read from private field"), r ? r.call(t) : e.get(t)), _ = (t, e, r) => e.has(t) ? d("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, r), i;
10
- let a = class extends b {
5
+ }, c = (t, e, s, i) => {
6
+ for (var o = i > 1 ? void 0 : i ? C(e, s) : e, g = t.length - 1, b; g >= 0; g--)
7
+ (b = t[g]) && (o = (i ? b(e, s, o) : b(o)) || o);
8
+ return i && o && S(e, s, o), o;
9
+ }, m = (t, e, s) => e.has(t) || v("Cannot " + s), d = (t, e, s) => (m(t, e, "read from private field"), s ? s.call(t) : e.get(t)), f = (t, e, s) => e.has(t) ? v("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, s), p = (t, e, s) => (m(t, e, "access private method"), s), n, a, u, h;
10
+ let r = class extends y {
11
11
  constructor() {
12
- super(...arguments), this.orientation = "vertical", this.disabled = !1, this.spacing = "group", _(this, i, () => {
13
- var r;
14
- const t = (r = this.shadowRoot) == null ? void 0 : r.querySelector("slot");
12
+ super(...arguments), f(this, a), this.orientation = "vertical", this.disabled = !1, this.spacing = "", this.spacingTop = "", this.spacingBottom = "", f(this, n, () => {
13
+ var s;
14
+ const t = (s = this.shadowRoot) == null ? void 0 : s.querySelector("slot");
15
15
  if (!t) return;
16
- const e = t.assignedElements({ flatten: !0 }).filter((s) => s.tagName.toLowerCase() === "scb-checkbox");
17
- for (const s of e)
18
- this.disabled ? s.setAttribute("disabled", "") : s.removeAttribute("disabled"), this.orientation === "horizontal" ? s.setAttribute("orientation", "horizontal") : s.removeAttribute("orientation"), this.spacing === "group" ? s.style.setProperty("--scb-checkbox-gap", "0") : s.style.removeProperty("--scb-checkbox-gap");
16
+ const e = t.assignedElements({ flatten: !0 }).filter((i) => i.tagName.toLowerCase() === "scb-checkbox");
17
+ for (const i of e)
18
+ this.disabled ? i.setAttribute("disabled", "") : i.removeAttribute("disabled"), this.orientation === "horizontal" ? i.setAttribute("orientation", "horizontal") : i.removeAttribute("orientation");
19
19
  });
20
20
  }
21
21
  render() {
22
22
  const t = this.orientation === "horizontal" ? "row" : "column";
23
- return f`
23
+ return x`
24
24
  <div class="g" role="group" aria-disabled=${String(this.disabled)} style=${`--_dir:${t}`}>
25
- <slot @slotchange=${p(this, i)}></slot>
25
+ <slot @slotchange=${d(this, n)}></slot>
26
26
  </div>
27
27
  `;
28
28
  }
29
29
  firstUpdated() {
30
- p(this, i).call(this);
30
+ p(this, a, u).call(this), d(this, n).call(this);
31
31
  }
32
32
  updated(t) {
33
- (t.has("disabled") || t.has("orientation") || t.has("spacing")) && p(this, i).call(this);
33
+ (t.has("spacing") || t.has("spacingTop") || t.has("spacingBottom")) && p(this, a, u).call(this), (t.has("disabled") || t.has("orientation")) && d(this, n).call(this);
34
34
  }
35
35
  };
36
- i = /* @__PURE__ */ new WeakMap();
37
- a.styles = g`
36
+ n = /* @__PURE__ */ new WeakMap();
37
+ a = /* @__PURE__ */ new WeakSet();
38
+ u = function() {
39
+ const t = p(this, a, h).call(this, this.spacing), e = p(this, a, h).call(this, this.spacingTop) ?? t, s = p(this, a, h).call(this, this.spacingBottom) ?? t;
40
+ e ? this.style.setProperty("--scb-checkbox-group-spacing-block-start", e) : this.style.removeProperty("--scb-checkbox-group-spacing-block-start"), s ? this.style.setProperty("--scb-checkbox-group-spacing-block-end", s) : this.style.removeProperty("--scb-checkbox-group-spacing-block-end");
41
+ };
42
+ h = function(t) {
43
+ if (!t) return;
44
+ const e = String(t).trim();
45
+ if (e)
46
+ return /^\d+$/.test(e) ? `var(--spacing-${Math.max(0, Math.min(14, parseInt(e, 10)))})` : e;
47
+ };
48
+ r.styles = k`
38
49
  :host {
39
50
  display: block;
51
+ /* Vertikal standard-spacing mellan items i gruppen */
40
52
  --scb-checkbox-gap: var(--spacing-4, 12px);
53
+
54
+ margin-block-start: var(--scb-checkbox-group-spacing-block-start, 0);
55
+ margin-block-end: var(--scb-checkbox-group-spacing-block-end, 0);
56
+ }
57
+
58
+ /* Horisontell standard-spacing mellan items om spacing för gruppen inte overrideas via CSS-variabel */
59
+ :host([orientation='horizontal']) {
60
+ --scb-checkbox-gap: var(--spacing-8, 32px);
41
61
  }
42
62
 
43
63
  .g {
44
64
  display: flex;
45
65
  flex-direction: var(--_dir, column);
46
66
  align-items: flex-start;
47
- gap: 0;
48
- }
49
-
50
- :host([spacing='group']) .g {
51
67
  gap: var(--scb-checkbox-gap);
52
68
  }
53
69
 
54
- :host([orientation='horizontal']) {
55
- --scb-checkbox-gap: var(--spacing-8, 32px);
56
- }
57
-
58
- :host([spacing='group']) ::slotted(scb-checkbox) {
70
+ /* När checkboxar ligger i en grupp ska spacing ägas av gruppen, inte av enskilda items */
71
+ ::slotted(scb-checkbox) {
59
72
  --scb-checkbox-gap: 0;
60
73
  }
61
74
  `;
62
75
  c([
63
- h({ type: String, reflect: !0 })
64
- ], a.prototype, "orientation", 2);
76
+ l({ type: String, reflect: !0 })
77
+ ], r.prototype, "orientation", 2);
78
+ c([
79
+ l({ type: Boolean, reflect: !0 })
80
+ ], r.prototype, "disabled", 2);
81
+ c([
82
+ l({ type: String, reflect: !0 })
83
+ ], r.prototype, "spacing", 2);
65
84
  c([
66
- h({ type: Boolean, reflect: !0 })
67
- ], a.prototype, "disabled", 2);
85
+ l({ type: String, attribute: "spacing-top", reflect: !0 })
86
+ ], r.prototype, "spacingTop", 2);
68
87
  c([
69
- h({ type: String, reflect: !0 })
70
- ], a.prototype, "spacing", 2);
71
- a = c([
72
- u("scb-checkbox-group")
73
- ], a);
88
+ l({ type: String, attribute: "spacing-bottom", reflect: !0 })
89
+ ], r.prototype, "spacingBottom", 2);
90
+ r = c([
91
+ _("scb-checkbox-group")
92
+ ], r);
74
93
  export {
75
- a as ScbCheckboxGroup
94
+ r as ScbCheckboxGroup
76
95
  };
@@ -1,16 +1,27 @@
1
1
  import { LitElement, TemplateResult, PropertyValues } from 'lit';
2
2
  export declare class ScbCheckbox extends LitElement {
3
+ static formAssociated: boolean;
4
+ private _internals;
5
+ constructor();
3
6
  disabled: boolean;
4
7
  indeterminate: boolean;
5
8
  checked: boolean;
6
9
  label: string;
7
10
  supportingText: string;
8
11
  ariaLabel: string;
12
+ name: string;
13
+ value: string;
14
+ private _form;
15
+ private _formResetHandler;
16
+ private _initialChecked;
9
17
  private _checkboxId;
10
18
  connectedCallback(): void;
19
+ disconnectedCallback(): void;
11
20
  protected firstUpdated(): void;
12
21
  protected updated(changed: PropertyValues): void;
22
+ formDisabledCallback(disabled: boolean): void;
13
23
  private __syncInnerAria;
24
+ private __syncFormValue;
14
25
  static styles: import('lit').CSSResult;
15
26
  render(): TemplateResult;
16
27
  }