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,5 +1,5 @@
1
1
  import { css as y, LitElement as x, nothing as b, html as u } from "lit";
2
- import { property as h, customElement as w } from "lit/decorators.js";
2
+ import { property as c, customElement as w } from "lit/decorators.js";
3
3
  import "../scb-list/scb-list.js";
4
4
  import "@material/web/ripple/ripple.js";
5
5
  import "@material/web/icon/icon.js";
@@ -11,29 +11,37 @@ var A = Object.defineProperty, I = Object.getOwnPropertyDescriptor, l = (t, e, s
11
11
  };
12
12
  let S = 0, a = class extends x {
13
13
  constructor() {
14
- super(...arguments), this.supportingText = "Hinted search text", this.value = "", this.size = "default", this.fullScreen = !1, this._inputFocused = !1, this._visibleSuggestions = 0, this._activeIndex = -1, this._listboxId = `scb-search-listbox-${++S}`, this._kbMode = !1, this._kbShouldShowRing = !1, this._onGlobalKeydown = (t) => {
14
+ super(), this._internals = null, this.supportingText = "Hinted search text", this.value = "", this.name = "", this.disabled = !1, this.size = "default", this.fullScreen = !1, this._inputFocused = !1, this._visibleSuggestions = 0, this._activeIndex = -1, this._listboxId = `scb-search-listbox-${++S}`, this._kbMode = !1, this._kbShouldShowRing = !1, this._onGlobalKeydown = (t) => {
15
15
  t.key === "Tab" && (this._kbShouldShowRing = !0, this._inputFocused && this._updateInputRingVisibility());
16
16
  }, this._onGlobalPointerDown = () => {
17
17
  this._kbShouldShowRing = !1, this._inputFocused && this._updateInputRingVisibility();
18
- }, this._listScrollHandler = () => {
18
+ }, this._form = null, this._formResetHandler = null, this._initialValue = "", this._listScrollHandler = () => {
19
19
  const t = this._getActiveItem();
20
20
  this._kbMode && t && this._positionOptionRing(t);
21
- };
21
+ }, "attachInternals" in this && (this._internals = this.attachInternals());
22
22
  }
23
23
  connectedCallback() {
24
- super.connectedCallback(), this._onWindowResize = this._onWindowResize.bind(this), window.addEventListener("resize", this._onWindowResize, { passive: !0 }), window.addEventListener("keydown", this._onGlobalKeydown, !0), window.addEventListener("pointerdown", this._onGlobalPointerDown, !0);
24
+ super.connectedCallback(), this._onWindowResize = this._onWindowResize.bind(this), window.addEventListener("resize", this._onWindowResize, { passive: !0 }), window.addEventListener("keydown", this._onGlobalKeydown, !0), window.addEventListener("pointerdown", this._onGlobalPointerDown, !0), this._initialValue = this.value ?? "", this._form = this.closest("form"), this._form && (this._formResetHandler = () => {
25
+ this.value = this._initialValue;
26
+ const t = this._inputEl();
27
+ t && (t.value = this._initialValue), this._syncFormValue(), this._filterSuggestions(this.value), this._activeIndex = -1, this._kbMode = !1, this._updateComboboxA11y();
28
+ }, this._form.addEventListener("reset", this._formResetHandler, !0)), this._syncFormValue();
25
29
  }
26
30
  disconnectedCallback() {
27
31
  const t = this._inputEl();
28
- t && this._boundNativeKeydown && t.removeEventListener("keydown", this._boundNativeKeydown, !0), this._detachListScrollListener(), window.removeEventListener("resize", this._onWindowResize), window.removeEventListener("keydown", this._onGlobalKeydown, !0), window.removeEventListener("pointerdown", this._onGlobalPointerDown, !0), super.disconnectedCallback();
32
+ t && this._boundNativeKeydown && t.removeEventListener("keydown", this._boundNativeKeydown, !0), this._detachListScrollListener(), window.removeEventListener("resize", this._onWindowResize), window.removeEventListener("keydown", this._onGlobalKeydown, !0), window.removeEventListener("pointerdown", this._onGlobalPointerDown, !0), this._form && this._formResetHandler && this._form.removeEventListener("reset", this._formResetHandler, !0), super.disconnectedCallback();
29
33
  }
30
34
  firstUpdated() {
31
35
  this._ensureListboxA11y(), this._updateComboboxA11y();
32
36
  const t = this._inputEl();
33
- t && (this._boundNativeKeydown = (e) => this._handleKey(e), t.addEventListener("keydown", this._boundNativeKeydown, !0));
37
+ t && (this._boundNativeKeydown = (e) => this._handleKey(e), t.addEventListener("keydown", this._boundNativeKeydown, !0), t.disabled = this.disabled);
34
38
  }
35
- updated() {
36
- this._ensureListboxA11y(), this._updateComboboxA11y(), this._attachListScrollListener();
39
+ updated(t) {
40
+ if (super.updated(t), this._ensureListboxA11y(), this._updateComboboxA11y(), this._attachListScrollListener(), (t.has("value") || t.has("disabled")) && this._syncFormValue(), t.has("disabled")) {
41
+ this.toggleAttribute("aria-disabled", this.disabled);
42
+ const e = this._inputEl();
43
+ e && (e.disabled = this.disabled);
44
+ }
37
45
  }
38
46
  render() {
39
47
  const t = (this.value ?? "").trim().length > 0, e = this._inputFocused && t && this._hasSuggestions;
@@ -44,20 +52,28 @@ let S = 0, a = class extends x {
44
52
  <input
45
53
  id="searchInput"
46
54
  type="search"
47
- name="textfield"
55
+ name=${this.name || "textfield"}
48
56
  class=${e ? "with-list" : ""}
49
57
  .value=${this.value}
50
58
  placeholder=${this.supportingText}
51
59
  autocomplete="off"
60
+ ?disabled=${this.disabled}
52
61
  @input=${this._onInput}
53
62
  @focus=${this._onFocus}
54
63
  @blur=${this._onBlur}
55
64
  aria-label=${this.supportingText || "Sök"}
56
65
  />
57
66
 
58
- ${t ? u`<button class="clear-btn" @click=${this._clearInput} tabindex="-1" aria-label="Rensa sökfält">
59
- <md-icon>close</md-icon>
60
- </button>` : this.trailingIcon ? u`<span class="trailing"><md-icon>${this.trailingIcon}</md-icon></span>` : b}
67
+ ${t ? u`<button
68
+ class="clear-btn"
69
+ type="button"
70
+ ?disabled=${this.disabled}
71
+ @click=${this._clearInput}
72
+ tabindex="-1"
73
+ aria-label="Rensa sökfält"
74
+ >
75
+ <md-icon>close</md-icon>
76
+ </button>` : this.trailingIcon ? u`<span class="trailing"><md-icon>${this.trailingIcon}</md-icon></span>` : b}
61
77
 
62
78
  <md-ripple></md-ripple>
63
79
  <md-focus-ring class="input-ring"></md-focus-ring>
@@ -73,13 +89,19 @@ let S = 0, a = class extends x {
73
89
  ` : b}
74
90
  `;
75
91
  }
92
+ /** Gör så att native formulär kan sätta disabled på kontrollen. */
93
+ formDisabledCallback(t) {
94
+ this.disabled = t;
95
+ }
76
96
  submit() {
77
97
  const t = this._getActiveItem(), e = { value: this.value };
78
- t && (e.active = this._itemPayload(t)), this.dispatchEvent(new CustomEvent("scb-search-submit", {
79
- detail: e,
80
- bubbles: !0,
81
- composed: !0
82
- }));
98
+ t && (e.active = this._itemPayload(t)), this.dispatchEvent(
99
+ new CustomEvent("scb-search-submit", {
100
+ detail: e,
101
+ bubbles: !0,
102
+ composed: !0
103
+ })
104
+ );
83
105
  }
84
106
  get _hasSuggestions() {
85
107
  return this._visibleSuggestions >= 0 ? this._visibleSuggestions > 0 : Array.from(this.getElementsByTagName("scb-list-item")).some((e) => !e.hasAttribute("hidden") && e.style.display !== "none");
@@ -89,14 +111,16 @@ let S = 0, a = class extends x {
89
111
  }
90
112
  _onInput(t) {
91
113
  const e = t.target;
92
- this.value = e.value, this._filterSuggestions(this.value), this._activeIndex = -1, this._kbMode = !1, this._updateComboboxA11y(), this.dispatchEvent(new CustomEvent("scb-search-input", {
93
- detail: { value: this.value },
94
- bubbles: !0,
95
- composed: !0
96
- }));
114
+ this.value = e.value, this._syncFormValue(), this._filterSuggestions(this.value), this._activeIndex = -1, this._kbMode = !1, this._updateComboboxA11y(), this.dispatchEvent(
115
+ new CustomEvent("scb-search-input", {
116
+ detail: { value: this.value },
117
+ bubbles: !0,
118
+ composed: !0
119
+ })
120
+ );
97
121
  }
98
122
  _onFocus() {
99
- this._inputFocused = !0, this._updateInputRingVisibility(), this._filterSuggestions(this.value), this._updateComboboxA11y(), this.requestUpdate();
123
+ this.disabled || (this._inputFocused = !0, this._updateInputRingVisibility(), this._filterSuggestions(this.value), this._updateComboboxA11y(), this.requestUpdate());
100
124
  }
101
125
  _onBlur() {
102
126
  setTimeout(() => {
@@ -109,9 +133,9 @@ let S = 0, a = class extends x {
109
133
  t && (this._inputFocused && this._kbShouldShowRing ? t.setAttribute("data-kb-focus", "true") : t.removeAttribute("data-kb-focus"));
110
134
  }
111
135
  _handleKey(t) {
112
- if (!this._inputEl()) return;
113
- const s = this._getVisibleItems(), r = (this.value ?? "").trim().length > 0, i = this._inputFocused && r && s.length > 0, n = t.key, o = t.keyCode, c = n === "ArrowDown" || n === "Down" || o === 40, d = n === "ArrowUp" || n === "Up" || o === 38, g = n === "Home" || o === 36, v = n === "End" || o === 35, _ = n === "Enter" || o === 13, m = n === "Escape" || n === "Esc" || o === 27;
114
- if (c) {
136
+ if (this.disabled || !this._inputEl()) return;
137
+ const s = this._getVisibleItems(), r = (this.value ?? "").trim().length > 0, i = this._inputFocused && r && s.length > 0, n = t.key, o = t.keyCode, h = n === "ArrowDown" || n === "Down" || o === 40, d = n === "ArrowUp" || n === "Up" || o === 38, g = n === "Home" || o === 36, v = n === "End" || o === 35, _ = n === "Enter" || o === 13, f = n === "Escape" || n === "Esc" || o === 27;
138
+ if (h) {
115
139
  if (!i) return;
116
140
  t.preventDefault(), this._kbMode = !0, this._moveActive(s, 1);
117
141
  return;
@@ -139,32 +163,35 @@ let S = 0, a = class extends x {
139
163
  t.preventDefault();
140
164
  const p = this._getActiveItem();
141
165
  if (p) {
142
- const f = p.getAttribute("label") || "";
143
- this.value = f, this.dispatchEvent(new CustomEvent("scb-search-submit", {
144
- detail: { value: this.value, active: this._itemPayload(p) },
145
- bubbles: !0,
146
- composed: !0
147
- })), this._visibleSuggestions = 0, this._activeIndex = -1, this._kbMode = !1, this._hideOptionRing(), this.requestUpdate();
166
+ const m = p.getAttribute("label") || "";
167
+ this.value = m, this._syncFormValue(), this.dispatchEvent(
168
+ new CustomEvent("scb-search-submit", {
169
+ detail: { value: this.value, active: this._itemPayload(p) },
170
+ bubbles: !0,
171
+ composed: !0
172
+ })
173
+ ), this._visibleSuggestions = 0, this._activeIndex = -1, this._kbMode = !1, this._hideOptionRing(), this.requestUpdate();
148
174
  } else
149
175
  this.submit();
150
176
  return;
151
177
  }
152
- if (m) {
178
+ if (f) {
153
179
  t.preventDefault(), this._clearInput();
154
180
  return;
155
181
  }
156
182
  }
157
183
  _clearInput() {
184
+ if (this.disabled) return;
158
185
  this.value = "", this._activeIndex = -1, this._kbMode = !1;
159
186
  const t = this._inputEl();
160
- t == null || t.focus(), t && (t.value = ""), this._filterSuggestions(""), this._updateComboboxA11y(), this._hideOptionRing(), this.dispatchEvent(new CustomEvent("scb-search-clear", { bubbles: !0, composed: !0 }));
187
+ t && (t.value = "", t.focus()), this._filterSuggestions(""), this._updateComboboxA11y(), this._hideOptionRing(), this._syncFormValue(), this.dispatchEvent(new CustomEvent("scb-search-clear", { bubbles: !0, composed: !0 }));
161
188
  }
162
189
  _filterSuggestions(t) {
163
190
  const e = (t ?? "").trim().toLowerCase(), s = Array.from(this.querySelectorAll("scb-list-item"));
164
191
  let r = 0;
165
192
  for (const i of s) {
166
- const n = (i.getAttribute("label") || "").toLowerCase(), o = (i.getAttribute("supporting-text") || "").toLowerCase(), c = `${n} ${o}`.trim();
167
- e !== "" && c.includes(e) ? (i.removeAttribute("hidden"), r++) : i.setAttribute("hidden", ""), this._ensureOptionA11y(i);
193
+ const n = (i.getAttribute("label") || "").toLowerCase(), o = (i.getAttribute("supporting-text") || "").toLowerCase(), h = `${n} ${o}`.trim();
194
+ e !== "" && h.includes(e) ? (i.removeAttribute("hidden"), r++) : i.setAttribute("hidden", ""), this._ensureOptionA11y(i);
168
195
  }
169
196
  this._visibleSuggestions = r, this._activeIndex >= r && (this._activeIndex = -1), this._updateComboboxA11y(), this.requestUpdate();
170
197
  }
@@ -226,8 +253,8 @@ let S = 0, a = class extends x {
226
253
  _positionOptionRing(t) {
227
254
  const e = this._ringEl(), s = this._listEl();
228
255
  if (!e || !s) return;
229
- const r = this.getBoundingClientRect(), i = t.getBoundingClientRect(), n = i.top - r.top, o = i.left - r.left, c = i.width, d = i.height;
230
- e.style.top = `${n}px`, e.style.left = `${o}px`, e.style.width = `${c}px`, e.style.height = `${d}px`, e.setAttribute("data-show", "true");
256
+ const r = this.getBoundingClientRect(), i = t.getBoundingClientRect(), n = i.top - r.top, o = i.left - r.left, h = i.width, d = i.height;
257
+ e.style.top = `${n}px`, e.style.left = `${o}px`, e.style.width = `${h}px`, e.style.height = `${d}px`, e.setAttribute("data-show", "true");
231
258
  }
232
259
  _hideOptionRing() {
233
260
  const t = this._ringEl();
@@ -244,7 +271,13 @@ let S = 0, a = class extends x {
244
271
  _detachListScrollListener() {
245
272
  this._listWithHandler && (this._listWithHandler.removeEventListener("scroll", this._listScrollHandler), this._listWithHandler = void 0);
246
273
  }
274
+ _syncFormValue() {
275
+ if (!this._internals) return;
276
+ const t = this.disabled ? null : this.value;
277
+ this._internals.setFormValue(t);
278
+ }
247
279
  };
280
+ a.formAssociated = !0;
248
281
  a.styles = y`
249
282
  :host {
250
283
  display: flex;
@@ -278,7 +311,7 @@ a.styles = y`
278
311
  --scb-search-icon-size: var(--icon-size-small, 24px);
279
312
  }
280
313
 
281
- :host([size="compact"]) {
314
+ :host([size='compact']) {
282
315
  --scb-search-height: var(--scale-11, 40px);
283
316
  --scb-search-padding-x: var(--spacing-4, 12px);
284
317
  --scb-search-padding-y: var(--spacing-3, 8px);
@@ -287,6 +320,11 @@ a.styles = y`
287
320
  --scb-search-line-height: var(--md-sys-typescale-body-medium-line-height, 20px);
288
321
  }
289
322
 
323
+ :host([disabled]) {
324
+ opacity: 0.38;
325
+ cursor: default;
326
+ }
327
+
290
328
  .ripple-wrapper {
291
329
  position: relative;
292
330
  display: flex;
@@ -302,7 +340,9 @@ a.styles = y`
302
340
  border-radius: var(--scb-search-radius);
303
341
  z-index: 4;
304
342
  }
305
- .ripple-wrapper[data-kb-focus="true"] md-focus-ring.input-ring { display: block; }
343
+ .ripple-wrapper[data-kb-focus='true'] md-focus-ring.input-ring {
344
+ display: block;
345
+ }
306
346
  input.with-list ~ md-focus-ring.input-ring {
307
347
  border-radius: var(--scb-search-open-radius) var(--scb-search-open-radius) 0 0;
308
348
  }
@@ -317,7 +357,9 @@ a.styles = y`
317
357
  z-index: 11;
318
358
  border-radius: var(--md-sys-shape-corner-small, 8px);
319
359
  }
320
- md-focus-ring.option-ring[data-show="true"] { display: block; }
360
+ md-focus-ring.option-ring[data-show='true'] {
361
+ display: block;
362
+ }
321
363
 
322
364
  .leading {
323
365
  position: absolute;
@@ -333,9 +375,13 @@ a.styles = y`
333
375
  color: var(--md-sys-color-on-surface-variant);
334
376
  z-index: 2;
335
377
  }
336
- .leading md-icon { font-size: var(--scb-search-icon-size); line-height: 1; }
378
+ .leading md-icon {
379
+ font-size: var(--scb-search-icon-size);
380
+ line-height: 1;
381
+ }
337
382
 
338
- .trailing, .clear-btn {
383
+ .trailing,
384
+ .clear-btn {
339
385
  position: absolute;
340
386
  right: var(--scb-search-padding-x);
341
387
  top: 50%;
@@ -348,17 +394,27 @@ a.styles = y`
348
394
  color: var(--md-sys-color-on-surface-variant);
349
395
  z-index: 3;
350
396
  }
351
- .trailing md-icon { pointer-events: none; font-size: var(--scb-search-icon-size); }
397
+ .trailing md-icon {
398
+ pointer-events: none;
399
+ font-size: var(--scb-search-icon-size);
400
+ }
352
401
 
353
- .clear-btn { background: none; border: 0; padding: 0; cursor: pointer; }
354
- .clear-btn[hidden] { display: none; }
402
+ .clear-btn {
403
+ background: none;
404
+ border: 0;
405
+ padding: 0;
406
+ cursor: pointer;
407
+ }
408
+ .clear-btn[hidden] {
409
+ display: none;
410
+ }
411
+ .clear-btn:disabled {
412
+ cursor: default;
413
+ }
355
414
 
356
- input[type="search"] {
357
- padding:
358
- var(--scb-search-padding-y)
359
- var(--scb-search-trailing-gap)
360
- var(--scb-search-padding-y)
361
- var(--scb-search-leading-gap);
415
+ input[type='search'] {
416
+ padding: var(--scb-search-padding-y) var(--scb-search-trailing-gap)
417
+ var(--scb-search-padding-y) var(--scb-search-leading-gap);
362
418
  min-height: var(--scb-search-height);
363
419
  width: 100%;
364
420
  box-sizing: border-box;
@@ -376,13 +432,17 @@ a.styles = y`
376
432
  position: relative;
377
433
  z-index: 1;
378
434
  }
379
- input[type="search"]::placeholder {
435
+ input[type='search']::placeholder {
380
436
  color: var(--md-sys-color-on-surface-variant);
381
437
  font-size: var(--scb-search-font-size);
382
438
  line-height: var(--scb-search-line-height);
383
439
  }
384
- input[type="search"]:hover { outline: var(--md-sys-color-outline) auto var(--stroke-border, 1px); }
385
- input[type="search"]:focus { outline: none; }
440
+ input[type='search']:hover {
441
+ outline: var(--md-sys-color-outline) auto var(--stroke-border, 1px);
442
+ }
443
+ input[type='search']:focus {
444
+ outline: none;
445
+ }
386
446
 
387
447
  md-ripple {
388
448
  border-radius: var(--scb-search-radius);
@@ -394,10 +454,18 @@ a.styles = y`
394
454
  --md-ripple-hover-opacity: 0;
395
455
  }
396
456
 
397
- input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; display: none; }
457
+ input[type='search']::-webkit-search-cancel-button {
458
+ -webkit-appearance: none;
459
+ appearance: none;
460
+ display: none;
461
+ }
398
462
 
399
- input.with-list { border-radius: var(--scb-search-open-radius) var(--scb-search-open-radius) 0 0; }
400
- input.with-list ~ md-ripple { border-radius: var(--scb-search-open-radius) var(--scb-search-open-radius) 0 0; }
463
+ input.with-list {
464
+ border-radius: var(--scb-search-open-radius) var(--scb-search-open-radius) 0 0;
465
+ }
466
+ input.with-list ~ md-ripple {
467
+ border-radius: var(--scb-search-open-radius) var(--scb-search-open-radius) 0 0;
468
+ }
401
469
 
402
470
  scb-list.suggestion-list {
403
471
  position: absolute;
@@ -414,11 +482,16 @@ a.styles = y`
414
482
  max-height: var(--scb-search-suggestions-max-h, 60vh);
415
483
  }
416
484
 
417
- :host([full-screen]) input[type="search"],
485
+ :host([full-screen]) input[type='search'],
418
486
  :host([full-screen]) input.with-list,
419
- :host([full-screen]) input.with-list ~ md-ripple { border-radius: var(--radius-none, 0px) !important; }
487
+ :host([full-screen]) input.with-list ~ md-ripple {
488
+ border-radius: var(--radius-none, 0px) !important;
489
+ }
420
490
  :host([full-screen]) scb-list.suggestion-list {
421
- position: static; border: 0; border-radius: 0; background: transparent;
491
+ position: static;
492
+ border: 0;
493
+ border-radius: 0;
494
+ background: transparent;
422
495
  }
423
496
 
424
497
  .list-divider {
@@ -427,26 +500,36 @@ a.styles = y`
427
500
  background: var(--md-sys-color-outline);
428
501
  width: 100%;
429
502
  }
430
- :host([full-screen]) .list-divider[aria-hidden="false"] { display: block; }
503
+ :host([full-screen]) .list-divider[aria-hidden='false'] {
504
+ display: block;
505
+ }
431
506
 
432
507
  @media (prefers-color-scheme: dark) {
433
- :host { color: var(--md-sys-color-on-surface); }
508
+ :host {
509
+ color: var(--md-sys-color-on-surface);
510
+ }
434
511
  }
435
512
  `;
436
513
  l([
437
- h({ type: String, attribute: "trailing-icon" })
514
+ c({ type: String, attribute: "trailing-icon" })
438
515
  ], a.prototype, "trailingIcon", 2);
439
516
  l([
440
- h({ type: String, attribute: "supporting-text" })
517
+ c({ type: String, attribute: "supporting-text" })
441
518
  ], a.prototype, "supportingText", 2);
442
519
  l([
443
- h({ type: String })
520
+ c({ type: String })
444
521
  ], a.prototype, "value", 2);
445
522
  l([
446
- h({ type: String, reflect: !0 })
523
+ c({ type: String, reflect: !0 })
524
+ ], a.prototype, "name", 2);
525
+ l([
526
+ c({ type: Boolean, reflect: !0 })
527
+ ], a.prototype, "disabled", 2);
528
+ l([
529
+ c({ type: String, reflect: !0 })
447
530
  ], a.prototype, "size", 2);
448
531
  l([
449
- h({ type: Boolean, attribute: "full-screen", reflect: !0 })
532
+ c({ type: Boolean, attribute: "full-screen", reflect: !0 })
450
533
  ], a.prototype, "fullScreen", 2);
451
534
  a = l([
452
535
  w("scb-search")
@@ -1,11 +1,14 @@
1
- import { LitElement } from 'lit';
1
+ import { LitElement, PropertyValues } from 'lit';
2
2
  /**
3
3
  * En komponent för segmenterade knappar (segmented button).
4
4
  *
5
5
  * @slot - Plats för knappar eller segment.
6
- * @fires change - När valt segment ändras (detail: { value })
6
+ * @fires change - När valt segment ändras (detail: { value } eller { values })
7
7
  */
8
8
  export declare class ScbSegmentedButton extends LitElement {
9
+ #private;
10
+ static formAssociated: boolean;
11
+ private _internals;
9
12
  /**
10
13
  * Variant: 'single-select' (default) eller 'multi-select'.
11
14
  */
@@ -16,10 +19,44 @@ export declare class ScbSegmentedButton extends LitElement {
16
19
  value: string;
17
20
  values: string[];
18
21
  disabled: boolean;
22
+ /**
23
+ * Namn för HTML-formulär (FormData-nyckel).
24
+ * single-select: FormData.get(name) → string
25
+ * multi-select: FormData.getAll(name) → string[]
26
+ */
27
+ name: string;
28
+ /**
29
+ * Vertikalt avstånd till omgivande innehåll.
30
+ * "N" (0–14) mappar till var(--spacing-N), annars valfritt CSS-värde.
31
+ */
32
+ spacing: string;
33
+ private _form;
34
+ private _formResetHandler;
35
+ private _initialValue;
36
+ private _initialValues;
37
+ constructor();
19
38
  static styles: import('lit').CSSResult;
39
+ connectedCallback(): void;
40
+ disconnectedCallback(): void;
41
+ firstUpdated(): void;
42
+ updated(changed: PropertyValues): void;
20
43
  private onSlotClick;
21
44
  private updateSegments;
22
- firstUpdated(): void;
23
- updated(): void;
45
+ /**
46
+ * Gör så att native formulär kan sätta disabled på kontrollen.
47
+ */
48
+ formDisabledCallback(disabled: boolean): void;
49
+ /**
50
+ * Synkar value/values → FormData via ElementInternals.
51
+ * single-select: FormData.get(name) → string
52
+ * multi-select: FormData.getAll(name) → string[]
53
+ */
54
+ private _syncFormValue;
55
+ private mapSpacingToken;
24
56
  render(): import('lit-html').TemplateResult<1>;
25
57
  }
58
+ declare global {
59
+ interface HTMLElementTagNameMap {
60
+ 'scb-segmented-button': ScbSegmentedButton;
61
+ }
62
+ }