scb-wc-test 0.1.94 → 0.1.95

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 (30) hide show
  1. package/mvc/components/scb-accordion/scb-accordion-item.js +6 -7
  2. package/mvc/components/scb-accordion/scb-accordion.js +2 -2
  3. package/mvc/components/scb-button/scb-button.js +2 -2
  4. package/mvc/components/scb-chip/scb-chip.js +1 -1
  5. package/mvc/components/scb-dialog/scb-dialog.js +14 -15
  6. package/mvc/components/scb-list/scb-list-item.js +2 -2
  7. package/mvc/components/scb-list/scb-list.js +1 -1
  8. package/mvc/components/scb-radio-button/scb-radio-button.js +3 -3
  9. package/mvc/components/scb-switch/scb-switch.js +5 -6
  10. package/mvc/components/scb-tabs/scb-primary-tab.js +1 -2
  11. package/mvc/components/scb-tabs/scb-secondary-tab.js +2 -3
  12. package/mvc/components/scb-tabs/scb-tabs.js +1 -1
  13. package/mvc/components/scb-textfield/scb-textfield.js +6 -7
  14. package/mvc/vendor/vendor-material.js +147 -147
  15. package/mvc/vendor/vendor.js +1 -1
  16. package/package.json +2 -2
  17. package/scb-accordion/scb-accordion-item.d.ts +1 -3
  18. package/scb-accordion/scb-accordion-item.js +49 -49
  19. package/scb-dialog/scb-dialog.d.ts +0 -3
  20. package/scb-dialog/scb-dialog.js +74 -94
  21. package/scb-radio-button/scb-radio-button.js +3 -3
  22. package/scb-switch/scb-switch.d.ts +1 -2
  23. package/scb-switch/scb-switch.js +39 -42
  24. package/scb-tabs/scb-primary-tab.d.ts +0 -1
  25. package/scb-tabs/scb-primary-tab.js +24 -28
  26. package/scb-tabs/scb-secondary-tab.d.ts +0 -1
  27. package/scb-tabs/scb-secondary-tab.js +31 -35
  28. package/scb-textfield/scb-textfield.d.ts +0 -6
  29. package/scb-textfield/scb-textfield.js +34 -39
  30. package/scb-wc-test.bundle.js +684 -684
