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,62 +1,77 @@
1
- import { css as x, LitElement as y, nothing as h, html as u } from "lit";
2
- import { property as b, customElement as v } from "lit/decorators.js";
1
+ import { css as y, LitElement as v, nothing as p, html as m } from "lit";
2
+ import { property as d, customElement as x } from "lit/decorators.js";
3
3
  import "@material/web/checkbox/checkbox.js";
4
4
  import "./scb-checkbox-group.js";
5
- var f = Object.defineProperty, k = Object.getOwnPropertyDescriptor, d = (e, i, t, s) => {
6
- for (var r = s > 1 ? void 0 : s ? k(i, t) : i, a = e.length - 1, o; a >= 0; a--)
7
- (o = e[a]) && (r = (s ? o(i, t, r) : o(r)) || r);
8
- return s && r && f(i, t, r), r;
5
+ var g = Object.defineProperty, k = Object.getOwnPropertyDescriptor, h = (e, s, t, r) => {
6
+ for (var i = r > 1 ? void 0 : r ? k(s, t) : s, o = e.length - 1, l; o >= 0; o--)
7
+ (l = e[o]) && (i = (r ? l(s, t, i) : l(i)) || i);
8
+ return r && i && g(s, t, i), i;
9
9
  };
10
- let n = class extends y {
10
+ let a = class extends v {
11
11
  constructor() {
12
- super(...arguments), this.disabled = !1, this.indeterminate = !1, this.checked = !1, this.label = "", this.supportingText = "", this.ariaLabel = "", this._checkboxId = "";
12
+ super(), this._internals = null, this.disabled = !1, this.indeterminate = !1, this.checked = !1, this.label = "", this.supportingText = "", this.ariaLabel = "", this.name = "", this.value = "on", this._form = null, this._formResetHandler = null, this._initialChecked = !1, this._checkboxId = "", "attachInternals" in this && (this._internals = this.attachInternals());
13
13
  }
14
14
  connectedCallback() {
15
- super.connectedCallback(), this._checkboxId = this.id || `scb-checkbox-${Math.random().toString(36).slice(2, 11)}`;
15
+ super.connectedCallback(), this._checkboxId = this.id || `scb-checkbox-${Math.random().toString(36).slice(2, 11)}`, this._initialChecked = this.checked, this._form = this.closest("form"), this._form && (this._formResetHandler = () => {
16
+ this.checked = this._initialChecked, this.indeterminate = !1, this.__syncFormValue();
17
+ }, this._form.addEventListener("reset", this._formResetHandler, !0)), this.__syncFormValue();
18
+ }
19
+ disconnectedCallback() {
20
+ super.disconnectedCallback(), this._form && this._formResetHandler && this._form.removeEventListener("reset", this._formResetHandler, !0);
16
21
  }
17
22
  firstUpdated() {
18
- var t, s;
23
+ var t, r;
19
24
  const e = (t = this.shadowRoot) == null ? void 0 : t.querySelector("md-checkbox");
20
25
  e && e.addEventListener("change", () => {
21
- const r = e, a = !!r.checked, o = !!r.indeterminate;
22
- this.checked = a, this.indeterminate = o, this.dispatchEvent(
26
+ const i = e, o = !!i.checked, l = !!i.indeterminate;
27
+ this.checked = o, this.indeterminate = l, this.dispatchEvent(
23
28
  new CustomEvent("change", {
24
- detail: { checked: a, indeterminate: o },
29
+ detail: { checked: o, indeterminate: l },
25
30
  bubbles: !0,
26
31
  composed: !0
27
32
  })
28
33
  );
29
34
  });
30
- const i = (s = this.shadowRoot) == null ? void 0 : s.querySelector("label.wrap");
31
- i == null || i.addEventListener("click", (r) => {
35
+ const s = (r = this.shadowRoot) == null ? void 0 : r.querySelector("label.wrap");
36
+ s == null || s.addEventListener("click", (i) => {
32
37
  if (this.disabled) return;
33
- if (!r.composedPath().some((c) => {
34
- var p, m, g;
35
- const l = c;
36
- return ((m = (p = l == null ? void 0 : l.tagName) == null ? void 0 : p.toLowerCase) == null ? void 0 : m.call(p)) === "md-checkbox" || ((g = l == null ? void 0 : l.classList) == null ? void 0 : g.contains("box-wrap"));
38
+ if (!i.composedPath().some((c) => {
39
+ var b, u, f;
40
+ const n = c;
41
+ return ((u = (b = n == null ? void 0 : n.tagName) == null ? void 0 : b.toLowerCase) == null ? void 0 : u.call(b)) === "md-checkbox" || ((f = n == null ? void 0 : n.classList) == null ? void 0 : f.contains("box-wrap"));
37
42
  })) {
38
- r.preventDefault();
43
+ i.preventDefault();
39
44
  const c = this.shadowRoot.querySelector("md-checkbox");
40
45
  c && (c.checked = !c.checked, c.dispatchEvent(new Event("change", { bubbles: !0, composed: !0 })));
41
46
  }
42
47
  }), this.__syncInnerAria();
43
48
  }
44
49
  updated(e) {
45
- super.updated(e), e.has("disabled") && this.toggleAttribute("aria-disabled", this.disabled), (e.has("label") || e.has("supportingText") || e.has("ariaLabel")) && this.__syncInnerAria();
50
+ super.updated(e), e.has("disabled") && this.toggleAttribute("aria-disabled", this.disabled), (e.has("label") || e.has("supportingText") || e.has("ariaLabel")) && this.__syncInnerAria(), (e.has("checked") || e.has("disabled") || e.has("value")) && this.__syncFormValue();
51
+ }
52
+ // Körs av webbläsaren när formuläret sätter disabled
53
+ formDisabledCallback(e) {
54
+ this.disabled = e;
46
55
  }
47
56
  __syncInnerAria() {
48
- var o, c, l;
49
- const e = (o = this.shadowRoot) == null ? void 0 : o.querySelector("md-checkbox"), i = e == null ? void 0 : e.shadowRoot;
50
- if (!i) return;
51
- const t = i.querySelector('[role="checkbox"]') || i.querySelector('input[type="checkbox"]');
57
+ var l, c, n;
58
+ const e = (l = this.shadowRoot) == null ? void 0 : l.querySelector("md-checkbox"), s = e == null ? void 0 : e.shadowRoot;
59
+ if (!s) return;
60
+ const t = s.querySelector('[role="checkbox"]') || s.querySelector('input[type="checkbox"]');
52
61
  if (!t) return;
53
- const s = !!((c = this.label) != null && c.trim()), r = s ? `${this._checkboxId}-label` : "", a = this.supportingText ? `${this._checkboxId}-supporting-text` : "";
54
- s && r ? (t.setAttribute("aria-labelledby", r), t.removeAttribute("aria-label")) : (t.removeAttribute("aria-labelledby"), (l = this.ariaLabel) != null && l.trim() ? t.setAttribute("aria-label", this.ariaLabel.trim()) : t.removeAttribute("aria-label")), a ? t.setAttribute("aria-describedby", a) : t.removeAttribute("aria-describedby");
62
+ const r = !!((c = this.label) != null && c.trim()), i = r ? `${this._checkboxId}-label` : "", o = this.supportingText ? `${this._checkboxId}-supporting-text` : "";
63
+ r && i ? (t.setAttribute("aria-labelledby", i), t.removeAttribute("aria-label")) : (t.removeAttribute("aria-labelledby"), (n = this.ariaLabel) != null && n.trim() ? t.setAttribute("aria-label", this.ariaLabel.trim()) : t.removeAttribute("aria-label")), o ? t.setAttribute("aria-describedby", o) : t.removeAttribute("aria-describedby");
64
+ }
65
+ // Synkar checked/disabled mot value
66
+ __syncFormValue() {
67
+ if (!this._internals) return;
68
+ const e = this.disabled || !this.checked ? null : this.value;
69
+ this._internals.setFormValue(e);
55
70
  }
56
71
  render() {
57
- var s;
58
- const e = this.supportingText ? `${this._checkboxId}-supporting-text` : void 0, i = !!((s = this.label) != null && s.trim()), t = i ? h : this.ariaLabel || h;
59
- return u`
72
+ var r;
73
+ const e = this.supportingText ? `${this._checkboxId}-supporting-text` : void 0, s = !!((r = this.label) != null && r.trim()), t = s ? p : this.ariaLabel || p;
74
+ return m`
60
75
  <label class="wrap">
61
76
  <div class="box-wrap">
62
77
  <md-checkbox
@@ -67,17 +82,18 @@ let n = class extends y {
67
82
  aria-label=${t}
68
83
  ></md-checkbox>
69
84
  </div>
70
- ${i ? u`<span class="lbl" id="${this._checkboxId}-label">${this.label}</span>` : h}
85
+ ${s ? m`<span class="lbl" id="${this._checkboxId}-label">${this.label}</span>` : p}
71
86
  </label>
72
87
 
73
- ${this.supportingText ? u`<div id="${e}" class="supporting-text">
88
+ ${this.supportingText ? m`<div id="${e}" class="supporting-text">
74
89
  ${this.supportingText}
75
- </div>` : h}
90
+ </div>` : p}
76
91
  <slot></slot>
77
92
  `;
78
93
  }
79
94
  };
80
- n.styles = x`
95
+ a.formAssociated = !0;
96
+ a.styles = y`
81
97
  :host {
82
98
  display: inline-grid;
83
99
  grid-template-columns: auto;
@@ -149,27 +165,33 @@ n.styles = x`
149
165
  }
150
166
  }
151
167
  `;
152
- d([
153
- b({ type: Boolean, reflect: !0 })
154
- ], n.prototype, "disabled", 2);
155
- d([
156
- b({ type: Boolean, reflect: !0 })
157
- ], n.prototype, "indeterminate", 2);
158
- d([
159
- b({ type: Boolean, reflect: !0 })
160
- ], n.prototype, "checked", 2);
161
- d([
162
- b({ type: String })
163
- ], n.prototype, "label", 2);
164
- d([
165
- b({ type: String, attribute: "supporting-text" })
166
- ], n.prototype, "supportingText", 2);
167
- d([
168
- b({ type: String, reflect: !0, attribute: "aria-label" })
169
- ], n.prototype, "ariaLabel", 2);
170
- n = d([
171
- v("scb-checkbox")
172
- ], n);
168
+ h([
169
+ d({ type: Boolean, reflect: !0 })
170
+ ], a.prototype, "disabled", 2);
171
+ h([
172
+ d({ type: Boolean, reflect: !0 })
173
+ ], a.prototype, "indeterminate", 2);
174
+ h([
175
+ d({ type: Boolean, reflect: !0 })
176
+ ], a.prototype, "checked", 2);
177
+ h([
178
+ d({ type: String })
179
+ ], a.prototype, "label", 2);
180
+ h([
181
+ d({ type: String, attribute: "supporting-text" })
182
+ ], a.prototype, "supportingText", 2);
183
+ h([
184
+ d({ type: String, reflect: !0, attribute: "aria-label" })
185
+ ], a.prototype, "ariaLabel", 2);
186
+ h([
187
+ d({ type: String })
188
+ ], a.prototype, "name", 2);
189
+ h([
190
+ d({ type: String })
191
+ ], a.prototype, "value", 2);
192
+ a = h([
193
+ x("scb-checkbox")
194
+ ], a);
173
195
  export {
174
- n as ScbCheckbox
196
+ a as ScbCheckbox
175
197
  };
@@ -1,5 +1,7 @@
1
1
  import { LitElement, TemplateResult, PropertyValues } from 'lit';
2
2
  export declare class ScbChip extends LitElement {
3
+ #private;
4
+ static formAssociated: boolean;
3
5
  variant: 'assist' | 'filter';
4
6
  label: string;
5
7
  icon: string;
@@ -9,9 +11,28 @@ export declare class ScbChip extends LitElement {
9
11
  selected: boolean;
10
12
  href: string;
11
13
  target: '_self' | '_blank' | '_parent' | '_top' | '';
14
+ name: string;
15
+ value: string;
16
+ /**
17
+ * Vertikalt avstånd till omgivande innehåll.
18
+ * "N" (0–14) mappar till var(--spacing-N), annars valfritt CSS-värde.
19
+ * spacing-top / spacing-bottom styr över respektive nederkant och tar över spacing om de är satta.
20
+ */
21
+ spacing: string;
22
+ /** Vertikalt avstånd ovanför chipet. Tar över spacing om satt. */
23
+ spacingTop: string;
24
+ /** Vertikalt avstånd under chipet. Tar över spacing om satt. */
25
+ spacingBottom: string;
26
+ /**
27
+ * Storlek: small | medium | large.
28
+ * Medium är standard (vid tom sträng eller inget värde).
29
+ */
30
+ size: 'small' | 'medium' | 'large' | '';
31
+ private _internals;
12
32
  private __loadedVariants;
13
33
  private __chipSetLoaded;
14
34
  private __iconLoaded;
35
+ constructor();
15
36
  protected updated(changed: PropertyValues): void;
16
37
  protected firstUpdated(): void;
17
38
  private __ensureDepsLoaded;
@@ -22,6 +43,9 @@ export declare class ScbChip extends LitElement {
22
43
  private _toggleSelected;
23
44
  private _onRemove;
24
45
  private _forward;
46
+ private _updateFormValue;
47
+ formDisabledCallback(disabled: boolean): void;
48
+ private mapSpacingToken;
25
49
  }
26
50
  declare global {
27
51
  interface HTMLElementTagNameMap {
@@ -1,51 +1,59 @@
1
- import { css as c, LitElement as p, html as o } from "lit";
2
- import { property as i, customElement as u } from "lit/decorators.js";
3
- var b = Object.defineProperty, v = Object.getOwnPropertyDescriptor, s = (e, r, d, l) => {
4
- for (var a = l > 1 ? void 0 : l ? v(r, d) : r, h = e.length - 1, n; h >= 0; h--)
5
- (n = e[h]) && (a = (l ? n(r, d, a) : n(a)) || a);
6
- return l && a && b(r, d, a), a;
7
- };
8
- let t = class extends p {
1
+ import { css as b, LitElement as v, html as n } from "lit";
2
+ import { property as a, customElement as f } from "lit/decorators.js";
3
+ var _ = Object.defineProperty, y = Object.getOwnPropertyDescriptor, u = (t) => {
4
+ throw TypeError(t);
5
+ }, i = (t, e, r, l) => {
6
+ for (var o = l > 1 ? void 0 : l ? y(e, r) : e, p = t.length - 1, c; p >= 0; p--)
7
+ (c = t[p]) && (o = (l ? c(e, r, o) : c(o)) || o);
8
+ return l && o && _(e, r, o), o;
9
+ }, g = (t, e, r) => e.has(t) || u("Cannot " + r), S = (t, e, r) => e.has(t) ? u("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, r), m = (t, e, r) => (g(t, e, "access private method"), r), h, d;
10
+ let s = class extends v {
9
11
  constructor() {
10
- super(...arguments), this.variant = "assist", this.label = "", this.icon = "", this.disabled = !1, this.elevated = !1, this.removable = !1, this.selected = !1, this.href = "", this.target = "", this.__loadedVariants = /* @__PURE__ */ new Set(), this.__chipSetLoaded = !1, this.__iconLoaded = !1;
12
+ super(), S(this, h), this.variant = "assist", this.label = "", this.icon = "", this.disabled = !1, this.elevated = !1, this.removable = !1, this.selected = !1, this.href = "", this.target = "", this.name = "", this.value = "", this.spacing = "", this.spacingTop = "", this.spacingBottom = "", this.size = "", this._internals = null, this.__loadedVariants = /* @__PURE__ */ new Set(), this.__chipSetLoaded = !1, this.__iconLoaded = !1, "attachInternals" in this && (this._internals = this.attachInternals());
11
13
  }
12
14
  // aria-disabled på host + bridge-vänliga *-changed-events
13
- updated(e) {
14
- super.updated(e), (e.has("variant") || e.has("icon")) && this.__ensureDepsLoaded(), e.has("disabled") && (this.toggleAttribute("aria-disabled", this.disabled), this.dispatchEvent(
15
+ updated(t) {
16
+ super.updated(t), (t.has("variant") || t.has("icon")) && this.__ensureDepsLoaded(), t.has("disabled") && (this.toggleAttribute("aria-disabled", this.disabled), this.dispatchEvent(
15
17
  new CustomEvent("disabled-changed", {
16
18
  detail: { disabled: this.disabled },
17
19
  bubbles: !0,
18
20
  composed: !0
19
21
  })
20
- )), e.has("variant") && this.dispatchEvent(
22
+ )), t.has("variant") && this.dispatchEvent(
21
23
  new CustomEvent("variant-changed", {
22
24
  detail: { variant: this.variant },
23
25
  bubbles: !0,
24
26
  composed: !0
25
27
  })
26
- ), e.has("label") && this.dispatchEvent(
28
+ ), t.has("label") && this.dispatchEvent(
27
29
  new CustomEvent("label-changed", {
28
30
  detail: { label: this.label },
29
31
  bubbles: !0,
30
32
  composed: !0
31
33
  })
32
- ), e.has("elevated") && this.dispatchEvent(
34
+ ), t.has("elevated") && this.dispatchEvent(
33
35
  new CustomEvent("elevated-changed", {
34
36
  detail: { elevated: this.elevated },
35
37
  bubbles: !0,
36
38
  composed: !0
37
39
  })
38
- ), e.has("icon") && this.dispatchEvent(
40
+ ), t.has("icon") && this.dispatchEvent(
39
41
  new CustomEvent("icon-changed", {
40
42
  detail: { icon: this.icon },
41
43
  bubbles: !0,
42
44
  composed: !0
43
45
  })
44
- );
46
+ ), t.has("size") && this.dispatchEvent(
47
+ new CustomEvent("size-changed", {
48
+ detail: { size: this.size },
49
+ bubbles: !0,
50
+ composed: !0
51
+ })
52
+ ), (t.has("selected") || t.has("disabled") || t.has("variant") || t.has("value") || t.has("name")) && this._updateFormValue(), (t.has("spacing") || t.has("spacingTop") || t.has("spacingBottom")) && m(this, h, d).call(this);
45
53
  }
46
54
  // Kör dynamisk import första gången komponenten finns i DOM
47
55
  firstUpdated() {
48
- this.__ensureDepsLoaded();
56
+ this.__ensureDepsLoaded(), m(this, h, d).call(this), this._updateFormValue();
49
57
  }
50
58
  /* Ladda in nödvändiga Material-web-komponenter vid behov (variant + ev. chip-set + ev. ikon) */
51
59
  async __ensureDepsLoaded() {
@@ -66,30 +74,30 @@ let t = class extends p {
66
74
  return !!this.closest("md-chip-set");
67
75
  }
68
76
  render() {
69
- const e = this._renderChip();
70
- return this._insideChipSet ? e : o`<md-chip-set>${e}</md-chip-set>`;
77
+ const t = this._renderChip();
78
+ return this._insideChipSet ? t : n`<md-chip-set>${t}</md-chip-set>`;
71
79
  }
72
80
  _renderChip() {
73
- const e = this.icon ? o`<md-icon slot="icon">${this.icon}</md-icon>` : null;
81
+ const t = this.icon ? n`<md-icon slot="icon">${this.icon}</md-icon>` : null;
74
82
  switch (this.variant) {
75
83
  case "assist": {
76
- const r = this.target === "_blank" ? "noopener noreferrer" : void 0;
77
- return o`
84
+ const e = this.target === "_blank" ? "noopener noreferrer" : void 0;
85
+ return n`
78
86
  <md-assist-chip
79
87
  label=${this.label}
80
88
  ?disabled=${this.disabled}
81
89
  ?elevated=${this.elevated}
82
90
  href=${this.href || void 0}
83
91
  target=${this.href && this.target || void 0}
84
- rel=${r}
92
+ rel=${e}
85
93
  @update-focus=${this._forward}
86
94
  >
87
- ${e}
95
+ ${t}
88
96
  </md-assist-chip>
89
97
  `;
90
98
  }
91
99
  case "filter":
92
- return o`
100
+ return n`
93
101
  <md-filter-chip
94
102
  label=${this.label}
95
103
  ?disabled=${this.disabled}
@@ -99,11 +107,11 @@ let t = class extends p {
99
107
  @update-focus=${this._forward}
100
108
  @click=${() => this._toggleSelected()}
101
109
  >
102
- ${e}
110
+ ${t}
103
111
  </md-filter-chip>
104
112
  `;
105
113
  default:
106
- return o``;
114
+ return n``;
107
115
  }
108
116
  }
109
117
  _toggleSelected() {
@@ -113,10 +121,10 @@ let t = class extends p {
113
121
  bubbles: !0,
114
122
  composed: !0
115
123
  })
116
- );
124
+ ), this._updateFormValue();
117
125
  }
118
- _onRemove(e) {
119
- e.stopPropagation(), this.dispatchEvent(
126
+ _onRemove(t) {
127
+ t.stopPropagation(), this.dispatchEvent(
120
128
  new CustomEvent("remove", {
121
129
  detail: { label: this.label },
122
130
  bubbles: !0,
@@ -124,19 +132,47 @@ let t = class extends p {
124
132
  })
125
133
  );
126
134
  }
127
- _forward(e) {
135
+ _forward(t) {
128
136
  this.dispatchEvent(
129
- new CustomEvent(e.type, {
130
- detail: e.detail,
137
+ new CustomEvent(t.type, {
138
+ detail: t.detail,
131
139
  bubbles: !0,
132
140
  composed: !0
133
141
  })
134
142
  );
135
143
  }
144
+ // Kopplar selected/variant/disabled till formvärde
145
+ _updateFormValue() {
146
+ if (!this._internals) return;
147
+ if (!(this.variant === "filter" && this.selected && !this.disabled && !!this.name)) {
148
+ this._internals.setFormValue(null), this._internals.setValidity({});
149
+ return;
150
+ }
151
+ const e = this.value || this.label || "";
152
+ this._internals.setFormValue(e, this.name), this._internals.setValidity({});
153
+ }
154
+ // Körs av webbläsaren när formuläret sätter disabled på kontrollen
155
+ formDisabledCallback(t) {
156
+ this.disabled = t;
157
+ }
158
+ mapSpacingToken(t) {
159
+ if (!t) return;
160
+ const e = String(t).trim();
161
+ if (e)
162
+ return /^\d+$/.test(e) ? `var(--spacing-${Math.max(0, Math.min(14, parseInt(e, 10)))})` : e;
163
+ }
136
164
  };
137
- t.styles = c`
165
+ h = /* @__PURE__ */ new WeakSet();
166
+ d = function() {
167
+ const t = this.mapSpacingToken(this.spacing), e = this.mapSpacingToken(this.spacingTop), r = this.mapSpacingToken(this.spacingBottom), l = e ?? t, o = r ?? t;
168
+ l ? this.style.setProperty("--scb-chip-spacing-block-start", l) : this.style.removeProperty("--scb-chip-spacing-block-start"), o ? this.style.setProperty("--scb-chip-spacing-block-end", o) : this.style.removeProperty("--scb-chip-spacing-block-end");
169
+ };
170
+ s.formAssociated = !0;
171
+ s.styles = b`
138
172
  :host {
139
173
  display: inline-block;
174
+ margin-block-start: var(--scb-chip-spacing-block-start, 0);
175
+ margin-block-end: var(--scb-chip-spacing-block-end, 0);
140
176
  }
141
177
 
142
178
  /* Sätt samma färg på label för assist som är på filter */
@@ -147,41 +183,77 @@ t.styles = c`
147
183
  --_pressed-label-text-color: var(--md-sys-color-on-surface-variant);
148
184
  }
149
185
 
186
+ /* Storlekar: små/medium/stora chips via tokens.
187
+ Medium (default) är Material-standardvärdena. */
188
+ :host([size='small']) md-assist-chip,
189
+ :host([size='small']) md-filter-chip {
190
+ --md-assist-chip-container-height: 28px;
191
+ --md-filter-chip-container-height: 28px;
192
+ --md-assist-chip-label-text-size: 0.8125rem;
193
+ --md-filter-chip-label-text-size: 0.8125rem;
194
+ }
195
+
196
+ :host([size='large']) md-assist-chip,
197
+ :host([size='large']) md-filter-chip {
198
+ --md-assist-chip-container-height: 40px;
199
+ --md-filter-chip-container-height: 40px;
200
+ --md-assist-chip-label-text-size: 0.9375rem;
201
+ --md-filter-chip-label-text-size: 0.9375rem;
202
+ }
203
+
150
204
  md-icon {
151
205
  color: var(--md-sys-color-on-surface);
152
206
  font-size: var(--md-sys-typescale-body-large-size);
153
207
  }
154
208
  `;
155
- s([
156
- i({ type: String, reflect: !0 })
157
- ], t.prototype, "variant", 2);
158
- s([
159
- i({ type: String })
160
- ], t.prototype, "label", 2);
161
- s([
162
- i({ type: String })
163
- ], t.prototype, "icon", 2);
164
- s([
165
- i({ type: Boolean, reflect: !0 })
166
- ], t.prototype, "disabled", 2);
167
- s([
168
- i({ type: Boolean, reflect: !0 })
169
- ], t.prototype, "elevated", 2);
170
- s([
171
- i({ type: Boolean, reflect: !0 })
172
- ], t.prototype, "removable", 2);
173
- s([
174
- i({ type: Boolean, reflect: !0 })
175
- ], t.prototype, "selected", 2);
176
- s([
177
- i({ type: String })
178
- ], t.prototype, "href", 2);
179
- s([
180
- i({ type: String })
181
- ], t.prototype, "target", 2);
182
- t = s([
183
- u("scb-chip")
184
- ], t);
209
+ i([
210
+ a({ type: String, reflect: !0 })
211
+ ], s.prototype, "variant", 2);
212
+ i([
213
+ a({ type: String })
214
+ ], s.prototype, "label", 2);
215
+ i([
216
+ a({ type: String })
217
+ ], s.prototype, "icon", 2);
218
+ i([
219
+ a({ type: Boolean, reflect: !0 })
220
+ ], s.prototype, "disabled", 2);
221
+ i([
222
+ a({ type: Boolean, reflect: !0 })
223
+ ], s.prototype, "elevated", 2);
224
+ i([
225
+ a({ type: Boolean, reflect: !0 })
226
+ ], s.prototype, "removable", 2);
227
+ i([
228
+ a({ type: Boolean, reflect: !0 })
229
+ ], s.prototype, "selected", 2);
230
+ i([
231
+ a({ type: String })
232
+ ], s.prototype, "href", 2);
233
+ i([
234
+ a({ type: String })
235
+ ], s.prototype, "target", 2);
236
+ i([
237
+ a({ type: String })
238
+ ], s.prototype, "name", 2);
239
+ i([
240
+ a({ type: String })
241
+ ], s.prototype, "value", 2);
242
+ i([
243
+ a({ type: String, reflect: !0 })
244
+ ], s.prototype, "spacing", 2);
245
+ i([
246
+ a({ type: String, reflect: !0, attribute: "spacing-top" })
247
+ ], s.prototype, "spacingTop", 2);
248
+ i([
249
+ a({ type: String, reflect: !0, attribute: "spacing-bottom" })
250
+ ], s.prototype, "spacingBottom", 2);
251
+ i([
252
+ a({ type: String, reflect: !0 })
253
+ ], s.prototype, "size", 2);
254
+ s = i([
255
+ f("scb-chip")
256
+ ], s);
185
257
  export {
186
- t as ScbChip
258
+ s as ScbChip
187
259
  };
@@ -4,12 +4,26 @@ type Direction = 'horizontal' | 'vertical';
4
4
  type Inset = 'none' | 'both' | 'start' | 'end';
5
5
  type Anchor = 'start' | 'end';
6
6
  export declare class ScbDivider extends LitElement {
7
+ #private;
7
8
  variant: Variant;
8
9
  direction: Direction;
9
10
  inset: Inset;
10
11
  overlay: boolean;
11
12
  anchor: Anchor;
13
+ /**
14
+ * Styr avstånd ortogonalt mot avdelaren.
15
+ * - Horizontal divider: spacing ger margin-block (avstånd ovan/under).
16
+ * - Vertical divider: spacing ger margin-inline (avstånd vänster/höger), om inte overlay används.
17
+ *
18
+ * Värden:
19
+ * - "N" (0–14) mappas till var(--spacing-N)
20
+ * - Annars tas värdet som ett CSS-värde (t.ex. "16px", "1rem", "var(--spacing-6)").
21
+ */
22
+ spacing: string;
12
23
  static styles: import('lit').CSSResult;
24
+ firstUpdated(): void;
25
+ updated(changed: Map<string, unknown>): void;
26
+ private mapSpacingToken;
13
27
  render(): import('lit-html').TemplateResult<1>;
14
28
  }
15
29
  declare global {