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,56 +1,58 @@
1
- import { css as f, LitElement as b, html as m } from "lit";
2
- import { property as p, customElement as y } from "lit/decorators.js";
3
- var _ = Object.defineProperty, C = Object.getOwnPropertyDescriptor, v = (t) => {
1
+ import { css as k, LitElement as S, html as C } from "lit";
2
+ import { property as c, customElement as V } from "lit/decorators.js";
3
+ var w = Object.defineProperty, E = Object.getOwnPropertyDescriptor, _ = (t) => {
4
4
  throw TypeError(t);
5
- }, n = (t, e, a, i) => {
6
- for (var r = i > 1 ? void 0 : i ? C(e, a) : e, s = t.length - 1, o; s >= 0; s--)
7
- (o = t[s]) && (r = (i ? o(e, a, r) : o(r)) || r);
8
- return i && r && _(e, a, r), r;
9
- }, S = (t, e, a) => e.has(t) || v("Cannot " + a), c = (t, e, a) => (S(t, e, "read from private field"), a ? a.call(t) : e.get(t)), u = (t, e, a) => e.has(t) ? v("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, a), g, d, h;
10
- let l = class extends b {
5
+ }, l = (t, e, i, s) => {
6
+ for (var a = s > 1 ? void 0 : s ? E(e, i) : e, o = t.length - 1, n; o >= 0; o--)
7
+ (n = t[o]) && (a = (s ? n(e, i, a) : n(a)) || a);
8
+ return s && a && w(e, i, a), a;
9
+ }, y = (t, e, i) => e.has(t) || _("Cannot " + i), h = (t, e, i) => (y(t, e, "read from private field"), i ? i.call(t) : e.get(t)), g = (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), d = (t, e, i) => (y(t, e, "access private method"), i), v, u, m, p, b, f;
10
+ let r = class extends S {
11
11
  constructor() {
12
- super(...arguments), this.name = "", this.orientation = "vertical", this.disabled = !1, this.ariaLabel = null, this.spacing = "item", this.value = "", u(this, g, () => {
12
+ super(), g(this, p), this.name = "", this.orientation = "vertical", this.disabled = !1, this.ariaLabel = null, this.spacing = "", this.spacingTop = "", this.spacingBottom = "", this.value = "", this._internals = null, this._form = null, this._formResetHandler = null, this._initialValue = "", g(this, v, () => {
13
13
  var e;
14
14
  const t = (e = this.shadowRoot) == null ? void 0 : e.querySelector("slot");
15
- return t ? t.assignedElements({ flatten: !0 }).filter((a) => a.tagName.toLowerCase() === "scb-radio-button") : [];
16
- }), u(this, d, () => {
17
- const t = c(this, g).call(this);
15
+ return t ? t.assignedElements({ flatten: !0 }).filter(
16
+ (i) => i.tagName.toLowerCase() === "scb-radio-button"
17
+ ) : [];
18
+ }), g(this, u, () => {
19
+ const t = h(this, v).call(this);
18
20
  if (!t.length) return;
19
21
  let e = null;
20
- for (const a of t) {
21
- const i = a;
22
- this.name && a.setAttribute("name", this.name), this.disabled ? a.setAttribute("disabled", "") : a.removeAttribute("disabled"), this.orientation === "horizontal" ? a.setAttribute("orientation", "horizontal") : a.removeAttribute("orientation"), this.spacing === "group" ? a.style.setProperty("--scb-radio-gap", "0") : a.style.removeProperty("--scb-radio-gap");
23
- const r = i.value ?? a.getAttribute("value") ?? "", s = typeof i.checked == "boolean" ? i.checked : a.hasAttribute("checked");
22
+ for (const i of t) {
23
+ const s = i;
24
+ this.name && i.setAttribute("name", this.name), this.disabled ? i.setAttribute("disabled", "") : i.removeAttribute("disabled"), this.orientation === "horizontal" ? i.setAttribute("orientation", "horizontal") : i.removeAttribute("orientation");
25
+ const a = s.value ?? i.getAttribute("value") ?? "", o = typeof s.checked == "boolean" ? s.checked : i.hasAttribute("checked");
24
26
  if (this.value) {
25
- const o = String(r) === this.value;
26
- o && !s ? i.checked = !0 : !o && s && (i.checked = !1);
27
+ const n = String(a) === this.value;
28
+ n && !o ? s.checked = !0 : !n && o && (s.checked = !1);
27
29
  } else
28
- s && e === null && (e = String(r));
30
+ o && e === null && (e = String(a));
29
31
  }
30
32
  !this.value && e !== null && (this.value = e);
31
- }), u(this, h, (t) => {
32
- var i, r;
33
+ }), g(this, m, (t) => {
34
+ var s, a;
33
35
  const e = t.composedPath().find(
34
- (s) => {
35
- var o;
36
- return ((o = s == null ? void 0 : s.tagName) == null ? void 0 : o.toLowerCase()) === "scb-radio-button";
36
+ (o) => {
37
+ var n;
38
+ return ((n = o == null ? void 0 : o.tagName) == null ? void 0 : n.toLowerCase()) === "scb-radio-button";
37
39
  }
38
- ), a = (e == null ? void 0 : e.value) ?? ((i = e == null ? void 0 : e.getAttribute) == null ? void 0 : i.call(e, "value")) ?? ((r = t.target) == null ? void 0 : r.value) ?? "";
39
- this.value = String(a ?? ""), this.dispatchEvent(
40
+ ), i = (e == null ? void 0 : e.value) ?? ((s = e == null ? void 0 : e.getAttribute) == null ? void 0 : s.call(e, "value")) ?? ((a = t.target) == null ? void 0 : a.value) ?? "";
41
+ this.value = String(i ?? ""), this.dispatchEvent(
40
42
  new CustomEvent("scb-change", {
41
43
  detail: {
42
- value: String(a ?? ""),
44
+ value: String(i ?? ""),
43
45
  originalIsTrusted: (t == null ? void 0 : t.isTrusted) === !0
44
46
  },
45
47
  bubbles: !0,
46
48
  composed: !0
47
49
  })
48
50
  );
49
- });
51
+ }), "attachInternals" in this && (this._internals = this.attachInternals());
50
52
  }
51
53
  render() {
52
54
  const t = this.orientation === "horizontal" ? "row" : "column";
53
- return m`
55
+ return C`
54
56
  <div
55
57
  class="g"
56
58
  role="radiogroup"
@@ -58,62 +60,113 @@ let l = class extends b {
58
60
  aria-label=${this.ariaLabel ?? ""}
59
61
  style=${`--_dir:${t}`}
60
62
  >
61
- <slot @slotchange=${c(this, d)}></slot>
63
+ <slot @slotchange=${h(this, u)}></slot>
62
64
  </div>
63
65
  `;
64
66
  }
65
67
  firstUpdated() {
66
- c(this, d).call(this), this.addEventListener("change", c(this, h));
68
+ d(this, p, b).call(this), h(this, u).call(this), this.addEventListener("change", h(this, m)), this._initialValue = this.value, this._form = this.closest("form"), this._form && (this._formResetHandler = () => {
69
+ this.value = this._initialValue, this.requestUpdate(), h(this, u).call(this), this.__syncFormValue();
70
+ }, this._form.addEventListener("reset", this._formResetHandler, !0)), this.__syncFormValue();
67
71
  }
68
72
  disconnectedCallback() {
69
- this.removeEventListener("change", c(this, h)), super.disconnectedCallback();
73
+ this.removeEventListener("change", h(this, m)), this._form && this._formResetHandler && this._form.removeEventListener("reset", this._formResetHandler, !0), super.disconnectedCallback();
70
74
  }
71
75
  updated(t) {
72
- (t.has("name") || t.has("disabled") || t.has("orientation") || t.has("spacing") || t.has("value")) && c(this, d).call(this);
76
+ (t.has("spacing") || t.has("spacingTop") || t.has("spacingBottom")) && d(this, p, b).call(this), (t.has("name") || t.has("disabled") || t.has("orientation") || t.has("value")) && h(this, u).call(this), (t.has("value") || t.has("disabled") || t.has("name")) && this.__syncFormValue();
73
77
  }
78
+ // Körs av webbläsaren när formuläret sätter disabled
79
+ formDisabledCallback(t) {
80
+ this.disabled = t;
81
+ }
82
+ // Synkar gruppens value/disabled mot FormData
83
+ __syncFormValue() {
84
+ if (!this._internals) return;
85
+ const t = typeof this.name == "string" && this.name.trim() !== "", e = typeof this.value == "string" && this.value.trim() !== "", i = this.disabled || !t || !e ? null : this.value;
86
+ this._internals.setFormValue(i);
87
+ }
88
+ };
89
+ v = /* @__PURE__ */ new WeakMap();
90
+ u = /* @__PURE__ */ new WeakMap();
91
+ m = /* @__PURE__ */ new WeakMap();
92
+ p = /* @__PURE__ */ new WeakSet();
93
+ b = function() {
94
+ const t = d(this, p, f).call(this, this.spacing), e = d(this, p, f).call(this, this.spacingTop) ?? t, i = d(this, p, f).call(this, this.spacingBottom) ?? t;
95
+ e ? this.style.setProperty(
96
+ "--scb-radio-group-spacing-block-start",
97
+ e
98
+ ) : this.style.removeProperty(
99
+ "--scb-radio-group-spacing-block-start"
100
+ ), i ? this.style.setProperty(
101
+ "--scb-radio-group-spacing-block-end",
102
+ i
103
+ ) : this.style.removeProperty(
104
+ "--scb-radio-group-spacing-block-end"
105
+ );
74
106
  };
75
- g = /* @__PURE__ */ new WeakMap();
76
- d = /* @__PURE__ */ new WeakMap();
77
- h = /* @__PURE__ */ new WeakMap();
78
- l.styles = f`
79
- :host { display: block; }
107
+ f = function(t) {
108
+ if (!t) return;
109
+ const e = String(t).trim();
110
+ if (e)
111
+ return /^\d+$/.test(e) ? `var(--spacing-${Math.max(0, Math.min(14, parseInt(e, 10)))})` : e;
112
+ };
113
+ r.formAssociated = !0;
114
+ r.styles = k`
115
+ :host {
116
+ display: block;
117
+
118
+ /* Vertikal standard-spacing mellan items i gruppen */
119
+ --scb-radio-gap: var(--spacing-4, 12px);
120
+
121
+ /* Vertikalt avstånd mot omgivande innehåll, styrs via spacing/spacing-top/spacing-bottom */
122
+ margin-block-start: var(--scb-radio-group-spacing-block-start, 0);
123
+ margin-block-end: var(--scb-radio-group-spacing-block-end, 0);
124
+ }
125
+
126
+ /* Horisontell standard-spacing mellan items om gap inte overrideas via CSS-variabel */
127
+ :host([orientation='horizontal']) {
128
+ --scb-radio-gap: var(--spacing-8, 32px);
129
+ }
80
130
 
81
131
  .g {
82
132
  display: flex;
83
133
  flex-direction: var(--_dir, column);
84
- gap: 0; /* default: inget extra gap */
85
134
  align-items: flex-start;
135
+ gap: var(--scb-radio-gap);
86
136
  }
87
137
 
88
- /* Om gruppen ska äga spacing: använder gap och nollar radios egen syskonmarginal */
89
- :host([spacing="group"]) .g {
90
- gap: var(--scb-radio-gap, 12px);
91
- }
92
- :host([spacing="group"]) ::slotted(scb-radio-button) {
138
+ /* När radioknappar ligger i en grupp ska spacing ägas av gruppen, inte av enskilda items */
139
+ ::slotted(scb-radio-button) {
93
140
  --scb-radio-gap: 0;
94
141
  }
95
142
  `;
96
- n([
97
- p({ type: String })
98
- ], l.prototype, "name", 2);
99
- n([
100
- p({ type: String, reflect: !0 })
101
- ], l.prototype, "orientation", 2);
102
- n([
103
- p({ type: Boolean, reflect: !0 })
104
- ], l.prototype, "disabled", 2);
105
- n([
106
- p({ type: String, attribute: "aria-label" })
107
- ], l.prototype, "ariaLabel", 2);
108
- n([
109
- p({ type: String, reflect: !0 })
110
- ], l.prototype, "spacing", 2);
111
- n([
112
- p({ type: String, reflect: !0 })
113
- ], l.prototype, "value", 2);
114
- l = n([
115
- y("scb-radio-group")
116
- ], l);
143
+ l([
144
+ c({ type: String })
145
+ ], r.prototype, "name", 2);
146
+ l([
147
+ c({ type: String, reflect: !0 })
148
+ ], r.prototype, "orientation", 2);
149
+ l([
150
+ c({ type: Boolean, reflect: !0 })
151
+ ], r.prototype, "disabled", 2);
152
+ l([
153
+ c({ type: String, attribute: "aria-label" })
154
+ ], r.prototype, "ariaLabel", 2);
155
+ l([
156
+ c({ type: String, reflect: !0 })
157
+ ], r.prototype, "spacing", 2);
158
+ l([
159
+ c({ type: String, attribute: "spacing-top", reflect: !0 })
160
+ ], r.prototype, "spacingTop", 2);
161
+ l([
162
+ c({ type: String, attribute: "spacing-bottom", reflect: !0 })
163
+ ], r.prototype, "spacingBottom", 2);
164
+ l([
165
+ c({ type: String, reflect: !0 })
166
+ ], r.prototype, "value", 2);
167
+ r = l([
168
+ V("scb-radio-group")
169
+ ], r);
117
170
  export {
118
- l as ScbRadioGroup
171
+ r as ScbRadioGroup
119
172
  };
@@ -1,8 +1,14 @@
1
- import { LitElement, TemplateResult } from 'lit';
1
+ import { LitElement, TemplateResult, PropertyValues } from 'lit';
2
2
  export declare class ScbSearch extends LitElement {
3
+ static formAssociated: boolean;
4
+ private _internals;
3
5
  trailingIcon?: string;
4
6
  supportingText: string;
5
7
  value: string;
8
+ /** Namn för HTML-formulär (hamnar som nyckel i FormData när formuläret skickas) */
9
+ name: string;
10
+ /** Inaktiverat läge; speglas mot inre input och FormData (skickas inte när disabled). */
11
+ disabled: boolean;
6
12
  size: 'default' | 'compact';
7
13
  fullScreen: boolean;
8
14
  private _inputFocused;
@@ -14,12 +20,18 @@ export declare class ScbSearch extends LitElement {
14
20
  private _kbShouldShowRing;
15
21
  private _onGlobalKeydown;
16
22
  private _onGlobalPointerDown;
23
+ private _form;
24
+ private _formResetHandler;
25
+ private _initialValue;
26
+ constructor();
17
27
  static styles: import('lit').CSSResult;
18
28
  connectedCallback(): void;
19
29
  disconnectedCallback(): void;
20
30
  firstUpdated(): void;
21
- updated(): void;
31
+ updated(changed: PropertyValues): void;
22
32
  render(): TemplateResult;
33
+ /** Gör så att native formulär kan sätta disabled på kontrollen. */
34
+ formDisabledCallback(disabled: boolean): void;
23
35
  submit(): void;
24
36
  private get _hasSuggestions();
25
37
  private _onSlotChange;
@@ -48,6 +60,7 @@ export declare class ScbSearch extends LitElement {
48
60
  private _listWithHandler?;
49
61
  private _attachListScrollListener;
50
62
  private _detachListScrollListener;
63
+ private _syncFormValue;
51
64
  }
52
65
  declare global {
53
66
  interface HTMLElementTagNameMap {