scb-wc-test 0.1.106 → 0.1.108

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.
@@ -0,0 +1,404 @@
1
+ import { css as g, LitElement as m, html as n } from "lit";
2
+ import { state as h, property as p, customElement as w } from "lit/decorators.js";
3
+ import "../scb-icon-button/scb-icon-button.js";
4
+ import "../scb-button/scb-button.js";
5
+ import "@material/web/icon/icon.js";
6
+ import "@material/web/ripple/ripple.js";
7
+ import "@material/web/focus/md-focus-ring.js";
8
+ import "../scb-divider/scb-divider.js";
9
+ var v = Object.defineProperty, _ = Object.getOwnPropertyDescriptor, d = (e, t, c, l) => {
10
+ for (var i = l > 1 ? void 0 : l ? _(t, c) : t, o = e.length - 1, s; o >= 0; o--)
11
+ (s = e[o]) && (i = (l ? s(t, c, i) : s(i)) || i);
12
+ return l && i && v(t, c, i), i;
13
+ };
14
+ let a = class extends m {
15
+ constructor() {
16
+ super(...arguments), this._currentDate = /* @__PURE__ */ new Date(), this._selectedDate = null, this._showMonthDropdown = !1, this._showYearDropdown = !1, this.variant = "static", this.lang = "sv", this.selectedValue = "", this.open = !0, this._monthNames = [
17
+ this.lang == "sv" ? "Januari" : "January",
18
+ this.lang == "sv" ? "Februari" : "February",
19
+ this.lang == "sv" ? "Mars" : "March",
20
+ (this.lang == "sv", "April"),
21
+ this.lang == "sv" ? "Maj" : "May",
22
+ this.lang == "sv" ? "Juni" : "June",
23
+ this.lang == "sv" ? "Juli" : "July",
24
+ this.lang == "sv" ? "Augusti" : "August",
25
+ (this.lang == "sv", "September"),
26
+ this.lang == "sv" ? "Oktober" : "October",
27
+ (this.lang == "sv", "November"),
28
+ (this.lang == "sv", "December")
29
+ ], this._prevYear = () => {
30
+ const e = this._currentDate.getFullYear(), t = this._currentDate.getMonth();
31
+ this._currentDate = new Date(e - 1, t, 1);
32
+ }, this._nextYear = () => {
33
+ const e = this._currentDate.getFullYear(), t = this._currentDate.getMonth();
34
+ this._currentDate = new Date(e + 1, t, 1);
35
+ }, this._prevMonth = () => {
36
+ const e = this._currentDate.getFullYear(), t = this._currentDate.getMonth();
37
+ this._currentDate = new Date(e, t - 1, 1);
38
+ }, this._nextMonth = () => {
39
+ const e = this._currentDate.getFullYear(), t = this._currentDate.getMonth();
40
+ this._currentDate = new Date(e, t + 1, 1);
41
+ }, this._close = () => {
42
+ this.open = !1, this.dispatchEvent(new CustomEvent("datepicker-closed", {
43
+ bubbles: !0,
44
+ composed: !0
45
+ }));
46
+ };
47
+ }
48
+ updated(e) {
49
+ if (super.updated(e), e.has("selectedValue") && this.selectedValue) {
50
+ const t = new Date(this.selectedValue);
51
+ isNaN(t.getTime()) || (this._selectedDate = t, this._currentDate = new Date(t.getFullYear(), t.getMonth(), 1));
52
+ }
53
+ }
54
+ _getMonthDays(e, t) {
55
+ const c = new Date(e, t, 1), l = new Date(e, t + 1, 0), i = [];
56
+ let o = [], s = (c.getDay() + 6) % 7;
57
+ for (let r = 0; r < s; r++) o.push(null);
58
+ for (let r = 1; r <= l.getDate(); r++) {
59
+ const u = new Date(e, t, r);
60
+ o.push(u), o.length === 7 && (i.push(o), o = []);
61
+ }
62
+ if (o.length) {
63
+ for (; o.length < 7; ) o.push(null);
64
+ i.push(o);
65
+ }
66
+ return i;
67
+ }
68
+ render() {
69
+ if (!this.open) return n``;
70
+ const e = this._currentDate.getFullYear(), t = this._currentDate.getMonth(), c = /* @__PURE__ */ new Date(), l = this._getMonthDays(e, t), i = Array.from({ length: 101 }, (o, s) => c.getFullYear() - 50 + s);
71
+ return n`
72
+ <div class="datepicker-popup ${this.variant === "popup" ? "popup" : "static"}">
73
+ <div class="header">
74
+ <div class="month-selector ${this._showMonthDropdown ? "open" : ""} ${this._showYearDropdown ? "disable" : ""}">
75
+ <scb-icon-button icon="chevron_left" @click=${this._prevMonth} aria-label=${this.lang == "sv" ? "Föregående månad" : "Previous month"}></scb-icon-button>
76
+ <div class="custom-dropdown month-dropdown">
77
+ <div
78
+ @keydown=${(o) => {
79
+ (o.key === "Enter" || o.key === " ") && (o.preventDefault(), this._toggleMonthDropdown());
80
+ }}
81
+ tabindex="0" class="dropdown-selected" @click=${() => this._toggleMonthDropdown()}>
82
+ ${this._monthNames[t].slice(0, 3)}
83
+ <md-icon>arrow_drop_down</md-icon>
84
+ <md-focus-ring></md-focus-ring>
85
+ <md-ripple></md-ripple>
86
+ </div>
87
+ </div>
88
+ <scb-icon-button icon="chevron_right" @click=${this._nextMonth} aria-label=${this.lang == "sv" ? "Nästa månad" : "Next month"}></scb-icon-button>
89
+ </div>
90
+ <div class="year-selector ${this._showMonthDropdown ? "disable" : ""} ${this._showYearDropdown ? "open" : ""}">
91
+ <scb-icon-button icon="chevron_left" @click=${this._prevYear} aria-label=${this.lang == "sv" ? "Föregående år" : "Previous year"}></scb-icon-button>
92
+ <div class="custom-dropdown year-dropdown">
93
+ <div
94
+ @keydown=${(o) => {
95
+ (o.key === "Enter" || o.key === " ") && (o.preventDefault(), this._toggleYearDropdown());
96
+ }}
97
+ tabindex="0" class="dropdown-selected" @click=${() => this._toggleYearDropdown()}>
98
+ ${e}
99
+ <md-icon>arrow_drop_down</md-icon>
100
+ <md-focus-ring></md-focus-ring>
101
+ <md-ripple></md-ripple>
102
+ </div>
103
+ </div>
104
+ <scb-icon-button icon="chevron_right" @click=${this._nextYear} aria-label=${this.lang == "sv" ? "Nästa år" : "Next year"}></scb-icon-button>
105
+ </div>
106
+ </div>
107
+ ${this._showMonthDropdown || this._showYearDropdown ? n`<scb-divider></scb-divider>` : ""}
108
+ <div class="datepicker-content" style="position:relative;">
109
+ ${this._showMonthDropdown ? n`
110
+ <div class="dropdown-list">
111
+ ${this._monthNames.map((o, s) => n`
112
+ <div
113
+ @keydown=${(r) => {
114
+ (r.key === "Enter" || r.key === " ") && (r.preventDefault(), this._onMonthChangeCustom(s));
115
+ }}
116
+ tabindex="0"
117
+ class="dropdown-item${s === t ? " selected" : ""}"
118
+ @click=${() => this._onMonthChangeCustom(s)}
119
+ id=${s === t ? "selected-month" : ""}
120
+ >
121
+ ${s === t ? n`<md-icon>check</md-icon>` : ""}
122
+ ${o}
123
+ <md-ripple></md-ripple><md-focus-ring inward></md-focus-ring>
124
+ </div>
125
+ `)}
126
+ </div>
127
+ ` : ""}
128
+ ${this._showYearDropdown ? n`
129
+ <div class="dropdown-list">
130
+ ${i.map((o) => n`
131
+ <div
132
+ @keydown=${(s) => {
133
+ (s.key === "Enter" || s.key === " ") && (s.preventDefault(), this._onYearChangeCustom(o));
134
+ }}
135
+ tabindex="0"
136
+ class="dropdown-item${o === e ? " selected" : ""}"
137
+ @click=${() => this._onYearChangeCustom(o)}
138
+ id=${o === e ? "selected-year" : ""}
139
+ >
140
+ ${o === e ? n`<md-icon>check</md-icon>` : ""}
141
+ ${o}
142
+ <md-ripple></md-ripple><md-focus-ring inward></md-focus-ring>
143
+ </div>
144
+ `)}
145
+ </div>
146
+ ` : ""}
147
+ ${!this._showMonthDropdown && !this._showYearDropdown ? n`
148
+ <div class="datepicker-calendar">
149
+ <table>
150
+ <thead>
151
+ <tr>
152
+ <th>${this.lang == "sv" ? "Må" : "Mo"}</th><th>${this.lang == "sv" ? "Ti" : "Tu"}</th><th>${this.lang == "sv" ? "On" : "We"}</th><th>${this.lang == "sv" ? "To" : "Th"}</th><th>${this.lang == "sv", "Fr"}</th><th>${this.lang == "sv" ? "Lö" : "Sa"}</th><th>${this.lang == "sv" ? "Sö" : "Su"}</th>
153
+ </tr>
154
+ </thead>
155
+ <tbody>
156
+ ${l.map((o) => n`
157
+ <tr>
158
+ ${o.map((s) => s ? n`
159
+ <td>
160
+ <div
161
+ @keydown=${(r) => {
162
+ (r.key === "Enter" || r.key === " ") && (r.preventDefault(), this._selectDate(s));
163
+ }}
164
+ role="button"
165
+ tabindex="0"
166
+ class="day${this._isToday(s, c) ? " today" : ""}${this._isSelected(s) ? " selected" : ""}"
167
+ @click=${() => this._selectDate(s)}
168
+ >${s.getDate()}<md-ripple></md-ripple><md-focus-ring></md-focus-ring></div>
169
+ </td>
170
+ ` : n`<td></td>`)}
171
+ </tr>
172
+ `)}
173
+ </tbody>
174
+ </table>
175
+ </div>
176
+ ` : ""}
177
+ </div>
178
+ <div class="datepicker-footer">
179
+ ${!this._showMonthDropdown && !this._showYearDropdown ? n`
180
+ <scb-button variant="text" label=${this.lang == "sv" ? "Stäng" : "Close"} @click=${this._close}></scb-button>
181
+ ` : ""}
182
+ </div>
183
+ </div>
184
+ `;
185
+ }
186
+ _toggleMonthDropdown() {
187
+ this._showMonthDropdown = !this._showMonthDropdown, this._showMonthDropdown && (this._showYearDropdown = !1, setTimeout(() => {
188
+ const e = this.renderRoot.querySelector("#selected-month");
189
+ e && e.scrollIntoView({ block: "center" });
190
+ }, 0));
191
+ }
192
+ _toggleYearDropdown() {
193
+ this._showYearDropdown = !this._showYearDropdown, this._showYearDropdown && (this._showMonthDropdown = !1, setTimeout(() => {
194
+ const e = this.renderRoot.querySelector("#selected-year");
195
+ e && e.scrollIntoView({ block: "center" });
196
+ }, 0));
197
+ }
198
+ _onMonthChangeCustom(e) {
199
+ const t = this._currentDate.getFullYear();
200
+ this._currentDate = new Date(t, e, 1), this._showMonthDropdown = !1;
201
+ }
202
+ _onYearChangeCustom(e) {
203
+ const t = this._currentDate.getMonth();
204
+ this._currentDate = new Date(e, t, 1), this._showYearDropdown = !1;
205
+ }
206
+ _isToday(e, t) {
207
+ return e.getDate() === t.getDate() && e.getMonth() === t.getMonth() && e.getFullYear() === t.getFullYear();
208
+ }
209
+ _isSelected(e) {
210
+ return this._selectedDate && e.getDate() === this._selectedDate.getDate() && e.getMonth() === this._selectedDate.getMonth() && e.getFullYear() === this._selectedDate.getFullYear();
211
+ }
212
+ _selectDate(e) {
213
+ this._selectedDate = e;
214
+ const t = e.toISOString().slice(0, 10);
215
+ this.dispatchEvent(new CustomEvent("date-selected", {
216
+ detail: { value: t },
217
+ bubbles: !0,
218
+ composed: !0
219
+ }));
220
+ }
221
+ };
222
+ a.styles = [
223
+ g`
224
+ :host {
225
+ --scb-datepicker-width: 380px;
226
+ width: var(--scb-datepicker-width);
227
+ font-family: var(--brand-font);
228
+ color: var(--md-sys-color-on-surface);
229
+ }
230
+ .month-selector, .year-selector {
231
+ display: flex;
232
+ align-items: center;
233
+ &.disable{
234
+ pointer-events: none;
235
+ opacity: 0.3;
236
+ scb-icon-button{
237
+ visibility: hidden;
238
+ }
239
+ }
240
+ &.open{
241
+ scb-icon-button{
242
+ visibility: hidden;
243
+ }
244
+ .dropdown-selected{
245
+ background: var(--md-sys-color-secondary-container);
246
+ }
247
+ }
248
+ }
249
+ .dropdown-selected {
250
+ position: relative;
251
+ border-radius: 8px;
252
+ font-size: 16px;
253
+ cursor: pointer;
254
+ text-align: left;
255
+ display: flex;
256
+ gap: 8px;
257
+ align-items: center;
258
+ padding: 4px 8px;
259
+ }
260
+ .dropdown-selected:focus {
261
+ outline: none;
262
+ }
263
+ .dropdown-selected md-focus-ring {
264
+ border-radius: 8px;
265
+ }
266
+ .dropdown-list {
267
+ position: relative;
268
+ background: var(--md-sys-color-surface);
269
+ padding: 4px 0;
270
+ }
271
+ .dropdown-item {
272
+ display: flex;
273
+ position: relative;
274
+ cursor: pointer;
275
+ padding: var(--spacing-3) 56px;
276
+ min-height: 40px;
277
+ align-items: center;
278
+ }
279
+ .dropdown-item:focus-within {
280
+ outline: none;
281
+ }
282
+ .dropdown-item md-focus-ring {
283
+ border-radius: var(--md-sys-shape-corner-small);
284
+ }
285
+ .dropdown-item.selected {
286
+ background: var(--md-sys-color-secondary-container, #e3f2fd);
287
+ font-weight: 500;
288
+ padding-left: 16px;
289
+ gap: 16px;
290
+ }
291
+ .datepicker-popup {
292
+ background: var(--md-sys-color-surface);
293
+ border-radius: var(--md-sys-shape-corner-small);
294
+ box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.30), 0 2px 6px 2px rgba(0, 0, 0, 0.15);
295
+ max-width: var(--scb-datepicker-width);
296
+ width: 100%;
297
+ font-family: var(--brand-font);
298
+ }
299
+ .datepicker-content{
300
+ overflow-y: auto;
301
+ max-height: 260px;
302
+ }
303
+ .popup {
304
+ position:absolute;
305
+ top:110%;
306
+ left:0;
307
+ z-index:10;
308
+ }
309
+ .header {
310
+ display: flex;
311
+ align-items: center;
312
+ justify-content: space-between;
313
+ margin-bottom: 12px;
314
+ padding: 16px 24px 0 16px;
315
+ flex-wrap: wrap;
316
+ }
317
+ .datepicker-footer{
318
+ padding: 8px 16px 24px 16px;
319
+ }
320
+ .month-label {
321
+ font-size: 18px;
322
+ font-weight: 500;
323
+ }
324
+ .datepicker-calendar{
325
+ padding: 0 16px;
326
+ }
327
+ table {
328
+ width: 100%;
329
+ border-collapse: collapse;
330
+ margin-bottom: 8px;
331
+ }
332
+ th {
333
+ color: var(--md-sys-color-on-surface-variant, #757575);
334
+ font-size: 16px;
335
+ font-weight: 600;
336
+ padding: 4px;
337
+ }
338
+ td {
339
+ text-align: center;
340
+ }
341
+
342
+ .day:focus-within{
343
+ outline: none;
344
+ }
345
+ .day {
346
+ position: relative;
347
+ width: 40px;
348
+ height: 40px;
349
+ border-radius: 50%;
350
+ border: none;
351
+ background: none;
352
+ font-size: 16px;
353
+ cursor: pointer;
354
+ font-family: 'Inter';
355
+ align-content: center;
356
+ }
357
+ .day.selected {
358
+ background: var(--md-sys-color-secondary-container);
359
+ }
360
+ .close-datepicker {
361
+ margin-top: 8px;
362
+ background: none;
363
+ border-color: none;
364
+ color: var(--md-sys-color-primary, #0057b8);
365
+ font-size: 16px;
366
+ cursor: pointer;
367
+ padding: 4px 12px;
368
+ border-radius: 8px;
369
+ }
370
+ .close-datepicker:hover {
371
+ background: var(--md-sys-color-primary-container, #e3f2fd);
372
+ }
373
+ `
374
+ ];
375
+ d([
376
+ h()
377
+ ], a.prototype, "_currentDate", 2);
378
+ d([
379
+ h()
380
+ ], a.prototype, "_selectedDate", 2);
381
+ d([
382
+ h()
383
+ ], a.prototype, "_showMonthDropdown", 2);
384
+ d([
385
+ h()
386
+ ], a.prototype, "_showYearDropdown", 2);
387
+ d([
388
+ p({ type: String })
389
+ ], a.prototype, "variant", 2);
390
+ d([
391
+ p({ type: String })
392
+ ], a.prototype, "lang", 2);
393
+ d([
394
+ p({ type: String })
395
+ ], a.prototype, "selectedValue", 2);
396
+ d([
397
+ p({ type: Boolean })
398
+ ], a.prototype, "open", 2);
399
+ a = d([
400
+ w("scb-datepicker")
401
+ ], a);
402
+ export {
403
+ a as ScbDatepicker
404
+ };
@@ -22,6 +22,10 @@ export declare class ScbIconButton extends LitElement {
22
22
  disabled: boolean;
23
23
  /** Vertikalt avstånd till omgivande innehåll. "N" mappar till var(--spacing-N). */
24
24
  spacing: string;
25
+ /** Överkantens avstånd. Om satt går före spacing. 0–14 mappar till var(--spacing-N), annars CSS-värde. */
26
+ spacingTop: string;
27
+ /** Nederkantens avstånd. Om satt går före spacing. 0–14 mappar till var(--spacing-N), annars CSS-värde. */
28
+ spacingBottom: string;
25
29
  private __loadedVariants;
26
30
  private __iconLoaded;
27
31
  private __lastMdHost;
@@ -1,16 +1,16 @@
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";
1
+ import { css as g, LitElement as _, html as r } from "lit";
2
+ import { property as n, customElement as m } from "lit/decorators.js";
3
3
  import "@material/web/icon/icon.js";
4
- var m = Object.defineProperty, v = Object.getOwnPropertyDescriptor, _ = (t) => {
4
+ var f = Object.defineProperty, y = Object.getOwnPropertyDescriptor, b = (t) => {
5
5
  throw TypeError(t);
6
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 {
7
+ for (var a = l > 1 ? void 0 : l ? y(e, i) : e, d = t.length - 1, h; d >= 0; d--)
8
+ (h = t[d]) && (a = (l ? h(e, i, a) : h(a)) || a);
9
+ return l && a && f(e, i, a), a;
10
+ }, v = (t, e, i) => e.has(t) || b("Cannot " + i), $ = (t, e, i) => e.has(t) ? b("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, i), u = (t, e, i) => (v(t, e, "access private method"), i), c, p;
11
+ let s = class extends _ {
12
12
  constructor() {
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 = () => {
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.spacingTop = "", this.spacingBottom = "", this.__loadedVariants = /* @__PURE__ */ new Set(), this.__iconLoaded = !1, this.__lastMdHost = null, this.__onInnerChange = () => {
14
14
  const t = this.__getMdHost(), e = !!(t != null && t.selected);
15
15
  this.toggle && (this.selected = e), this.dispatchEvent(
16
16
  new CustomEvent("change", {
@@ -22,10 +22,10 @@ let s = class extends g {
22
22
  };
23
23
  }
24
24
  async firstUpdated() {
25
- await this.__ensureDepsLoaded(), await this.updateComplete, this.__attachChangeListener(), this.__syncTitleAndAria(), p(this, c, u).call(this);
25
+ await this.__ensureDepsLoaded(), await this.updateComplete, this.__attachChangeListener(), this.__syncTitleAndAria(), u(this, c, p).call(this);
26
26
  }
27
27
  updated(t) {
28
- if (super.updated(t), t.has("spacing") && p(this, c, u).call(this), t.has("variant")) {
28
+ if (super.updated(t), (t.has("spacing") || t.has("spacingTop") || t.has("spacingBottom")) && u(this, c, p).call(this), t.has("variant")) {
29
29
  this.__ensureDepsLoaded().then(() => {
30
30
  queueMicrotask(() => {
31
31
  this.__attachChangeListener(), this.__syncTitleAndAria();
@@ -79,10 +79,10 @@ let s = class extends g {
79
79
  __syncTitleAndAria() {
80
80
  const t = this.__getMdHost();
81
81
  if (!t) return;
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");
82
+ const e = (this.tooltip || this.getAttribute("title") || "").trim(), i = (this.ariaLabel || this.getAttribute("aria-label") || "").trim(), l = this.getAttribute("aria-controls"), a = this.getAttribute("aria-expanded");
83
83
  this.tooltip && this.setAttribute("title", e);
84
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");
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"), a !== null ? t.setAttribute("aria-expanded", a) : t.removeAttribute("aria-expanded");
86
86
  }
87
87
  mapSpacingToken(t) {
88
88
  if (!t) return;
@@ -91,20 +91,20 @@ let s = class extends g {
91
91
  return /^\d+$/.test(e) ? `var(--spacing-${Math.max(0, Math.min(14, parseInt(e, 10)))})` : e;
92
92
  }
93
93
  __renderToggleIcons() {
94
- return a`
94
+ return r`
95
95
  <md-icon aria-hidden="true">${this.toggleofficon}</md-icon>
96
96
  <md-icon slot="selected" aria-hidden="true">${this.toggleonicon}</md-icon>
97
97
  `;
98
98
  }
99
99
  __renderSingleIcon() {
100
- return a`<md-icon aria-hidden="true">${this.icon}</md-icon>`;
100
+ return r`<md-icon aria-hidden="true">${this.icon}</md-icon>`;
101
101
  }
102
102
  __renderMd() {
103
103
  const t = this.toggle ? this.__renderToggleIcons() : this.__renderSingleIcon();
104
104
  if (this.toggle)
105
105
  switch (this.variant) {
106
106
  case "filled":
107
- return a`
107
+ return r`
108
108
  <md-filled-icon-button
109
109
  toggle
110
110
  ?selected=${this.selected}
@@ -114,7 +114,7 @@ let s = class extends g {
114
114
  </md-filled-icon-button>
115
115
  `;
116
116
  case "outlined":
117
- return a`
117
+ return r`
118
118
  <md-outlined-icon-button
119
119
  toggle
120
120
  ?selected=${this.selected}
@@ -124,7 +124,7 @@ let s = class extends g {
124
124
  </md-outlined-icon-button>
125
125
  `;
126
126
  case "filled-tonal":
127
- return a`
127
+ return r`
128
128
  <md-filled-tonal-icon-button
129
129
  toggle
130
130
  ?selected=${this.selected}
@@ -134,7 +134,7 @@ let s = class extends g {
134
134
  </md-filled-tonal-icon-button>
135
135
  `;
136
136
  default:
137
- return a`
137
+ return r`
138
138
  <md-icon-button toggle ?selected=${this.selected} ?disabled=${this.disabled}>
139
139
  ${t}
140
140
  </md-icon-button>
@@ -142,25 +142,25 @@ let s = class extends g {
142
142
  }
143
143
  switch (this.variant) {
144
144
  case "filled":
145
- return a`
145
+ return r`
146
146
  <md-filled-icon-button ?disabled=${this.disabled}>
147
147
  ${t}
148
148
  </md-filled-icon-button>
149
149
  `;
150
150
  case "outlined":
151
- return a`
151
+ return r`
152
152
  <md-outlined-icon-button ?disabled=${this.disabled}>
153
153
  ${t}
154
154
  </md-outlined-icon-button>
155
155
  `;
156
156
  case "filled-tonal":
157
- return a`
157
+ return r`
158
158
  <md-filled-tonal-icon-button ?disabled=${this.disabled}>
159
159
  ${t}
160
160
  </md-filled-tonal-icon-button>
161
161
  `;
162
162
  default:
163
- return a`
163
+ return r`
164
164
  <md-icon-button ?disabled=${this.disabled}>
165
165
  ${t}
166
166
  </md-icon-button>
@@ -172,48 +172,55 @@ let s = class extends g {
172
172
  }
173
173
  };
174
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");
175
+ p = function() {
176
+ const t = this.mapSpacingToken(this.spacing), e = this.mapSpacingToken(this.spacingTop) ?? t, i = this.mapSpacingToken(this.spacingBottom) ?? t;
177
+ e ? this.style.setProperty("--scb-icon-button-spacing-block-start", e) : this.style.removeProperty("--scb-icon-button-spacing-block-start"), i ? this.style.setProperty("--scb-icon-button-spacing-block-end", i) : this.style.removeProperty("--scb-icon-button-spacing-block-end");
178
178
  };
179
- s.styles = b`
179
+ s.styles = g`
180
180
  :host {
181
181
  display: inline-flex;
182
- margin-block: var(--scb-icon-button-spacing-block, 0);
182
+ margin-block-start: var(--scb-icon-button-spacing-block-start, 0);
183
+ margin-block-end: var(--scb-icon-button-spacing-block-end, 0);
183
184
  }
184
185
  `;
185
186
  o([
186
- r({ type: String })
187
+ n({ type: String })
187
188
  ], s.prototype, "icon", 2);
188
189
  o([
189
- r({ type: String })
190
+ n({ type: String })
190
191
  ], s.prototype, "tooltip", 2);
191
192
  o([
192
- r({ type: String, attribute: "aria-label" })
193
+ n({ type: String, attribute: "aria-label" })
193
194
  ], s.prototype, "ariaLabel", 2);
194
195
  o([
195
- r({ type: String })
196
+ n({ type: String })
196
197
  ], s.prototype, "variant", 2);
197
198
  o([
198
- r({ type: Boolean, reflect: !0 })
199
+ n({ type: Boolean, reflect: !0 })
199
200
  ], s.prototype, "toggle", 2);
200
201
  o([
201
- r({ type: Boolean, reflect: !0 })
202
+ n({ type: Boolean, reflect: !0 })
202
203
  ], s.prototype, "selected", 2);
203
204
  o([
204
- r({ type: String })
205
+ n({ type: String })
205
206
  ], s.prototype, "toggleofficon", 2);
206
207
  o([
207
- r({ type: String })
208
+ n({ type: String })
208
209
  ], s.prototype, "toggleonicon", 2);
209
210
  o([
210
- r({ type: Boolean, reflect: !0 })
211
+ n({ type: Boolean, reflect: !0 })
211
212
  ], s.prototype, "disabled", 2);
212
213
  o([
213
- r({ type: String, reflect: !0 })
214
+ n({ type: String, reflect: !0 })
214
215
  ], s.prototype, "spacing", 2);
216
+ o([
217
+ n({ type: String, attribute: "spacing-top", reflect: !0 })
218
+ ], s.prototype, "spacingTop", 2);
219
+ o([
220
+ n({ type: String, attribute: "spacing-bottom", reflect: !0 })
221
+ ], s.prototype, "spacingBottom", 2);
215
222
  s = o([
216
- f("scb-icon-button")
223
+ m("scb-icon-button")
217
224
  ], s);
218
225
  export {
219
226
  s as ScbIconButton
@@ -30,6 +30,10 @@ export declare class ScbSegmentedButton extends LitElement {
30
30
  * "N" (0–14) mappar till var(--spacing-N), annars valfritt CSS-värde.
31
31
  */
32
32
  spacing: string;
33
+ /** Överkantens avstånd. Om satt går före spacing. 0–14 mappar till var(--spacing-N), annars valfritt CSS-värde. */
34
+ spacingTop: string;
35
+ /** Nederkantens avstånd. Om satt går före spacing. 0–14 mappar till var(--spacing-N), annars valfritt CSS-värde. */
36
+ spacingBottom: string;
33
37
  private _form;
34
38
  private _formResetHandler;
35
39
  private _initialValue;