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,59 +1,69 @@
1
- import { css as l, LitElement as h, html as d } from "lit";
2
- import { property as p, state as v, customElement as f } from "lit/decorators.js";
1
+ import { css as g, LitElement as b, html as u } from "lit";
2
+ import { property as o, state as m, customElement as y } from "lit/decorators.js";
3
3
  import "./scb-step.js";
4
- var b = Object.defineProperty, u = Object.getOwnPropertyDescriptor, r = (e, t, s, i) => {
5
- for (var n = i > 1 ? void 0 : i ? u(t, s) : t, a = e.length - 1, c; a >= 0; a--)
6
- (c = e[a]) && (n = (i ? c(t, s, n) : c(n)) || n);
7
- return i && n && b(t, s, n), n;
8
- };
9
- let o = class extends h {
4
+ var S = Object.defineProperty, _ = Object.getOwnPropertyDescriptor, f = (t) => {
5
+ throw TypeError(t);
6
+ }, a = (t, e, s, i) => {
7
+ for (var n = i > 1 ? void 0 : i ? _(e, s) : e, c = t.length - 1, d; c >= 0; c--)
8
+ (d = t[c]) && (n = (i ? d(e, s, n) : d(n)) || n);
9
+ return i && n && S(e, s, n), n;
10
+ }, x = (t, e, s) => e.has(t) || f("Cannot " + s), k = (t, e, s) => e.has(t) ? f("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, s), l = (t, e, s) => (x(t, e, "access private method"), s), p, v, h;
11
+ let r = class extends b {
10
12
  constructor() {
11
- super(...arguments), this.type = "", this.label = "", this.changeOnCompleted = !1, this.variant = "horizontal", this.symbolVariant = "number", this.activeIndex = 0, this._onKeyNav = (e) => {
12
- const t = this._getSteps(), s = this.activeIndex;
13
+ super(...arguments), k(this, p), this.type = "", this.label = "", this.changeOnCompleted = !1, this.variant = "horizontal", this.symbolVariant = "number", this.spacing = "", this.spacingTop = "", this.spacingBottom = "", this.activeIndex = 0, this._onKeyNav = (t) => {
14
+ const e = this._getSteps(), s = this.activeIndex;
13
15
  let i = s;
14
- e.detail.key === "ArrowRight" ? s < t.length - 1 ? i = s + 1 : i = 0 : e.detail.key === "ArrowLeft" && (s > 0 ? i = s - 1 : i = t.length - 1), i !== s && (this._onStepClick(i), setTimeout(() => {
15
- var a;
16
- const n = (a = t[i].shadowRoot) == null ? void 0 : a.querySelector(".scb-step-content");
16
+ t.detail.key === "ArrowRight" ? s < e.length - 1 ? i = s + 1 : i = 0 : t.detail.key === "ArrowLeft" && (s > 0 ? i = s - 1 : i = e.length - 1), i !== s && (this._onStepClick(i), setTimeout(() => {
17
+ var c;
18
+ const n = (c = e[i].shadowRoot) == null ? void 0 : c.querySelector(
19
+ ".scb-step-content"
20
+ );
17
21
  n && "focus" in n && typeof n.focus == "function" && n.focus();
18
22
  }, 0));
19
- }, this._onStepContainerClick = (e) => {
20
- const t = this._getSteps(), s = e.composedPath(), i = t.findIndex((n) => s.includes(n));
23
+ }, this._onStepContainerClick = (t) => {
24
+ const e = this._getSteps(), s = t.composedPath(), i = e.findIndex((n) => s.includes(n));
21
25
  i !== -1 && this._onStepClick(i);
22
26
  };
23
27
  }
24
- _onStepClick(e) {
25
- const t = this.activeIndex;
26
- this.activeIndex = e, this._updateSteps(), this.dispatchEvent(new CustomEvent("scb-step-change", {
27
- detail: {
28
- index: this.activeIndex,
29
- step: this._getSteps()[this.activeIndex]
30
- },
31
- bubbles: !0,
32
- composed: !0
33
- })), e > t ? this.dispatchEvent(new CustomEvent("scb-step-next", {
34
- detail: {
35
- from: t,
36
- to: e,
37
- step: this._getSteps()[e]
38
- },
39
- bubbles: !0,
40
- composed: !0
41
- })) : e < t && this.dispatchEvent(new CustomEvent("scb-step-prev", {
42
- detail: {
43
- from: t,
44
- to: e,
45
- step: this._getSteps()[e]
46
- },
47
- bubbles: !0,
48
- composed: !0
49
- }));
28
+ _onStepClick(t) {
29
+ const e = this.activeIndex;
30
+ this.activeIndex = t, this._updateSteps(), this.dispatchEvent(
31
+ new CustomEvent("scb-step-change", {
32
+ detail: {
33
+ index: this.activeIndex,
34
+ step: this._getSteps()[this.activeIndex]
35
+ },
36
+ bubbles: !0,
37
+ composed: !0
38
+ })
39
+ ), t > e ? this.dispatchEvent(
40
+ new CustomEvent("scb-step-next", {
41
+ detail: {
42
+ from: e,
43
+ to: t,
44
+ step: this._getSteps()[t]
45
+ },
46
+ bubbles: !0,
47
+ composed: !0
48
+ })
49
+ ) : t < e && this.dispatchEvent(
50
+ new CustomEvent("scb-step-prev", {
51
+ detail: {
52
+ from: e,
53
+ to: t,
54
+ step: this._getSteps()[t]
55
+ },
56
+ bubbles: !0,
57
+ composed: !0
58
+ })
59
+ );
50
60
  }
51
61
  /**
52
62
  * Gå till nästa steg programatiskt
53
63
  */
54
64
  nextStep() {
55
- const e = this._getSteps();
56
- this.activeIndex < e.length - 1 && this._onStepClick(this.activeIndex + 1);
65
+ const t = this._getSteps();
66
+ this.activeIndex < t.length - 1 && this._onStepClick(this.activeIndex + 1);
57
67
  }
58
68
  /**
59
69
  * Gå till föregående steg programatiskt
@@ -68,22 +78,22 @@ let o = class extends h {
68
78
  return this.activeIndex;
69
79
  }
70
80
  _updateSteps() {
71
- const e = this._getSteps();
72
- e.forEach((t, s) => {
73
- t.active = s === this.activeIndex, t.completed = s < this.activeIndex, t.islast = !1, t.changeOnCompleted = this.changeOnCompleted, t.number = s + 1, t.variant = this.variant, t.symbolVariant = this.symbolVariant;
74
- }), e.length > 0 && (e[e.length - 1].islast = !0);
81
+ const t = this._getSteps();
82
+ t.forEach((e, s) => {
83
+ e.active = s === this.activeIndex, e.completed = s < this.activeIndex, e.islast = !1, e.changeOnCompleted = this.changeOnCompleted, e.number = s + 1, e.variant = this.variant, e.symbolVariant = this.symbolVariant;
84
+ }), t.length > 0 && (t[t.length - 1].islast = !0);
75
85
  }
76
86
  _getSteps() {
77
87
  return Array.from(this.querySelectorAll("scb-step"));
78
88
  }
79
- firstUpdated() {
80
- this._updateSteps();
89
+ firstUpdated(t) {
90
+ this._updateSteps(), l(this, p, v).call(this);
81
91
  }
82
- updated() {
83
- this._updateSteps();
92
+ updated(t) {
93
+ this._updateSteps(), (t.has("spacing") || t.has("spacingTop") || t.has("spacingBottom")) && l(this, p, v).call(this);
84
94
  }
85
95
  render() {
86
- return d`
96
+ return u`
87
97
  <div
88
98
  class="steps"
89
99
  role="list"
@@ -96,10 +106,21 @@ let o = class extends h {
96
106
  `;
97
107
  }
98
108
  };
99
- o.styles = l`
109
+ p = /* @__PURE__ */ new WeakSet();
110
+ v = function() {
111
+ const t = l(this, p, h).call(this, this.spacing), e = l(this, p, h).call(this, this.spacingTop) ?? t, s = l(this, p, h).call(this, this.spacingBottom) ?? t;
112
+ e ? this.style.setProperty("--scb-stepper-spacing-block-start", e) : this.style.removeProperty("--scb-stepper-spacing-block-start"), s ? this.style.setProperty("--scb-stepper-spacing-block-end", s) : this.style.removeProperty("--scb-stepper-spacing-block-end");
113
+ };
114
+ h = function(t) {
115
+ if (!t) return;
116
+ const e = String(t).trim();
117
+ if (e)
118
+ return /^\d+$/.test(e) ? `var(--spacing-${Math.max(0, Math.min(14, parseInt(e, 10)))})` : e;
119
+ };
120
+ r.styles = g`
100
121
  :host {
101
- --scb-stepper-width: 100%;
102
- --scb-stepper-height: 100%;
122
+ --scb-stepper-width: 100%;
123
+ --scb-stepper-height: 100%;
103
124
  display: block;
104
125
  padding: var(--spacing-5) 0;
105
126
  width: 100%;
@@ -107,6 +128,9 @@ o.styles = l`
107
128
  font-family: var(--brand-font);
108
129
  max-width: var(--scb-stepper-width);
109
130
  height: var(--scb-stepper-height);
131
+
132
+ margin-block-start: var(--scb-stepper-spacing-block-start, 0);
133
+ margin-block-end: var(--scb-stepper-spacing-block-end, 0);
110
134
  }
111
135
  .steps {
112
136
  display: flex;
@@ -140,56 +164,65 @@ o.styles = l`
140
164
  z-index: 0;
141
165
  }
142
166
  /* Vertikal connector */
143
- ::slotted(scb-step[variant="vertical"]:not(:first-child))::before {
144
- display: none;
167
+ ::slotted(scb-step[variant='vertical']:not(:first-child))::before {
168
+ display: none;
145
169
  }
146
- ::slotted(scb-step[variant="vertical"]:not(:last-child))::after {
147
- content: '';
148
- position: absolute;
149
- left: 28px;
150
- top: 52px;
151
- width: 1px;
152
- height: calc(100% - 16px);
153
- background: var(--n-70);
154
- z-index: 0;
155
- transform: translateX(-50%);
170
+ ::slotted(scb-step[variant='vertical']:not(:last-child))::after {
171
+ content: '';
172
+ position: absolute;
173
+ left: 28px;
174
+ top: 52px;
175
+ width: 1px;
176
+ height: calc(100% - 16px);
177
+ background: var(--n-70);
178
+ z-index: 0;
179
+ transform: translateX(-50%);
156
180
  }
157
- ::slotted(scb-step[variant="vertical"][symbol-variant="marker"]:not(:last-child))::after {
158
- content: "";
159
- position: absolute;
160
- left: 20px;
161
- top: 38px;
162
- width: 1px;
163
- height: calc(100% - 2px);
164
- background: var(--n-70);
165
- z-index: 0;
166
- transform: translateX(-50%);
181
+ ::slotted(scb-step[variant='vertical'][symbol-variant='marker']:not(:last-child))::after {
182
+ content: '';
183
+ position: absolute;
184
+ left: 20px;
185
+ top: 38px;
186
+ width: 1px;
187
+ height: calc(100% - 2px);
188
+ background: var(--n-70);
189
+ z-index: 0;
190
+ transform: translateX(-50%);
167
191
  }
168
- ::slotted(scb-step[symbol-variant="marker"]:not(:first-child))::before {
169
- top: 20px;
192
+ ::slotted(scb-step[symbol-variant='marker']:not(:first-child))::before {
193
+ top: 20px;
170
194
  }
171
195
  `;
172
- r([
173
- p({ type: String, reflect: !0 })
174
- ], o.prototype, "type", 2);
175
- r([
176
- p({ type: String, reflect: !0 })
177
- ], o.prototype, "label", 2);
178
- r([
179
- p({ type: Boolean, reflect: !0, attribute: "change-on-completed" })
180
- ], o.prototype, "changeOnCompleted", 2);
181
- r([
182
- p({ type: String })
183
- ], o.prototype, "variant", 2);
184
- r([
185
- p({ type: String, reflect: !0, attribute: "symbol-variant" })
186
- ], o.prototype, "symbolVariant", 2);
187
- r([
188
- v()
189
- ], o.prototype, "activeIndex", 2);
190
- o = r([
191
- f("scb-stepper")
192
- ], o);
196
+ a([
197
+ o({ type: String, reflect: !0 })
198
+ ], r.prototype, "type", 2);
199
+ a([
200
+ o({ type: String, reflect: !0 })
201
+ ], r.prototype, "label", 2);
202
+ a([
203
+ o({ type: Boolean, reflect: !0, attribute: "change-on-completed" })
204
+ ], r.prototype, "changeOnCompleted", 2);
205
+ a([
206
+ o({ type: String })
207
+ ], r.prototype, "variant", 2);
208
+ a([
209
+ o({ type: String, reflect: !0, attribute: "symbol-variant" })
210
+ ], r.prototype, "symbolVariant", 2);
211
+ a([
212
+ o({ type: String, reflect: !0 })
213
+ ], r.prototype, "spacing", 2);
214
+ a([
215
+ o({ type: String, attribute: "spacing-top", reflect: !0 })
216
+ ], r.prototype, "spacingTop", 2);
217
+ a([
218
+ o({ type: String, attribute: "spacing-bottom", reflect: !0 })
219
+ ], r.prototype, "spacingBottom", 2);
220
+ a([
221
+ m()
222
+ ], r.prototype, "activeIndex", 2);
223
+ r = a([
224
+ y("scb-stepper")
225
+ ], r);
193
226
  export {
194
- o as ScbStepper
227
+ r as ScbStepper
195
228
  };
@@ -1,5 +1,9 @@
1
- import { LitElement, TemplateResult } from 'lit';
1
+ import { LitElement, TemplateResult, PropertyValues } from 'lit';
2
2
  export declare class ScbSwitch extends LitElement {
3
+ #private;
4
+ static formAssociated: boolean;
5
+ private _internals;
6
+ constructor();
3
7
  label: string;
4
8
  ariaLabel: string;
5
9
  icons: boolean;
@@ -7,9 +11,24 @@ export declare class ScbSwitch extends LitElement {
7
11
  disabled: boolean;
8
12
  /** Full-width layout: space-between + width:100% när true */
9
13
  fullWidth: boolean;
14
+ /** Vertikalt avstånd ovanför/under komponenten. 0–14 mappar till spacing-tokens, annars CSS-värde. */
15
+ spacing: string;
16
+ /** Överkantens avstånd. Om satt går före spacing. 0–14 mappar till spacing-tokens, annars CSS-värde. */
17
+ spacingTop: string;
18
+ /** Nederkantens avstånd. Om satt går före spacing. 0–14 mappar till spacing-tokens, annars CSS-värde. */
19
+ spacingBottom: string;
20
+ name: string;
21
+ value: string;
22
+ private _form;
23
+ private _formResetHandler;
24
+ private _initialSelected;
25
+ connectedCallback(): void;
26
+ disconnectedCallback(): void;
10
27
  static styles: import('lit').CSSResult;
11
- protected updated(): void;
12
28
  protected firstUpdated(): void;
29
+ protected updated(changed: PropertyValues): void;
30
+ formDisabledCallback(disabled: boolean): void;
31
+ private __syncFormValue;
13
32
  render(): TemplateResult;
14
33
  }
15
34
  declare global {
@@ -1,49 +1,86 @@
1
- import { css as d, LitElement as b, nothing as h, html as p } from "lit";
2
- import { property as r, customElement as f } from "lit/decorators.js";
1
+ import { css as y, LitElement as g, nothing as b, html as u } from "lit";
2
+ import { property as r, customElement as v } from "lit/decorators.js";
3
3
  import "@material/web/switch/switch.js";
4
- var u = Object.defineProperty, m = Object.getOwnPropertyDescriptor, l = (e, t, a, n) => {
5
- for (var i = n > 1 ? void 0 : n ? m(t, a) : t, o = e.length - 1, c; o >= 0; o--)
6
- (c = e[o]) && (i = (n ? c(t, a, i) : c(i)) || i);
7
- return n && i && u(t, a, i), i;
8
- };
9
- let s = class extends b {
4
+ var _ = Object.defineProperty, w = Object.getOwnPropertyDescriptor, m = (t) => {
5
+ throw TypeError(t);
6
+ }, a = (t, e, s, o) => {
7
+ for (var l = o > 1 ? void 0 : o ? w(e, s) : e, p = t.length - 1, d; p >= 0; p--)
8
+ (d = t[p]) && (l = (o ? d(e, s, l) : d(l)) || l);
9
+ return o && l && _(e, s, l), l;
10
+ }, k = (t, e, s) => e.has(t) || m("Cannot " + s), S = (t, e, s) => e.has(t) ? m("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, s), c = (t, e, s) => (k(t, e, "access private method"), s), n, f, h;
11
+ let i = class extends g {
10
12
  constructor() {
11
- super(...arguments), this.label = "", this.ariaLabel = "", this.icons = !1, this.selected = !1, this.disabled = !1, this.fullWidth = !1;
13
+ super(), S(this, n), this._internals = null, this.label = "", this.ariaLabel = "", this.icons = !1, this.selected = !1, this.disabled = !1, this.fullWidth = !1, this.spacing = "", this.spacingTop = "", this.spacingBottom = "", this.name = "", this.value = "on", this._form = null, this._formResetHandler = null, this._initialSelected = !1, "attachInternals" in this && (this._internals = this.attachInternals());
14
+ }
15
+ connectedCallback() {
16
+ super.connectedCallback(), this._initialSelected = this.selected, this._form = this.closest("form"), this._form && (this._formResetHandler = () => {
17
+ this.selected = this._initialSelected, this.__syncFormValue();
18
+ }, this._form.addEventListener("reset", this._formResetHandler, !0)), this.__syncFormValue();
12
19
  }
13
- updated() {
14
- this.toggleAttribute("aria-disabled", this.disabled);
20
+ disconnectedCallback() {
21
+ this._form && this._formResetHandler && this._form.removeEventListener("reset", this._formResetHandler, !0), super.disconnectedCallback();
15
22
  }
16
23
  firstUpdated() {
17
- var t;
18
- const e = (t = this.shadowRoot) == null ? void 0 : t.querySelector("md-switch");
19
- e == null || e.addEventListener("change", (a) => {
20
- this.selected = a.target.selected, this.dispatchEvent(new CustomEvent("change", {
21
- detail: { selected: this.selected },
22
- bubbles: !0,
23
- composed: !0
24
- }));
25
- });
24
+ var e;
25
+ const t = (e = this.shadowRoot) == null ? void 0 : e.querySelector("md-switch");
26
+ t == null || t.addEventListener("change", (s) => {
27
+ this.selected = s.target.selected, this.dispatchEvent(
28
+ new CustomEvent("change", {
29
+ detail: { selected: this.selected },
30
+ bubbles: !0,
31
+ composed: !0
32
+ })
33
+ );
34
+ }), c(this, n, f).call(this);
35
+ }
36
+ updated(t) {
37
+ super.updated(t), t.has("disabled") && this.toggleAttribute("aria-disabled", this.disabled), (t.has("selected") || t.has("disabled") || t.has("value")) && this.__syncFormValue(), (t.has("spacing") || t.has("spacingTop") || t.has("spacingBottom")) && c(this, n, f).call(this);
38
+ }
39
+ // Körs av webbläsaren när formuläret sätter disabled
40
+ formDisabledCallback(t) {
41
+ this.disabled = t;
42
+ }
43
+ // Synkar selected/disabled mot value
44
+ __syncFormValue() {
45
+ if (!this._internals) return;
46
+ const t = this.disabled || !this.selected ? null : this.value;
47
+ this._internals.setFormValue(t);
26
48
  }
27
49
  render() {
28
- const e = this.label.trim().length > 0, t = e ? h : this.ariaLabel || h, a = p`
50
+ const t = this.label.trim().length > 0, e = t ? b : this.ariaLabel || b, s = u`
29
51
  <md-switch
30
52
  ?icons=${this.icons}
31
53
  ?selected=${this.selected}
32
54
  ?disabled=${this.disabled}
33
- aria-label=${t}
55
+ aria-label=${e}
34
56
  ></md-switch>
35
57
  `;
36
- return e ? p`
37
- <label class="switch-container" ?disabled=${this.disabled}>
38
- <span class="switch-label">${this.label}</span>
39
- ${a}
40
- </label>
41
- ` : a;
58
+ return t ? u`
59
+ <label class="switch-container" ?disabled=${this.disabled}>
60
+ <span class="switch-label">${this.label}</span>
61
+ ${s}
62
+ </label>
63
+ ` : s;
42
64
  }
43
65
  };
44
- s.styles = d`
66
+ n = /* @__PURE__ */ new WeakSet();
67
+ f = function() {
68
+ const t = c(this, n, h).call(this, this.spacing), e = c(this, n, h).call(this, this.spacingTop) ?? t, s = c(this, n, h).call(this, this.spacingBottom) ?? t;
69
+ e ? this.style.setProperty("--scb-switch-spacing-block-start", e) : this.style.removeProperty("--scb-switch-spacing-block-start"), s ? this.style.setProperty("--scb-switch-spacing-block-end", s) : this.style.removeProperty("--scb-switch-spacing-block-end");
70
+ };
71
+ h = function(t) {
72
+ if (!t) return;
73
+ const e = String(t).trim();
74
+ if (e)
75
+ return /^\d+$/.test(e) ? `var(--spacing-${Math.max(0, Math.min(14, parseInt(e, 10)))})` : e;
76
+ };
77
+ i.formAssociated = !0;
78
+ i.styles = y`
45
79
  :host {
46
80
  display: block;
81
+ /* Vertikalt avstånd styrs av spacing-attributen via CSS-variabler */
82
+ margin-block-start: var(--scb-switch-spacing-block-start, 0);
83
+ margin-block-end: var(--scb-switch-spacing-block-end, 0);
47
84
  }
48
85
 
49
86
  .switch-container {
@@ -82,27 +119,42 @@ s.styles = d`
82
119
  color: var(--scb-switch-label-color, inherit);
83
120
  }
84
121
  `;
85
- l([
122
+ a([
86
123
  r({ type: String })
87
- ], s.prototype, "label", 2);
88
- l([
124
+ ], i.prototype, "label", 2);
125
+ a([
89
126
  r({ type: String, reflect: !0, attribute: "aria-label" })
90
- ], s.prototype, "ariaLabel", 2);
91
- l([
127
+ ], i.prototype, "ariaLabel", 2);
128
+ a([
92
129
  r({ type: Boolean, reflect: !0 })
93
- ], s.prototype, "icons", 2);
94
- l([
130
+ ], i.prototype, "icons", 2);
131
+ a([
95
132
  r({ type: Boolean, reflect: !0 })
96
- ], s.prototype, "selected", 2);
97
- l([
133
+ ], i.prototype, "selected", 2);
134
+ a([
98
135
  r({ type: Boolean, reflect: !0 })
99
- ], s.prototype, "disabled", 2);
100
- l([
136
+ ], i.prototype, "disabled", 2);
137
+ a([
101
138
  r({ type: Boolean, reflect: !0, attribute: "full-width" })
102
- ], s.prototype, "fullWidth", 2);
103
- s = l([
104
- f("scb-switch")
105
- ], s);
139
+ ], i.prototype, "fullWidth", 2);
140
+ a([
141
+ r({ type: String, reflect: !0 })
142
+ ], i.prototype, "spacing", 2);
143
+ a([
144
+ r({ type: String, attribute: "spacing-top", reflect: !0 })
145
+ ], i.prototype, "spacingTop", 2);
146
+ a([
147
+ r({ type: String, attribute: "spacing-bottom", reflect: !0 })
148
+ ], i.prototype, "spacingBottom", 2);
149
+ a([
150
+ r({ type: String })
151
+ ], i.prototype, "name", 2);
152
+ a([
153
+ r({ type: String })
154
+ ], i.prototype, "value", 2);
155
+ i = a([
156
+ v("scb-switch")
157
+ ], i);
106
158
  export {
107
- s as ScbSwitch
159
+ i as ScbSwitch
108
160
  };
@@ -1,9 +1,17 @@
1
1
  import { MdTabs } from '@material/web/tabs/tabs.js';
2
2
  export declare class ScbTabs extends MdTabs {
3
+ #private;
3
4
  ariaLabel: string;
5
+ /** Vertikalt avstånd ovanför/under tabs-komponenten. 0–14 mappar till spacing-tokens, annars CSS-värde. */
6
+ spacing: string;
7
+ /** Överkantens avstånd. Om satt går före spacing. 0–14 mappar till spacing-tokens, annars CSS-värde. */
8
+ spacingTop: string;
9
+ /** Nederkantens avstånd. Om satt går före spacing. 0–14 mappar till spacing-tokens, annars CSS-värde. */
10
+ spacingBottom: string;
4
11
  private _isDispatching;
5
12
  static styles: import('lit').CSSResultOrNative[];
6
13
  connectedCallback(): void;
7
14
  protected firstUpdated(changedProperties: Map<string, unknown>): void;
15
+ updated(changed: Map<string, unknown>): void;
8
16
  private _onChange;
9
17
  }