@@ -1,25 +1,23 @@
1
- import { LitElement as b, nothing as h, html as p, css as y } from "lit";
2
- import { property as l, customElement as v } from "lit/decorators.js";
3
- var g = Object.defineProperty, w = Object.getOwnPropertyDescriptor, f = (e) => {
4
- throw TypeError(e);
5
- }, i = (e, t, s, n) => {
6
- for (var r = n > 1 ? void 0 : n ? w(t, s) : t, c = e.length - 1, d; c >= 0; c--)
7
- (d = e[c]) && (r = (n ? d(t, s, r) : d(r)) || r);
8
- return n && r && g(t, s, r), r;
9
- }, u = (e, t, s) => t.has(e) || f("Cannot " + s), m = (e, t, s) => (u(e, t, "read from private field"), t.get(e)), _ = (e, t, s) => t.has(e) ? f("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, s), x = (e, t, s, n) => (u(e, t, "write to private field"), t.set(e, s), s), o;
10
- let a = class extends b {
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";
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 {
11
10
  constructor() {
12
- super(...arguments), this.label = "", this.ariaLabel = "", this.icons = !1, this.selected = !1, this.disabled = !1, this.fullWidth = !1, _(this, o, !1);
11
+ super(...arguments), this.label = "", this.ariaLabel = "", this.icons = !1, this.selected = !1, this.disabled = !1, this.fullWidth = !1;
13
12
  }
14
13
  updated() {
15
14
  this.toggleAttribute("aria-disabled", this.disabled);
16
15
  }
17
- async firstUpdated() {
16
+ firstUpdated() {
18
17
  var t;
19
- m(this, o) || (await import("@material/web/switch/switch.js"), x(this, o, !0));
20
18
  const e = (t = this.shadowRoot) == null ? void 0 : t.querySelector("md-switch");
21
- e == null || e.addEventListener("change", (s) => {
22
- this.selected = s.target.selected, this.dispatchEvent(new CustomEvent("change", {
19
+ e == null || e.addEventListener("change", (a) => {
20
+ this.selected = a.target.selected, this.dispatchEvent(new CustomEvent("change", {
23
21
  detail: { selected: this.selected },
24
22
  bubbles: !0,
25
23
  composed: !0
@@ -27,7 +25,7 @@ let a = class extends b {
27
25
  });
28
26
  }
29
27
  render() {
30
- const e = this.label.trim().length > 0, t = e ? h : this.ariaLabel || h, s = p`
28
+ const e = this.label.trim().length > 0, t = e ? h : this.ariaLabel || h, a = p`
31
29
  <md-switch
32
30
  ?icons=${this.icons}
33
31
  ?selected=${this.selected}
@@ -38,13 +36,12 @@ let a = class extends b {
38
36
  return e ? p`
39
37
  <label class="switch-container" ?disabled=${this.disabled}>
40
38
  <span class="switch-label">${this.label}</span>
41
- ${s}
39
+ ${a}
42
40
  </label>
43
- ` : s;
41
+ ` : a;
44
42
  }
45
43
  };
46
- o = /* @__PURE__ */ new WeakMap();
47
- a.styles = y`
44
+ s.styles = d`
48
45
  :host {
49
46
  display: block;
50
47
  }
@@ -85,27 +82,27 @@ a.styles = y`
85
82
  color: var(--scb-switch-label-color, inherit);
86
83
  }
87
84
  `;
88
- i([
89
- l({ type: String })
90
- ], a.prototype, "label", 2);
91
- i([
92
- l({ type: String, reflect: !0, attribute: "aria-label" })
93
- ], a.prototype, "ariaLabel", 2);
94
- i([
95
- l({ type: Boolean, reflect: !0 })
96
- ], a.prototype, "icons", 2);
97
- i([
98
- l({ type: Boolean, reflect: !0 })
99
- ], a.prototype, "selected", 2);
100
- i([
101
- l({ type: Boolean, reflect: !0 })
102
- ], a.prototype, "disabled", 2);
103
- i([
104
- l({ type: Boolean, reflect: !0, attribute: "full-width" })
105
- ], a.prototype, "fullWidth", 2);
106
- a = i([
107
- v("scb-switch")
108
- ], a);
85
+ l([
86
+ r({ type: String })
87
+ ], s.prototype, "label", 2);
88
+ l([
89
+ r({ type: String, reflect: !0, attribute: "aria-label" })
90
+ ], s.prototype, "ariaLabel", 2);
91
+ l([
92
+ r({ type: Boolean, reflect: !0 })
93
+ ], s.prototype, "icons", 2);
94
+ l([
95
+ r({ type: Boolean, reflect: !0 })
96
+ ], s.prototype, "selected", 2);
97
+ l([
98
+ r({ type: Boolean, reflect: !0 })
99
+ ], s.prototype, "disabled", 2);
100
+ l([
101
+ r({ type: Boolean, reflect: !0, attribute: "full-width" })
102
+ ], s.prototype, "fullWidth", 2);
103
+ s = l([
104
+ f("scb-switch")
105
+ ], s);
109
106
  export {
110
- a as ScbSwitch
107
+ s as ScbSwitch
111
108
  };
@@ -11,6 +11,5 @@ export declare class ScbPrimaryTab extends MdPrimaryTab {
11
11
  private _onActivate;
12
12
  protected updated(): void;
13
13
  static styles: import('lit').CSSResultOrNative[];
14
- private ensureMdIconLoaded;
15
14
  private updateIconSlot;
16
15
  }
@@ -1,12 +1,13 @@
1
- import { MdPrimaryTab as d } from "@material/web/tabs/primary-tab.js";
2
- import { property as l, customElement as p } from "lit/decorators.js";
3
- import { css as u } from "lit";
4
- var h = Object.defineProperty, b = Object.getOwnPropertyDescriptor, s = (t, e, r, n) => {
5
- for (var o = n > 1 ? void 0 : n ? b(e, r) : e, c = t.length - 1, a; c >= 0; c--)
6
- (a = t[c]) && (o = (n ? a(e, r, o) : a(o)) || o);
7
- return n && o && h(e, r, o), o;
1
+ import { MdPrimaryTab as p } from "@material/web/tabs/primary-tab.js";
2
+ import { property as a, customElement as u } from "lit/decorators.js";
3
+ import { css as h } from "lit";
4
+ import "@material/web/icon/icon.js";
5
+ var d = Object.defineProperty, b = Object.getOwnPropertyDescriptor, s = (t, e, r, n) => {
6
+ for (var i = n > 1 ? void 0 : n ? b(e, r) : e, c = t.length - 1, l; c >= 0; c--)
7
+ (l = t[c]) && (i = (n ? l(e, r, i) : l(i)) || i);
8
+ return n && i && d(e, r, i), i;
8
9
  };
9
- let i = class extends d {
10
+ let o = class extends p {
10
11
  constructor() {
11
12
  super(...arguments), this.iconOnly = !1, this.inlineIcon = !1, this._onActivate = () => {
12
13
  var e;
@@ -48,18 +49,13 @@ let i = class extends d {
48
49
  e && this.setAttribute("aria-label", e);
49
50
  }
50
51
  }
51
- // Lazy import av md-icon – laddas EN gång globalt när det behövs
52
- async ensureMdIconLoaded() {
53
- const t = globalThis;
54
- t.__mdIconLoaded || (await import("@material/web/icon/icon.js"), t.__mdIconLoaded = !0);
55
- }
56
- async updateIconSlot() {
52
+ updateIconSlot() {
57
53
  const t = this.querySelector('md-icon[slot="icon"]');
58
54
  if (!this._icon) {
59
55
  t == null || t.remove();
60
56
  return;
61
57
  }
62
- if (await this.ensureMdIconLoaded(), t)
58
+ if (t)
63
59
  t.textContent = this._icon;
64
60
  else {
65
61
  const e = document.createElement("md-icon");
@@ -67,9 +63,9 @@ let i = class extends d {
67
63
  }
68
64
  }
69
65
  };
70
- i.styles = [
71
- ...d.styles,
72
- u`
66
+ o.styles = [
67
+ ...p.styles,
68
+ h`
73
69
  /* Icon-only: dölj textslot */
74
70
  :host([icon-only]) slot:not([name='icon']) {
75
71
  display: none;
@@ -77,17 +73,17 @@ i.styles = [
77
73
  `
78
74
  ];
79
75
  s([
80
- l({ type: String })
81
- ], i.prototype, "icon", 1);
76
+ a({ type: String })
77
+ ], o.prototype, "icon", 1);
82
78
  s([
83
- l({ type: Boolean, reflect: !0, attribute: "icon-only" })
84
- ], i.prototype, "iconOnly", 2);
79
+ a({ type: Boolean, reflect: !0, attribute: "icon-only" })
80
+ ], o.prototype, "iconOnly", 2);
85
81
  s([
86
- l({ type: Boolean, reflect: !0, attribute: "inline-icon" })
87
- ], i.prototype, "inlineIcon", 2);
88
- i = s([
89
- p("scb-primary-tab")
90
- ], i);
82
+ a({ type: Boolean, reflect: !0, attribute: "inline-icon" })
83
+ ], o.prototype, "inlineIcon", 2);
84
+ o = s([
85
+ u("scb-primary-tab")
86
+ ], o);
91
87
  export {
92
- i as ScbPrimaryTab
88
+ o as ScbPrimaryTab
93
89
  };
@@ -11,6 +11,5 @@ export declare class ScbSecondaryTab extends MdSecondaryTab {
11
11
  protected updated(): void;
12
12
  private _onActivate;
13
13
  static styles: import('lit').CSSResultOrNative[];
14
- private ensureMdIconLoaded;
15
14
  private updateIconSlot;
16
15
  }
@@ -1,19 +1,20 @@
1
1
  import { MdSecondaryTab as l } from "@material/web/tabs/secondary-tab.js";
2
- import { property as d, customElement as h } from "lit/decorators.js";
3
- import { css as p } from "lit";
4
- var u = Object.defineProperty, b = Object.getOwnPropertyDescriptor, a = (t, e, i, s) => {
5
- for (var o = s > 1 ? void 0 : s ? b(e, i) : e, c = t.length - 1, r; c >= 0; c--)
6
- (r = t[c]) && (o = (s ? r(e, i, o) : r(o)) || o);
7
- return s && o && u(e, i, o), o;
2
+ import { property as p, customElement as h } from "lit/decorators.js";
3
+ import { css as u } from "lit";
4
+ import "@material/web/icon/icon.js";
5
+ var d = Object.defineProperty, b = Object.getOwnPropertyDescriptor, a = (e, t, i, s) => {
6
+ for (var o = s > 1 ? void 0 : s ? b(t, i) : t, r = e.length - 1, c; r >= 0; r--)
7
+ (c = e[r]) && (o = (s ? c(t, i, o) : c(o)) || o);
8
+ return s && o && d(t, i, o), o;
8
9
  };
9
10
  let n = class extends l {
10
11
  constructor() {
11
12
  super(...arguments), this.iconOnly = !1, this._onActivate = () => {
12
- var e;
13
- const t = ((e = this.textContent) == null ? void 0 : e.trim()) ?? "";
13
+ var t;
14
+ const e = ((t = this.textContent) == null ? void 0 : t.trim()) ?? "";
14
15
  this.dispatchEvent(
15
16
  new CustomEvent("activate", {
16
- detail: { label: t },
17
+ detail: { label: e },
17
18
  bubbles: !0,
18
19
  composed: !0
19
20
  })
@@ -27,19 +28,19 @@ let n = class extends l {
27
28
  get icon() {
28
29
  return this._icon;
29
30
  }
30
- set icon(t) {
31
- const e = this._icon;
32
- e !== t && (this._icon = t, this.requestUpdate("icon", e), this.updateIconSlot());
31
+ set icon(e) {
32
+ const t = this._icon;
33
+ t !== e && (this._icon = e, this.requestUpdate("icon", t), this.updateIconSlot());
33
34
  }
34
35
  /*
35
- Efter första render:
36
+ Efter första uppdatering:
36
37
  - Sätt fallback aria-label om iconOnly används utan egen label.
37
38
  - Fånga click och dispatcha ett 'activate'-event med detail.label.
38
39
  */
39
- firstUpdated(t) {
40
- var e;
41
- if (super.firstUpdated(t), this.iconOnly && !this.hasAttribute("aria-label")) {
42
- const i = ((e = this.textContent) == null ? void 0 : e.trim()) ?? "";
40
+ firstUpdated(e) {
41
+ var t;
42
+ if (super.firstUpdated(e), this.iconOnly && !this.hasAttribute("aria-label")) {
43
+ const i = ((t = this.textContent) == null ? void 0 : t.trim()) ?? "";
43
44
  i && this.setAttribute("aria-label", i);
44
45
  }
45
46
  this.addEventListener("click", this._onActivate), this._icon && this.updateIconSlot();
@@ -49,34 +50,29 @@ let n = class extends l {
49
50
  - Hanterar fallback aria-label för icon-only.
50
51
  */
51
52
  updated() {
52
- var t;
53
+ var e;
53
54
  if (super.updated(), this.iconOnly && !this.hasAttribute("aria-label")) {
54
- const e = ((t = this.textContent) == null ? void 0 : t.trim()) ?? "";
55
- e && this.setAttribute("aria-label", e);
55
+ const t = ((e = this.textContent) == null ? void 0 : e.trim()) ?? "";
56
+ t && this.setAttribute("aria-label", t);
56
57
  }
57
58
  }
58
- // Lazy import av md-icon – laddas EN gång globalt
59
- async ensureMdIconLoaded() {
60
- const t = globalThis;
61
- t.__mdIconLoaded || (await import("@material/web/icon/icon.js"), t.__mdIconLoaded = !0);
62
- }
63
- async updateIconSlot() {
64
- const t = this.querySelector('md-icon[slot="icon"]');
59
+ updateIconSlot() {
60
+ const e = this.querySelector('md-icon[slot="icon"]');
65
61
  if (!this._icon) {
66
- t == null || t.remove();
62
+ e == null || e.remove();
67
63
  return;
68
64
  }
69
- if (await this.ensureMdIconLoaded(), t)
70
- t.textContent = this._icon;
65
+ if (e)
66
+ e.textContent = this._icon;
71
67
  else {
72
- const e = document.createElement("md-icon");
73
- e.setAttribute("slot", "icon"), e.textContent = this._icon, this.appendChild(e);
68
+ const t = document.createElement("md-icon");
69
+ t.setAttribute("slot", "icon"), t.textContent = this._icon, this.appendChild(t);
74
70
  }
75
71
  }
76
72
  };
77
73
  n.styles = [
78
74
  ...l.styles,
79
- p`
75
+ u`
80
76
  /* Icon-only: göm all text utom slot="icon" */
81
77
  :host([icon-only]) slot:not([name='icon']) {
82
78
  display: none;
@@ -84,10 +80,10 @@ n.styles = [
84
80
  `
85
81
  ];
86
82
  a([
87
- d({ type: String })
83
+ p({ type: String })
88
84
  ], n.prototype, "icon", 1);
89
85
  a([
90
- d({ type: Boolean, reflect: !0, attribute: "icon-only" })
86
+ p({ type: Boolean, reflect: !0, attribute: "icon-only" })
91
87
  ], n.prototype, "iconOnly", 2);
92
88
  n = a([
93
89
  h("scb-secondary-tab")
@@ -1,9 +1,4 @@
1
1
  import { LitElement, TemplateResult, PropertyValues } from 'lit';
2
- declare global {
3
- interface Window {
4
- __scb_md_icon_loaded?: boolean;
5
- }
6
- }
7
2
  export declare class ScbTextField extends LitElement {
8
3
  type: 'number' | 'email' | 'password' | 'search' | 'tel' | 'text' | 'url' | 'textarea' | 'color' | 'date' | 'datetime-local' | 'file' | 'month' | 'time' | 'week';
9
4
  label: string;
@@ -36,7 +31,6 @@ export declare class ScbTextField extends LitElement {
36
31
  * Kallar på reportValidity på den inbyggda input/textarea och sätter felstatus till error-text.
37
32
  */
38
33
  reportValidity(): boolean;
39
- private __ensureMdIconLoaded;
40
34
  }
41
35
  declare global {
42
36
  interface HTMLElementTagNameMap {
@@ -1,16 +1,17 @@
1
- import { LitElement as h, html as d, css as p } from "lit";
1
+ import { css as h, LitElement as p, html as d } from "lit";
2
2
  import { property as a, customElement as u } from "lit/decorators.js";
3
- var b = Object.defineProperty, m = Object.getOwnPropertyDescriptor, s = (e, t, r, l) => {
4
- for (var o = l > 1 ? void 0 : l ? m(t, r) : t, n = e.length - 1, c; n >= 0; n--)
5
- (c = e[n]) && (o = (l ? c(t, r, o) : c(o)) || o);
6
- return l && o && b(t, r, o), o;
3
+ import "@material/web/icon/icon.js";
4
+ var b = Object.defineProperty, m = Object.getOwnPropertyDescriptor, s = (t, e, r, l) => {
5
+ for (var o = l > 1 ? void 0 : l ? m(e, r) : e, n = t.length - 1, c; n >= 0; n--)
6
+ (c = t[n]) && (o = (l ? c(e, r, o) : c(o)) || o);
7
+ return l && o && b(e, r, o), o;
7
8
  };
8
- let i = class extends h {
9
+ let i = class extends p {
9
10
  constructor() {
10
11
  super(...arguments), this.type = "text", this.label = "", this.supportingText = "", this.errorText = "", this.leadingIcon = "", this.name = "", this.pattern = "", this.value = "", this.underLabel = "", this.error = !1, this.disabled = !1, this.required = !1, this._form = null, this._formSubmitHandler = null, this._formResetHandler = null, this._initialValue = "", this._inputId = "";
11
12
  }
12
13
  render() {
13
- const e = this.leadingIcon ? d`<md-icon class="scb-textfield-icon">${this.leadingIcon}</md-icon>` : null, t = this.error ? d`<md-icon class="scb-textfield-error-icon" aria-hidden="true">error</md-icon>` : null;
14
+ const t = this.leadingIcon ? d`<md-icon class="scb-textfield-icon">${this.leadingIcon}</md-icon>` : null, e = this.error ? d`<md-icon class="scb-textfield-error-icon" aria-hidden="true">error</md-icon>` : null;
14
15
  this.underLabel = this.error ? this.errorText || "Ogiltig inmatning." : this.supportingText, this.value = this.value || "";
15
16
  const r = this.underLabel ? `${this._inputId}-supporting-text` : void 0;
16
17
  return this.type === "textarea" ? d`
@@ -34,10 +35,10 @@ let i = class extends h {
34
35
  <label class="scb-textfield-label" for="${this._inputId}">${this.label}</label>
35
36
  <span
36
37
  class="scb-textfield-supporting-text"
37
- id="${this.underLabel ? `${this._inputId}-supporting-text` : ""}"
38
- >${this.underLabel}</span>
38
+ id="${this.underLabel ? `${this._inputId}-supporting-text` : ""}
39
+ ">${this.underLabel}</span>
39
40
  <div class="scb-textfield-wrapper">
40
- ${e}
41
+ ${t}
41
42
  <input
42
43
  class="scb-textfield${this.error ? " has-error-icon" : ""}"
43
44
  .value=${this.value}
@@ -49,7 +50,7 @@ let i = class extends h {
49
50
  aria-invalid=${this.error ? "true" : "false"}
50
51
  aria-describedby=${r}
51
52
  />
52
- ${t}
53
+ ${e}
53
54
  </div>
54
55
  `;
55
56
  }
@@ -57,12 +58,12 @@ let i = class extends h {
57
58
  Vi re-dispatchar inbyggda "input", "change" och "select" events med { bubbles: true, composed: true },
58
59
  så att konsumenter kan lyssna på events direkt från scb-text-field. Vi kör också ett customevent onValueChanged.
59
60
  */
60
- firstUpdated(e) {
61
+ firstUpdated(t) {
61
62
  var r;
62
- super.firstUpdated(e), this._initialValue = this.value, (this.leadingIcon || this.error) && this.__ensureMdIconLoaded();
63
- const t = (r = this.shadowRoot) == null ? void 0 : r.querySelector(".scb-textfield");
64
- t && (t.addEventListener("input", (l) => {
65
- const o = t;
63
+ super.firstUpdated(t), this._initialValue = this.value;
64
+ const e = (r = this.shadowRoot) == null ? void 0 : r.querySelector(".scb-textfield");
65
+ e && (e.addEventListener("input", (l) => {
66
+ const o = e;
66
67
  if (this.value = o.value, this.pattern) {
67
68
  const n = new RegExp(this.pattern);
68
69
  this.error = !n.test(this.value);
@@ -72,25 +73,25 @@ let i = class extends h {
72
73
  bubbles: !0,
73
74
  composed: !0
74
75
  }));
75
- }), t.addEventListener("change", (l) => {
76
+ }), e.addEventListener("change", (l) => {
76
77
  this.dispatchEvent(new Event("change", { bubbles: !0, composed: !0 }));
77
- }), t.addEventListener("select", (l) => {
78
+ }), e.addEventListener("select", (l) => {
78
79
  this.dispatchEvent(new Event("select", { bubbles: !0, composed: !0 }));
79
80
  }));
80
81
  }
81
82
  /* Reagera på ändringar som kan kräva att md-icon laddas in (leadingIcon / error) */
82
- updated(e) {
83
- super.updated(e), (e.has("leadingIcon") || e.has("error")) && (this.leadingIcon && this.leadingIcon.trim() || this.error) && this.__ensureMdIconLoaded(), this.toggleAttribute("aria-disabled", this.disabled);
83
+ updated(t) {
84
+ super.updated(t), this.toggleAttribute("aria-disabled", this.disabled);
84
85
  }
85
86
  // Om scb-textfield är inuti ett formulär
86
87
  connectedCallback() {
87
- super.connectedCallback(), this._inputId = this.id || `scb-textfield-${Math.random().toString(36).substr(2, 9)}`, this._formSubmitHandler = (e) => {
88
- this.reportValidity() || (e.preventDefault(), e.stopPropagation());
88
+ super.connectedCallback(), this._inputId = this.id || `scb-textfield-${Math.random().toString(36).substr(2, 9)}`, this._formSubmitHandler = (t) => {
89
+ this.reportValidity() || (t.preventDefault(), t.stopPropagation());
89
90
  }, this._form = this.closest("form"), this._form && (this._form.addEventListener("submit", this._formSubmitHandler, !0), this._formResetHandler = () => {
90
- var t;
91
+ var e;
91
92
  this.value = this._initialValue;
92
- const e = (t = this.shadowRoot) == null ? void 0 : t.querySelector(".scb-textfield");
93
- e && (e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement) && (e.value = this._initialValue), this.error = !1;
93
+ const t = (e = this.shadowRoot) == null ? void 0 : e.querySelector(".scb-textfield");
94
+ t && (t instanceof HTMLInputElement || t instanceof HTMLTextAreaElement) && (t.value = this._initialValue), this.error = !1;
94
95
  }, this._form.addEventListener("reset", this._formResetHandler, !0));
95
96
  }
96
97
  disconnectedCallback() {
@@ -100,24 +101,18 @@ let i = class extends h {
100
101
  * Kallar på reportValidity på den inbyggda input/textarea och sätter felstatus till error-text.
101
102
  */
102
103
  reportValidity() {
103
- var t;
104
- const e = (t = this.shadowRoot) == null ? void 0 : t.querySelector(".scb-textfield");
105
- if (e && (e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement)) {
106
- this.required && !e.value ? e.setCustomValidity(this.errorText || "Ogiltig inmatning.") : e.setCustomValidity("");
107
- const r = e.reportValidity();
108
- return this.error = !r, r || (this.errorText = this.errorText || e.validationMessage || "Ogiltig inmatning."), r;
104
+ var e;
105
+ const t = (e = this.shadowRoot) == null ? void 0 : e.querySelector(".scb-textfield");
106
+ if (t && (t instanceof HTMLInputElement || t instanceof HTMLTextAreaElement)) {
107
+ this.required && !t.value ? t.setCustomValidity(this.errorText || "Ogiltig inmatning.") : t.setCustomValidity("");
108
+ const r = t.reportValidity();
109
+ return this.error = !r, r || (this.errorText = this.errorText || t.validationMessage || "Ogiltig inmatning."), r;
109
110
  }
110
111
  return !0;
111
112
  }
112
- /*
113
- Lazy-loader för md-icon
114
- */
115
- async __ensureMdIconLoaded() {
116
- window.__scb_md_icon_loaded || (await import("@material/web/icon/icon.js"), window.__scb_md_icon_loaded = !0);
117
- }
118
113
  };
119
114
  i.styles = [
120
- p`
115
+ h`
121
116
  :host{
122
117
  --scb-textfield-number-max-width:280px;
123
118
  --scb-textfield-text-max-width:400px;
@@ -200,7 +195,7 @@ i.styles = [
200
195
  box-sizing: border-box;
201
196
  }
202
197
  md-icon + .scb-textfield {
203
- padding-left: var(--spacing-10); /* Extra padding for search icon */
198
+ padding-left: var(--spacing-10); /* Extra padding för search icon */
204
199
  }
205
200
  .scb-textfield-icon {
206
201
  position: absolute;