scb-wc-test 0.1.10 → 0.1.11

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.
@@ -1,5 +1,5 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../../vendor/vendor-material.js","../../vendor/vendor.js"])))=>i.map(i=>d[i]);
2
- import{_ as p}from"../../vendor/preload-helper.js";import{i as u,x as c,b as h,n as o,t as b}from"../../vendor/vendor.js";(function(){try{var e=typeof globalThis<"u"?globalThis:window;if(!e.__scb_ce_guard_installed__){e.__scb_ce_guard_installed__=!0;var t=customElements.define.bind(customElements);customElements.define=function(r,a,n){try{customElements.get(r)||t(r,a,n)}catch(d){var l=String(d||"");if(l.indexOf("already been used")===-1&&l.indexOf("NotSupportedError")===-1)throw d}}}}catch{}})();var f=Object.defineProperty,m=Object.getOwnPropertyDescriptor,s=(e,t,r,a)=>{for(var n=a>1?void 0:a?m(t,r):t,l=e.length-1,d;l>=0;l--)(d=e[l])&&(n=(a?d(t,r,n):d(n))||n);return a&&n&&f(t,r,n),n};let i=class extends u{constructor(){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=""}render(){const e=this.leadingIcon?c`<md-icon class="scb-textfield-icon">${this.leadingIcon}</md-icon>`:null,t=this.error?c`<md-icon class="scb-textfield-error-icon" aria-hidden="true">error</md-icon>`:null;this.underLabel=this.error?this.errorText||"Ogiltig inmatning.":this.supportingText,this.value=this.value||"";const r=this.underLabel?`${this._inputId}-supporting-text`:void 0;return this.type==="textarea"?c`
2
+ import{_ as h}from"../../vendor/preload-helper.js";import{i as p,x as c,b as u,n as a,t as b}from"../../vendor/vendor.js";(function(){try{var e=typeof globalThis<"u"?globalThis:window;if(!e.__scb_ce_guard_installed__){e.__scb_ce_guard_installed__=!0;var t=customElements.define.bind(customElements);customElements.define=function(r,l,o){try{customElements.get(r)||t(r,l,o)}catch(d){var n=String(d||"");if(n.indexOf("already been used")===-1&&n.indexOf("NotSupportedError")===-1)throw d}}}}catch{}})();var m=Object.defineProperty,f=Object.getOwnPropertyDescriptor,s=(e,t,r,l)=>{for(var o=l>1?void 0:l?f(t,r):t,n=e.length-1,d;n>=0;n--)(d=e[n])&&(o=(l?d(t,r,o):d(o))||o);return l&&o&&m(t,r,o),o};let i=class extends p{constructor(){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=""}render(){const e=this.leadingIcon?c`<md-icon class="scb-textfield-icon">${this.leadingIcon}</md-icon>`:null,t=this.error?c`<md-icon class="scb-textfield-error-icon" aria-hidden="true">error</md-icon>`:null;this.underLabel=this.error?this.errorText||"Ogiltig inmatning.":this.supportingText,this.value=this.value||"";const r=this.underLabel?`${this._inputId}-supporting-text`:void 0;return this.type==="textarea"?c`
3
3
  <label class="scb-textfield-label" for="${this._inputId}">${this.label}</label>
4
4
  <span
5
5
  class="scb-textfield-supporting-text"
@@ -37,11 +37,46 @@ import{_ as p}from"../../vendor/preload-helper.js";import{i as u,x as c,b as h,n
37
37
  />
38
38
  ${t}
39
39
  </div>
40
- `}firstUpdated(e){super.firstUpdated(e),this._initialValue=this.value,(this.leadingIcon||this.error)&&this.__ensureMdIconLoaded();const t=this.shadowRoot?.querySelector(".scb-textfield");t&&(t.addEventListener("input",r=>{const a=t;if(this.value=a.value,this.pattern){const n=new RegExp(this.pattern);this.error=!n.test(this.value)}this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("onValueChanged",{detail:{value:this.value},bubbles:!0,composed:!0}))}),t.addEventListener("change",r=>{this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}),t.addEventListener("select",r=>{this.dispatchEvent(new Event("select",{bubbles:!0,composed:!0}))}))}updated(e){super.updated(e),(e.has("leadingIcon")||e.has("error"))&&(this.leadingIcon&&this.leadingIcon.trim()||this.error)&&this.__ensureMdIconLoaded(),this.toggleAttribute("aria-disabled",this.disabled)}connectedCallback(){super.connectedCallback(),this._inputId=this.id||`scb-textfield-${Math.random().toString(36).substr(2,9)}`,this._formSubmitHandler=e=>{this.reportValidity()||(e.preventDefault(),e.stopPropagation())},this._form=this.closest("form"),this._form&&(this._form.addEventListener("submit",this._formSubmitHandler,!0),this._formResetHandler=()=>{this.value=this._initialValue;const e=this.shadowRoot?.querySelector(".scb-textfield");e&&(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)&&(e.value=this._initialValue),this.error=!1},this._form.addEventListener("reset",this._formResetHandler,!0))}disconnectedCallback(){super.disconnectedCallback(),this._form&&this._formSubmitHandler&&(this._form.removeEventListener("submit",this._formSubmitHandler,!0),this._formResetHandler&&this._form.removeEventListener("reset",this._formResetHandler,!0))}reportValidity(){const e=this.shadowRoot?.querySelector(".scb-textfield");if(e&&(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)){this.required&&!e.value?e.setCustomValidity(this.errorText||"Ogiltig inmatning."):e.setCustomValidity("");const t=e.reportValidity();return this.error=!t,t||(this.errorText=this.errorText||e.validationMessage||"Ogiltig inmatning."),t}return!0}async __ensureMdIconLoaded(){window.__scb_md_icon_loaded||(await p(()=>import("../../vendor/vendor-material.js").then(e=>e.i),__vite__mapDeps([0,1]),import.meta.url),window.__scb_md_icon_loaded=!0)}};i.styles=[h`
40
+ `}firstUpdated(e){super.firstUpdated(e),this._initialValue=this.value,(this.leadingIcon||this.error)&&this.__ensureMdIconLoaded();const t=this.shadowRoot?.querySelector(".scb-textfield");t&&(t.addEventListener("input",r=>{const l=t;if(this.value=l.value,this.pattern){const o=new RegExp(this.pattern);this.error=!o.test(this.value)}this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("onValueChanged",{detail:{value:this.value},bubbles:!0,composed:!0}))}),t.addEventListener("change",r=>{this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}),t.addEventListener("select",r=>{this.dispatchEvent(new Event("select",{bubbles:!0,composed:!0}))}))}updated(e){super.updated(e),(e.has("leadingIcon")||e.has("error"))&&(this.leadingIcon&&this.leadingIcon.trim()||this.error)&&this.__ensureMdIconLoaded(),this.toggleAttribute("aria-disabled",this.disabled)}connectedCallback(){super.connectedCallback(),this._inputId=this.id||`scb-textfield-${Math.random().toString(36).substr(2,9)}`,this._formSubmitHandler=e=>{this.reportValidity()||(e.preventDefault(),e.stopPropagation())},this._form=this.closest("form"),this._form&&(this._form.addEventListener("submit",this._formSubmitHandler,!0),this._formResetHandler=()=>{this.value=this._initialValue;const e=this.shadowRoot?.querySelector(".scb-textfield");e&&(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)&&(e.value=this._initialValue),this.error=!1},this._form.addEventListener("reset",this._formResetHandler,!0))}disconnectedCallback(){super.disconnectedCallback(),this._form&&this._formSubmitHandler&&(this._form.removeEventListener("submit",this._formSubmitHandler,!0),this._formResetHandler&&this._form.removeEventListener("reset",this._formResetHandler,!0))}reportValidity(){const e=this.shadowRoot?.querySelector(".scb-textfield");if(e&&(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)){this.required&&!e.value?e.setCustomValidity(this.errorText||"Ogiltig inmatning."):e.setCustomValidity("");const t=e.reportValidity();return this.error=!t,t||(this.errorText=this.errorText||e.validationMessage||"Ogiltig inmatning."),t}return!0}async __ensureMdIconLoaded(){window.__scb_md_icon_loaded||(await h(()=>import("../../vendor/vendor-material.js").then(e=>e.i),__vite__mapDeps([0,1]),import.meta.url),window.__scb_md_icon_loaded=!0)}};i.styles=[u`
41
+ :host{
42
+ --scb-textfield-number-max-width:280px;
43
+ --scb-textfield-text-max-width:400px;
44
+ --scb-textfield-search-max-width:600px;
45
+ --scb-textfield-email-max-width:400px;
46
+ --scb-textfield-password-max-width:400px;
47
+ --scb-textfield-tel-max-width:400px;
48
+ --scb-textfield-url-max-width:400px;
49
+ --scb-textfield-textarea-max-width:600px;
50
+ }
51
+ :host([type="number"]) {
52
+ --scb-textfield-max-width: var(--scb-textfield-number-max-width);
53
+ }
54
+ :host([type="text"]) {
55
+ --scb-textfield-max-width: var(--scb-textfield-text-max-width);
56
+ }
57
+ :host([type="search"]) {
58
+ --scb-textfield-max-width: var(--scb-textfield-search-max-width);
59
+ }
60
+ :host([type="email"]) {
61
+ --scb-textfield-max-width: var(--scb-textfield-email-max-width);
62
+ }
63
+ :host([type="password"]) {
64
+ --scb-textfield-max-width: var(--scb-textfield-password-max-width);
65
+ }
66
+ :host([type="tel"]) {
67
+ --scb-textfield-max-width: var(--scb-textfield-tel-max-width);
68
+ }
69
+ :host([type="url"]) {
70
+ --scb-textfield-max-width: var(--scb-textfield-url-max-width);
71
+ }
72
+ :host([type="textarea"]) {
73
+ --scb-textfield-max-width: var(--scb-textfield-textarea-max-width);
74
+ }
75
+
41
76
  :host {
42
77
  display: flex;
43
78
  flex-direction: column;
44
- max-width: 280px;
79
+ max-width: var(--scb-textfield-max-width);
45
80
  /* Följ aktuellt tema (light/dark) via tokens */
46
81
  color: var(--md-sys-color-on-surface);
47
82
  }
@@ -60,37 +95,39 @@ import{_ as p}from"../../vendor/preload-helper.js";import{i as u,x as c,b as h,n
60
95
  cursor: default;
61
96
  }
62
97
  .scb-textfield-label {
63
- font-size: 16px;
64
- line-height: 20px;
65
- font-weight: 600;
98
+ font-size: var(--md-sys-typescale-label-medium-size);
99
+ font-weight: var(--weight-semibold);
100
+ line-height: var(--md-sys-typescale-label-medium-line-height);
101
+ letter-spacing: var(--md-sys-typescale-label-medium-tracking);
66
102
  }
67
103
  .scb-textfield-supporting-text {
68
- font-size: 16px;
69
- line-height: 24px;
70
- margin-bottom: 8px;
104
+ font-size: var(--md-sys-typescale-body-medium-size);
105
+ line-height: var(--md-sys-typescale-body-medium-line-height); /* 150% */
106
+ letter-spacing: var(--md-sys-typescale-body-medium-tracking);
107
+ margin-bottom: var(--spacing-3);
71
108
  color: var(--md-sys-color-on-surface-variant);
72
109
  }
73
110
  .scb-textfield {
74
- padding: 4px 16px;
111
+ padding: var(--spacing-2) var(--spacing-5);
75
112
  min-height: 56px;
76
113
  border: 1px solid var(--md-sys-color-outline);
77
- border-radius: 8px;
78
- font-size: var(--md-sys-typescale-body-large-size, 16px);
114
+ border-radius: var(--md-sys-shape-corner-small);
115
+ font-size: var(--md-sys-typescale-body-large-size);
79
116
  font-family: var(--brand-font);
80
- line-height: 24px;
117
+ line-height: var(--md-sys-typescale-body-large-line-height);
81
118
  width: 100%;
82
119
  box-sizing: border-box;
83
120
  }
84
121
  md-icon + .scb-textfield {
85
- padding-left: 48px; /* Extra padding for search icon */
122
+ padding-left: var(--spacing-10); /* Extra padding for search icon */
86
123
  }
87
124
  .scb-textfield-icon {
88
125
  position: absolute;
89
- left: 12px;
126
+ left: var(--spacing-4);
90
127
  top: 50%;
91
128
  transform: translateY(-50%);
92
129
  pointer-events: none;
93
- font-size: 24px;
130
+ font-size: var(--scale-06);
94
131
  }
95
132
  .scb-textfield:focus-visible {
96
133
  /* Remove outline */
@@ -106,8 +143,8 @@ import{_ as p}from"../../vendor/preload-helper.js";import{i as u,x as c,b as h,n
106
143
  }
107
144
  input::-webkit-search-cancel-button {
108
145
  appearance: none;
109
- height: 24px;
110
- width: 24px;
146
+ height: var(--icon-size-small);
147
+ width: var(--icon-size-small);
111
148
  background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" fill="none" stroke="black" stroke-width="2" viewBox="0 0 24 24"><circle cx="12" cy="12" r="10" stroke="black" stroke-width="2"/><line x1="15" y1="9" x2="9" y2="15" stroke="black" stroke-width="2"/><line x1="9" y1="9" x2="15" y2="15" stroke="black" stroke-width="2"/></svg>') no-repeat center center;
112
149
  background-size: 22px 22px;
113
150
  cursor: pointer;
@@ -122,14 +159,14 @@ import{_ as p}from"../../vendor/preload-helper.js";import{i as u,x as c,b as h,n
122
159
  }
123
160
  .scb-textfield-error-icon {
124
161
  position: absolute;
125
- right: 12px;
162
+ right: var(--spacing-4);
126
163
  top: 50%;
127
164
  transform: translateY(-50%);
128
165
  color: var(--md-sys-color-error);
129
- font-size: 24px;
166
+ font-size: var(--scale-06);
130
167
  pointer-events: none;
131
168
  }
132
169
  .scb-textfield.has-error-icon {
133
170
  padding-right: 44px; /* Adjust as needed for icon size and spacing */
134
171
  }
135
- `];s([o({type:String,reflect:!0})],i.prototype,"type",2);s([o({type:String})],i.prototype,"label",2);s([o({type:String,attribute:"supporting-text"})],i.prototype,"supportingText",2);s([o({type:String,attribute:"error-text"})],i.prototype,"errorText",2);s([o({type:String,attribute:"leading-icon"})],i.prototype,"leadingIcon",2);s([o({type:String})],i.prototype,"name",2);s([o({type:String})],i.prototype,"pattern",2);s([o({type:String,attribute:"value"})],i.prototype,"value",2);s([o({type:String})],i.prototype,"underLabel",2);s([o({type:Boolean,reflect:!0})],i.prototype,"error",2);s([o({type:Boolean,reflect:!0})],i.prototype,"disabled",2);s([o({type:Boolean,reflect:!0})],i.prototype,"required",2);i=s([b("scb-textfield")],i);export{i as ScbTextField2};
172
+ `];s([a({type:String,reflect:!0})],i.prototype,"type",2);s([a({type:String})],i.prototype,"label",2);s([a({type:String,attribute:"supporting-text"})],i.prototype,"supportingText",2);s([a({type:String,attribute:"error-text"})],i.prototype,"errorText",2);s([a({type:String,attribute:"leading-icon"})],i.prototype,"leadingIcon",2);s([a({type:String})],i.prototype,"name",2);s([a({type:String})],i.prototype,"pattern",2);s([a({type:String,attribute:"value"})],i.prototype,"value",2);s([a({type:String})],i.prototype,"underLabel",2);s([a({type:Boolean,reflect:!0})],i.prototype,"error",2);s([a({type:Boolean,reflect:!0})],i.prototype,"disabled",2);s([a({type:Boolean,reflect:!0})],i.prototype,"required",2);i=s([b("scb-textfield")],i);export{i as ScbTextField2};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "scb-wc-test",
3
- "version": "0.1.10",
3
+ "version": "0.1.11",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "module": "index.js",
@@ -273,5 +273,5 @@
273
273
  },
274
274
  "./mvc/*": "./mvc/*"
275
275
  },
276
- "buildHash": "600BD59D478BABAE95ADC5D059B04C875AD59E8C06BAB4C41FDD821A58729E9B"
276
+ "buildHash": "B9C9B4304D3E76CBAE59EC0AD9F3354616F7306B34134E714C45500E9BB34774"
277
277
  }
@@ -1,18 +1,18 @@
1
- import { LitElement as c, html as d, css as u } from "lit";
2
- import { property as o, customElement as h } from "lit/decorators.js";
3
- var b = Object.defineProperty, f = Object.getOwnPropertyDescriptor, s = (e, t, i, a) => {
4
- for (var n = a > 1 ? void 0 : a ? f(t, i) : t, l = e.length - 1, p; l >= 0; l--)
5
- (p = e[l]) && (n = (a ? p(t, i, n) : p(n)) || n);
6
- return a && n && b(t, i, n), n;
1
+ import { LitElement as h, html as d, css as p } from "lit";
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;
7
7
  };
8
- let r = class extends c {
8
+ let i = class extends h {
9
9
  constructor() {
10
10
  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
11
  }
12
12
  render() {
13
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
14
  this.underLabel = this.error ? this.errorText || "Ogiltig inmatning." : this.supportingText, this.value = this.value || "";
15
- const i = this.underLabel ? `${this._inputId}-supporting-text` : void 0;
15
+ const r = this.underLabel ? `${this._inputId}-supporting-text` : void 0;
16
16
  return this.type === "textarea" ? d`
17
17
  <label class="scb-textfield-label" for="${this._inputId}">${this.label}</label>
18
18
  <span
@@ -27,7 +27,7 @@ let r = class extends c {
27
27
  id="${this._inputId}"
28
28
  ?required=${this.required}
29
29
  aria-invalid=${this.error ? "true" : "false"}
30
- aria-describedby=${i}
30
+ aria-describedby=${r}
31
31
  >${this.value}</textarea>
32
32
  </div>
33
33
  ` : d`
@@ -47,7 +47,7 @@ let r = class extends c {
47
47
  ?disabled=${this.disabled}
48
48
  ?required=${this.required}
49
49
  aria-invalid=${this.error ? "true" : "false"}
50
- aria-describedby=${i}
50
+ aria-describedby=${r}
51
51
  />
52
52
  ${t}
53
53
  </div>
@@ -58,23 +58,23 @@ let r = class extends c {
58
58
  så att konsumenter kan lyssna på events direkt från <scb-text-field>. Vi kör också ett customevent onValueChanged.
59
59
  */
60
60
  firstUpdated(e) {
61
- var i;
61
+ var r;
62
62
  super.firstUpdated(e), this._initialValue = this.value, (this.leadingIcon || this.error) && this.__ensureMdIconLoaded();
63
- const t = (i = this.shadowRoot) == null ? void 0 : i.querySelector(".scb-textfield");
64
- t && (t.addEventListener("input", (a) => {
65
- const n = t;
66
- if (this.value = n.value, this.pattern) {
67
- const l = new RegExp(this.pattern);
68
- this.error = !l.test(this.value);
63
+ const t = (r = this.shadowRoot) == null ? void 0 : r.querySelector(".scb-textfield");
64
+ t && (t.addEventListener("input", (l) => {
65
+ const o = t;
66
+ if (this.value = o.value, this.pattern) {
67
+ const n = new RegExp(this.pattern);
68
+ this.error = !n.test(this.value);
69
69
  }
70
70
  this.dispatchEvent(new Event("input", { bubbles: !0, composed: !0 })), this.dispatchEvent(new CustomEvent("onValueChanged", {
71
71
  detail: { value: this.value },
72
72
  bubbles: !0,
73
73
  composed: !0
74
74
  }));
75
- }), t.addEventListener("change", (a) => {
75
+ }), t.addEventListener("change", (l) => {
76
76
  this.dispatchEvent(new Event("change", { bubbles: !0, composed: !0 }));
77
- }), t.addEventListener("select", (a) => {
77
+ }), t.addEventListener("select", (l) => {
78
78
  this.dispatchEvent(new Event("select", { bubbles: !0, composed: !0 }));
79
79
  }));
80
80
  }
@@ -104,8 +104,8 @@ let r = class extends c {
104
104
  const e = (t = this.shadowRoot) == null ? void 0 : t.querySelector(".scb-textfield");
105
105
  if (e && (e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement)) {
106
106
  this.required && !e.value ? e.setCustomValidity(this.errorText || "Ogiltig inmatning.") : e.setCustomValidity("");
107
- const i = e.reportValidity();
108
- return this.error = !i, i || (this.errorText = this.errorText || e.validationMessage || "Ogiltig inmatning."), i;
107
+ const r = e.reportValidity();
108
+ return this.error = !r, r || (this.errorText = this.errorText || e.validationMessage || "Ogiltig inmatning."), r;
109
109
  }
110
110
  return !0;
111
111
  }
@@ -116,12 +116,47 @@ let r = class extends c {
116
116
  window.__scb_md_icon_loaded || (await import("@material/web/icon/icon.js"), window.__scb_md_icon_loaded = !0);
117
117
  }
118
118
  };
119
- r.styles = [
120
- u`
119
+ i.styles = [
120
+ p`
121
+ :host{
122
+ --scb-textfield-number-max-width:280px;
123
+ --scb-textfield-text-max-width:400px;
124
+ --scb-textfield-search-max-width:600px;
125
+ --scb-textfield-email-max-width:400px;
126
+ --scb-textfield-password-max-width:400px;
127
+ --scb-textfield-tel-max-width:400px;
128
+ --scb-textfield-url-max-width:400px;
129
+ --scb-textfield-textarea-max-width:600px;
130
+ }
131
+ :host([type="number"]) {
132
+ --scb-textfield-max-width: var(--scb-textfield-number-max-width);
133
+ }
134
+ :host([type="text"]) {
135
+ --scb-textfield-max-width: var(--scb-textfield-text-max-width);
136
+ }
137
+ :host([type="search"]) {
138
+ --scb-textfield-max-width: var(--scb-textfield-search-max-width);
139
+ }
140
+ :host([type="email"]) {
141
+ --scb-textfield-max-width: var(--scb-textfield-email-max-width);
142
+ }
143
+ :host([type="password"]) {
144
+ --scb-textfield-max-width: var(--scb-textfield-password-max-width);
145
+ }
146
+ :host([type="tel"]) {
147
+ --scb-textfield-max-width: var(--scb-textfield-tel-max-width);
148
+ }
149
+ :host([type="url"]) {
150
+ --scb-textfield-max-width: var(--scb-textfield-url-max-width);
151
+ }
152
+ :host([type="textarea"]) {
153
+ --scb-textfield-max-width: var(--scb-textfield-textarea-max-width);
154
+ }
155
+
121
156
  :host {
122
157
  display: flex;
123
158
  flex-direction: column;
124
- max-width: 280px;
159
+ max-width: var(--scb-textfield-max-width);
125
160
  /* Följ aktuellt tema (light/dark) via tokens */
126
161
  color: var(--md-sys-color-on-surface);
127
162
  }
@@ -140,37 +175,39 @@ r.styles = [
140
175
  cursor: default;
141
176
  }
142
177
  .scb-textfield-label {
143
- font-size: 16px;
144
- line-height: 20px;
145
- font-weight: 600;
178
+ font-size: var(--md-sys-typescale-label-medium-size);
179
+ font-weight: var(--weight-semibold);
180
+ line-height: var(--md-sys-typescale-label-medium-line-height);
181
+ letter-spacing: var(--md-sys-typescale-label-medium-tracking);
146
182
  }
147
183
  .scb-textfield-supporting-text {
148
- font-size: 16px;
149
- line-height: 24px;
150
- margin-bottom: 8px;
184
+ font-size: var(--md-sys-typescale-body-medium-size);
185
+ line-height: var(--md-sys-typescale-body-medium-line-height); /* 150% */
186
+ letter-spacing: var(--md-sys-typescale-body-medium-tracking);
187
+ margin-bottom: var(--spacing-3);
151
188
  color: var(--md-sys-color-on-surface-variant);
152
189
  }
153
190
  .scb-textfield {
154
- padding: 4px 16px;
191
+ padding: var(--spacing-2) var(--spacing-5);
155
192
  min-height: 56px;
156
193
  border: 1px solid var(--md-sys-color-outline);
157
- border-radius: 8px;
158
- font-size: var(--md-sys-typescale-body-large-size, 16px);
194
+ border-radius: var(--md-sys-shape-corner-small);
195
+ font-size: var(--md-sys-typescale-body-large-size);
159
196
  font-family: var(--brand-font);
160
- line-height: 24px;
197
+ line-height: var(--md-sys-typescale-body-large-line-height);
161
198
  width: 100%;
162
199
  box-sizing: border-box;
163
200
  }
164
201
  md-icon + .scb-textfield {
165
- padding-left: 48px; /* Extra padding for search icon */
202
+ padding-left: var(--spacing-10); /* Extra padding for search icon */
166
203
  }
167
204
  .scb-textfield-icon {
168
205
  position: absolute;
169
- left: 12px;
206
+ left: var(--spacing-4);
170
207
  top: 50%;
171
208
  transform: translateY(-50%);
172
209
  pointer-events: none;
173
- font-size: 24px;
210
+ font-size: var(--scale-06);
174
211
  }
175
212
  .scb-textfield:focus-visible {
176
213
  /* Remove outline */
@@ -186,8 +223,8 @@ r.styles = [
186
223
  }
187
224
  input::-webkit-search-cancel-button {
188
225
  appearance: none;
189
- height: 24px;
190
- width: 24px;
226
+ height: var(--icon-size-small);
227
+ width: var(--icon-size-small);
191
228
  background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" fill="none" stroke="black" stroke-width="2" viewBox="0 0 24 24"><circle cx="12" cy="12" r="10" stroke="black" stroke-width="2"/><line x1="15" y1="9" x2="9" y2="15" stroke="black" stroke-width="2"/><line x1="9" y1="9" x2="15" y2="15" stroke="black" stroke-width="2"/></svg>') no-repeat center center;
192
229
  background-size: 22px 22px;
193
230
  cursor: pointer;
@@ -202,11 +239,11 @@ r.styles = [
202
239
  }
203
240
  .scb-textfield-error-icon {
204
241
  position: absolute;
205
- right: 12px;
242
+ right: var(--spacing-4);
206
243
  top: 50%;
207
244
  transform: translateY(-50%);
208
245
  color: var(--md-sys-color-error);
209
- font-size: 24px;
246
+ font-size: var(--scale-06);
210
247
  pointer-events: none;
211
248
  }
212
249
  .scb-textfield.has-error-icon {
@@ -215,44 +252,44 @@ r.styles = [
215
252
  `
216
253
  ];
217
254
  s([
218
- o({ type: String, reflect: !0 })
219
- ], r.prototype, "type", 2);
255
+ a({ type: String, reflect: !0 })
256
+ ], i.prototype, "type", 2);
220
257
  s([
221
- o({ type: String })
222
- ], r.prototype, "label", 2);
258
+ a({ type: String })
259
+ ], i.prototype, "label", 2);
223
260
  s([
224
- o({ type: String, attribute: "supporting-text" })
225
- ], r.prototype, "supportingText", 2);
261
+ a({ type: String, attribute: "supporting-text" })
262
+ ], i.prototype, "supportingText", 2);
226
263
  s([
227
- o({ type: String, attribute: "error-text" })
228
- ], r.prototype, "errorText", 2);
264
+ a({ type: String, attribute: "error-text" })
265
+ ], i.prototype, "errorText", 2);
229
266
  s([
230
- o({ type: String, attribute: "leading-icon" })
231
- ], r.prototype, "leadingIcon", 2);
267
+ a({ type: String, attribute: "leading-icon" })
268
+ ], i.prototype, "leadingIcon", 2);
232
269
  s([
233
- o({ type: String })
234
- ], r.prototype, "name", 2);
270
+ a({ type: String })
271
+ ], i.prototype, "name", 2);
235
272
  s([
236
- o({ type: String })
237
- ], r.prototype, "pattern", 2);
273
+ a({ type: String })
274
+ ], i.prototype, "pattern", 2);
238
275
  s([
239
- o({ type: String, attribute: "value" })
240
- ], r.prototype, "value", 2);
276
+ a({ type: String, attribute: "value" })
277
+ ], i.prototype, "value", 2);
241
278
  s([
242
- o({ type: String })
243
- ], r.prototype, "underLabel", 2);
279
+ a({ type: String })
280
+ ], i.prototype, "underLabel", 2);
244
281
  s([
245
- o({ type: Boolean, reflect: !0 })
246
- ], r.prototype, "error", 2);
282
+ a({ type: Boolean, reflect: !0 })
283
+ ], i.prototype, "error", 2);
247
284
  s([
248
- o({ type: Boolean, reflect: !0 })
249
- ], r.prototype, "disabled", 2);
285
+ a({ type: Boolean, reflect: !0 })
286
+ ], i.prototype, "disabled", 2);
250
287
  s([
251
- o({ type: Boolean, reflect: !0 })
252
- ], r.prototype, "required", 2);
253
- r = s([
254
- h("scb-textfield")
255
- ], r);
288
+ a({ type: Boolean, reflect: !0 })
289
+ ], i.prototype, "required", 2);
290
+ i = s([
291
+ u("scb-textfield")
292
+ ], i);
256
293
  export {
257
- r as ScbTextField2
294
+ i as ScbTextField2
258
295
  };