scb-wc-test 0.1.108 → 0.1.110
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.
- package/blazor/ScbBlazorInteropBase.cs +313 -12
- package/blazor/scb-blazor-bridge.js +603 -8
- package/mvc/components/scb-datepicker/scb-datepicker.js +55 -33
- package/mvc/components/scb-search/scb-search.js +2 -2
- package/mvc/components/scb-textfield/scb-textfield.js +46 -6
- package/mvc/scb-blazor-bridge.js +603 -8
- package/package.json +2 -2
- package/scb-datepicker/scb-datepicker.d.ts +1 -0
- package/scb-datepicker/scb-datepicker.js +51 -27
- package/scb-search/scb-search.js +2 -2
- package/scb-textfield/scb-textfield.d.ts +4 -0
- package/scb-textfield/scb-textfield.js +89 -34
- package/scb-wc-test.bundle.js +432 -370
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { css as
|
|
1
|
+
import { css as m, LitElement as g, html as n } from "lit";
|
|
2
2
|
import { state as h, property as p, customElement as w } from "lit/decorators.js";
|
|
3
3
|
import "../scb-icon-button/scb-icon-button.js";
|
|
4
4
|
import "../scb-button/scb-button.js";
|
|
@@ -6,14 +6,16 @@ import "@material/web/icon/icon.js";
|
|
|
6
6
|
import "@material/web/ripple/ripple.js";
|
|
7
7
|
import "@material/web/focus/md-focus-ring.js";
|
|
8
8
|
import "../scb-divider/scb-divider.js";
|
|
9
|
-
var v = Object.defineProperty,
|
|
10
|
-
for (var i = l > 1 ? void 0 : l ?
|
|
9
|
+
var v = Object.defineProperty, b = Object.getOwnPropertyDescriptor, d = (e, t, c, l) => {
|
|
10
|
+
for (var i = l > 1 ? void 0 : l ? b(t, c) : t, o = e.length - 1, s; o >= 0; o--)
|
|
11
11
|
(s = e[o]) && (i = (l ? s(t, c, i) : s(i)) || i);
|
|
12
12
|
return l && i && v(t, c, i), i;
|
|
13
13
|
};
|
|
14
|
-
let a = class extends
|
|
14
|
+
let a = class extends g {
|
|
15
15
|
constructor() {
|
|
16
|
-
super(...arguments), this._currentDate = /* @__PURE__ */ new Date(), this._selectedDate = null, this._showMonthDropdown = !1, this._showYearDropdown = !1, this.variant = "static", this.lang = "sv", this.selectedValue = "", this.open = !0, this.
|
|
16
|
+
super(...arguments), this._currentDate = /* @__PURE__ */ new Date(), this._selectedDate = null, this._showMonthDropdown = !1, this._showYearDropdown = !1, this.variant = "static", this.lang = "sv", this.selectedValue = "", this.open = !0, this._outsideClickHandler = (e) => {
|
|
17
|
+
this.variant !== "static" && this.open && (e.composedPath().includes(this) || this._close());
|
|
18
|
+
}, this._monthNames = [
|
|
17
19
|
this.lang == "sv" ? "Januari" : "January",
|
|
18
20
|
this.lang == "sv" ? "Februari" : "February",
|
|
19
21
|
this.lang == "sv" ? "Mars" : "March",
|
|
@@ -42,11 +44,11 @@ let a = class extends m {
|
|
|
42
44
|
this.open = !1, this.dispatchEvent(new CustomEvent("datepicker-closed", {
|
|
43
45
|
bubbles: !0,
|
|
44
46
|
composed: !0
|
|
45
|
-
}));
|
|
47
|
+
})), window.removeEventListener("mousedown", this._outsideClickHandler);
|
|
46
48
|
};
|
|
47
49
|
}
|
|
48
50
|
updated(e) {
|
|
49
|
-
if (super.updated(e), e.has("selectedValue") && this.selectedValue) {
|
|
51
|
+
if (super.updated(e), this.variant !== "static" && this.open ? window.addEventListener("mousedown", this._outsideClickHandler) : window.removeEventListener("mousedown", this._outsideClickHandler), e.has("selectedValue") && this.selectedValue) {
|
|
50
52
|
const t = new Date(this.selectedValue);
|
|
51
53
|
isNaN(t.getTime()) || (this._selectedDate = t, this._currentDate = new Date(t.getFullYear(), t.getMonth(), 1));
|
|
52
54
|
}
|
|
@@ -74,37 +76,43 @@ let a = class extends m {
|
|
|
74
76
|
<div class="month-selector ${this._showMonthDropdown ? "open" : ""} ${this._showYearDropdown ? "disable" : ""}">
|
|
75
77
|
<scb-icon-button icon="chevron_left" @click=${this._prevMonth} aria-label=${this.lang == "sv" ? "Föregående månad" : "Previous month"}></scb-icon-button>
|
|
76
78
|
<div class="custom-dropdown month-dropdown">
|
|
77
|
-
|
|
78
|
-
|
|
79
|
+
<div
|
|
80
|
+
tabindex=${this._showYearDropdown ? -1 : 0}
|
|
81
|
+
class="dropdown-selected"
|
|
82
|
+
@click=${() => this._toggleMonthDropdown()}
|
|
83
|
+
@keydown=${(o) => {
|
|
79
84
|
(o.key === "Enter" || o.key === " ") && (o.preventDefault(), this._toggleMonthDropdown());
|
|
80
85
|
}}
|
|
81
|
-
|
|
86
|
+
>
|
|
82
87
|
${this._monthNames[t].slice(0, 3)}
|
|
83
88
|
<md-icon>arrow_drop_down</md-icon>
|
|
84
89
|
<md-focus-ring></md-focus-ring>
|
|
85
90
|
<md-ripple></md-ripple>
|
|
86
|
-
|
|
91
|
+
</div>
|
|
87
92
|
</div>
|
|
88
93
|
<scb-icon-button icon="chevron_right" @click=${this._nextMonth} aria-label=${this.lang == "sv" ? "Nästa månad" : "Next month"}></scb-icon-button>
|
|
89
94
|
</div>
|
|
90
95
|
<div class="year-selector ${this._showMonthDropdown ? "disable" : ""} ${this._showYearDropdown ? "open" : ""}">
|
|
91
96
|
<scb-icon-button icon="chevron_left" @click=${this._prevYear} aria-label=${this.lang == "sv" ? "Föregående år" : "Previous year"}></scb-icon-button>
|
|
92
97
|
<div class="custom-dropdown year-dropdown">
|
|
93
|
-
<div
|
|
94
|
-
|
|
98
|
+
<div
|
|
99
|
+
tabindex=${this._showMonthDropdown ? -1 : 0}
|
|
100
|
+
class="dropdown-selected"
|
|
101
|
+
@click=${() => this._toggleYearDropdown()}
|
|
102
|
+
@keydown=${(o) => {
|
|
95
103
|
(o.key === "Enter" || o.key === " ") && (o.preventDefault(), this._toggleYearDropdown());
|
|
96
104
|
}}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
105
|
+
>
|
|
106
|
+
${e}
|
|
107
|
+
<md-icon>arrow_drop_down</md-icon>
|
|
108
|
+
<md-focus-ring></md-focus-ring>
|
|
109
|
+
<md-ripple></md-ripple>
|
|
102
110
|
</div>
|
|
103
111
|
</div>
|
|
104
112
|
<scb-icon-button icon="chevron_right" @click=${this._nextYear} aria-label=${this.lang == "sv" ? "Nästa år" : "Next year"}></scb-icon-button>
|
|
105
113
|
</div>
|
|
106
114
|
</div>
|
|
107
|
-
|
|
115
|
+
${this._showMonthDropdown || this._showYearDropdown ? n`<scb-divider></scb-divider>` : ""}
|
|
108
116
|
<div class="datepicker-content" style="position:relative;">
|
|
109
117
|
${this._showMonthDropdown ? n`
|
|
110
118
|
<div class="dropdown-list">
|
|
@@ -176,7 +184,7 @@ let a = class extends m {
|
|
|
176
184
|
` : ""}
|
|
177
185
|
</div>
|
|
178
186
|
<div class="datepicker-footer">
|
|
179
|
-
${!this._showMonthDropdown && !this._showYearDropdown ? n`
|
|
187
|
+
${!this._showMonthDropdown && !this._showYearDropdown && this.variant == "popup" ? n`
|
|
180
188
|
<scb-button variant="text" label=${this.lang == "sv" ? "Stäng" : "Close"} @click=${this._close}></scb-button>
|
|
181
189
|
` : ""}
|
|
182
190
|
</div>
|
|
@@ -220,12 +228,13 @@ let a = class extends m {
|
|
|
220
228
|
}
|
|
221
229
|
};
|
|
222
230
|
a.styles = [
|
|
223
|
-
|
|
231
|
+
m`
|
|
224
232
|
:host {
|
|
225
233
|
--scb-datepicker-width: 380px;
|
|
226
|
-
width: var(--scb-datepicker-width);
|
|
234
|
+
max-width: var(--scb-datepicker-width);
|
|
227
235
|
font-family: var(--brand-font);
|
|
228
236
|
color: var(--md-sys-color-on-surface);
|
|
237
|
+
display: block;
|
|
229
238
|
}
|
|
230
239
|
.month-selector, .year-selector {
|
|
231
240
|
display: flex;
|
|
@@ -297,9 +306,24 @@ a.styles = [
|
|
|
297
306
|
font-family: var(--brand-font);
|
|
298
307
|
}
|
|
299
308
|
.datepicker-content{
|
|
300
|
-
|
|
301
|
-
|
|
309
|
+
overflow-y: auto;
|
|
310
|
+
max-height: 290px;
|
|
302
311
|
}
|
|
312
|
+
.datepicker-content::-webkit-scrollbar {
|
|
313
|
+
width: 12px;
|
|
314
|
+
background: var(--md-sys-color-surface);
|
|
315
|
+
border-radius: var(--md-sys-shape-corner-small);
|
|
316
|
+
}
|
|
317
|
+
.datepicker-content::-webkit-scrollbar-thumb {
|
|
318
|
+
background: var(--md-sys-color-outline);
|
|
319
|
+
border-radius: var(--md-sys-shape-corner-small);
|
|
320
|
+
border: 4px solid var(--md-sys-color-surface);
|
|
321
|
+
|
|
322
|
+
}
|
|
323
|
+
.datepicker-content::-webkit-scrollbar-track {
|
|
324
|
+
background: var(--md-sys-color-surface);
|
|
325
|
+
border-radius: var(--md-sys-shape-corner-small);
|
|
326
|
+
}
|
|
303
327
|
.popup {
|
|
304
328
|
position:absolute;
|
|
305
329
|
top:110%;
|
|
@@ -310,8 +334,8 @@ a.styles = [
|
|
|
310
334
|
display: flex;
|
|
311
335
|
align-items: center;
|
|
312
336
|
justify-content: space-between;
|
|
313
|
-
margin-bottom:
|
|
314
|
-
padding: 16px
|
|
337
|
+
margin-bottom: 30px;
|
|
338
|
+
padding: 20px 16px 0px 16px;
|
|
315
339
|
flex-wrap: wrap;
|
|
316
340
|
}
|
|
317
341
|
.datepicker-footer{
|
|
@@ -333,7 +357,7 @@ a.styles = [
|
|
|
333
357
|
color: var(--md-sys-color-on-surface-variant, #757575);
|
|
334
358
|
font-size: 16px;
|
|
335
359
|
font-weight: 600;
|
|
336
|
-
padding:
|
|
360
|
+
padding-bottom: 20px;
|
|
337
361
|
}
|
|
338
362
|
td {
|
|
339
363
|
text-align: center;
|
package/scb-search/scb-search.js
CHANGED
|
@@ -427,7 +427,7 @@ a.styles = y`
|
|
|
427
427
|
line-height: var(--scb-search-line-height);
|
|
428
428
|
|
|
429
429
|
color: var(--md-sys-color-on-surface);
|
|
430
|
-
background:
|
|
430
|
+
background: transparent;
|
|
431
431
|
|
|
432
432
|
position: relative;
|
|
433
433
|
z-index: 1;
|
|
@@ -473,7 +473,7 @@ a.styles = y`
|
|
|
473
473
|
left: 0;
|
|
474
474
|
width: 100%;
|
|
475
475
|
z-index: 10;
|
|
476
|
-
background: var(--md-sys-color-surface);
|
|
476
|
+
background: var(--md-sys-color-surface-container-lowest);
|
|
477
477
|
border: var(--stroke-border, 1px) solid var(--md-sys-color-outline);
|
|
478
478
|
border-top: 0;
|
|
479
479
|
border-radius: 0 0 var(--scb-search-open-radius) var(--scb-search-open-radius);
|
|
@@ -3,6 +3,10 @@ export declare class ScbTextField extends LitElement {
|
|
|
3
3
|
#private;
|
|
4
4
|
static formAssociated: boolean;
|
|
5
5
|
private _internals;
|
|
6
|
+
private _inputFocused;
|
|
7
|
+
private _kbShouldShowRing;
|
|
8
|
+
private _onGlobalKeydown;
|
|
9
|
+
private _onGlobalPointerDown;
|
|
6
10
|
constructor();
|
|
7
11
|
type: 'number' | 'email' | 'password' | 'search' | 'tel' | 'text' | 'url' | 'textarea' | 'color' | 'date' | 'datetime-local' | 'file' | 'month' | 'time' | 'week';
|
|
8
12
|
label: string;
|
|
@@ -1,17 +1,23 @@
|
|
|
1
|
-
import { css as
|
|
2
|
-
import { property as a, customElement as
|
|
1
|
+
import { css as v, LitElement as x, html as c } from "lit";
|
|
2
|
+
import { property as a, customElement as y } from "lit/decorators.js";
|
|
3
3
|
import "@material/web/icon/icon.js";
|
|
4
4
|
import "../scb-datepicker/scb-datepicker.js";
|
|
5
|
-
|
|
5
|
+
import "@material/web/ripple/ripple.js";
|
|
6
|
+
import "@material/web/focus/md-focus-ring.js";
|
|
7
|
+
var g = Object.defineProperty, w = Object.getOwnPropertyDescriptor, m = (t) => {
|
|
6
8
|
throw TypeError(t);
|
|
7
|
-
}, r = (t, e, i,
|
|
8
|
-
for (var
|
|
9
|
-
(
|
|
10
|
-
return
|
|
11
|
-
}, _ = (t, e, i) => e.has(t) ||
|
|
9
|
+
}, r = (t, e, i, o) => {
|
|
10
|
+
for (var l = o > 1 ? void 0 : o ? w(e, i) : e, u = t.length - 1, b; u >= 0; u--)
|
|
11
|
+
(b = t[u]) && (l = (o ? b(e, i, l) : b(l)) || l);
|
|
12
|
+
return o && l && g(e, i, l), l;
|
|
13
|
+
}, _ = (t, e, i) => e.has(t) || m("Cannot " + i), k = (t, e, i) => e.has(t) ? m("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, i), d = (t, e, i) => (_(t, e, "access private method"), i), n, f, h, p;
|
|
12
14
|
let s = class extends x {
|
|
13
15
|
constructor() {
|
|
14
|
-
super(),
|
|
16
|
+
super(), k(this, n), this._internals = null, this._inputFocused = !1, this._kbShouldShowRing = !1, this._onGlobalKeydown = (t) => {
|
|
17
|
+
t.key === "Tab" && (this._kbShouldShowRing = !0, this._inputFocused && d(this, n, p).call(this));
|
|
18
|
+
}, this._onGlobalPointerDown = () => {
|
|
19
|
+
this._kbShouldShowRing = !1, this._inputFocused && d(this, n, p).call(this);
|
|
20
|
+
}, 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.spacing = "", this.spacingTop = "", this.spacingBottom = "", this._form = null, this._formSubmitHandler = null, this._formResetHandler = null, this._initialValue = "", this._inputId = "", this._showDatepicker = !1, this._toggleDatepicker = () => {
|
|
15
21
|
this._showDatepicker = !this._showDatepicker;
|
|
16
22
|
}, this._onDateSelected = (t) => {
|
|
17
23
|
this.value = t.detail.value, this._showDatepicker = !1, this.dispatchEvent(new Event("input", { bubbles: !0, composed: !0 })), this.dispatchEvent(
|
|
@@ -24,9 +30,9 @@ let s = class extends x {
|
|
|
24
30
|
}, "attachInternals" in this && (this._internals = this.attachInternals());
|
|
25
31
|
}
|
|
26
32
|
render() {
|
|
27
|
-
const t = this.leadingIcon ?
|
|
33
|
+
const t = this.leadingIcon ? c`<md-icon class="scb-textfield-icon">${this.leadingIcon}</md-icon>` : null, e = this.error ? c`<md-icon class="scb-textfield-error-icon" aria-hidden="true">error</md-icon>` : null;
|
|
28
34
|
this.underLabel = this.error ? this.errorText || "Ogiltig inmatning." : this.supportingText, this.value = this.value || "";
|
|
29
|
-
const i = this.underLabel ? `${this._inputId}-supporting-text` : void 0,
|
|
35
|
+
const i = this.underLabel ? `${this._inputId}-supporting-text` : void 0, o = this.type === "search" && this.value ? c`
|
|
30
36
|
<button
|
|
31
37
|
type="button"
|
|
32
38
|
class="scb-textfield-clear"
|
|
@@ -61,14 +67,14 @@ let s = class extends x {
|
|
|
61
67
|
</svg>
|
|
62
68
|
</button>
|
|
63
69
|
` : null;
|
|
64
|
-
return this.type === "textarea" ?
|
|
70
|
+
return this.type === "textarea" ? c`
|
|
65
71
|
<label class="scb-textfield-label" for="${this._inputId}">${this.label}</label>
|
|
66
72
|
<span
|
|
67
73
|
class="scb-textfield-supporting-text"
|
|
68
74
|
id="${this.underLabel ? `${this._inputId}-supporting-text` : ""}"
|
|
69
75
|
>${this.underLabel}</span
|
|
70
76
|
>
|
|
71
|
-
<div class="scb-textfield-wrapper">
|
|
77
|
+
<div class="scb-textfield-wrapper ripple-wrapper">
|
|
72
78
|
<textarea
|
|
73
79
|
class="scb-textfield"
|
|
74
80
|
?disabled=${this.disabled}
|
|
@@ -80,8 +86,10 @@ let s = class extends x {
|
|
|
80
86
|
>
|
|
81
87
|
${this.value}</textarea
|
|
82
88
|
>
|
|
89
|
+
<md-ripple></md-ripple>
|
|
90
|
+
<md-focus-ring class="input-ring"></md-focus-ring>
|
|
83
91
|
</div>
|
|
84
|
-
` : this.type === "date" ?
|
|
92
|
+
` : this.type === "date" ? c`
|
|
85
93
|
<label class="scb-textfield-label" for="${this._inputId}">${this.label}</label>
|
|
86
94
|
<span
|
|
87
95
|
class="scb-textfield-supporting-text"
|
|
@@ -111,14 +119,14 @@ ${this.value}</textarea
|
|
|
111
119
|
></scb-datepicker>
|
|
112
120
|
${e}
|
|
113
121
|
</div>
|
|
114
|
-
` :
|
|
122
|
+
` : c`
|
|
115
123
|
<label class="scb-textfield-label" for="${this._inputId}">${this.label}</label>
|
|
116
124
|
<span
|
|
117
125
|
class="scb-textfield-supporting-text"
|
|
118
126
|
id="${this.underLabel ? `${this._inputId}-supporting-text` : ""}"
|
|
119
127
|
>${this.underLabel}</span
|
|
120
128
|
>
|
|
121
|
-
<div class="scb-textfield-wrapper">
|
|
129
|
+
<div class="scb-textfield-wrapper ripple-wrapper">
|
|
122
130
|
${t}
|
|
123
131
|
<input
|
|
124
132
|
class="scb-textfield${this.error ? " has-error-icon" : ""}"
|
|
@@ -131,8 +139,10 @@ ${this.value}</textarea
|
|
|
131
139
|
aria-invalid=${this.error ? "true" : "false"}
|
|
132
140
|
aria-describedby=${i}
|
|
133
141
|
/>
|
|
134
|
-
${
|
|
142
|
+
${o}
|
|
135
143
|
${e}
|
|
144
|
+
<md-ripple></md-ripple>
|
|
145
|
+
<md-focus-ring class="input-ring"></md-focus-ring>
|
|
136
146
|
</div>
|
|
137
147
|
`;
|
|
138
148
|
}
|
|
@@ -145,14 +155,14 @@ ${this.value}</textarea
|
|
|
145
155
|
super.firstUpdated(t), this._initialValue = this.value;
|
|
146
156
|
const e = (i = this.shadowRoot) == null ? void 0 : i.querySelector(".scb-textfield");
|
|
147
157
|
e && (e.addEventListener("input", () => {
|
|
148
|
-
const
|
|
149
|
-
if (this.value =
|
|
150
|
-
const
|
|
151
|
-
this._internals.setFormValue(
|
|
158
|
+
const o = e;
|
|
159
|
+
if (this.value = o.value, this._internals) {
|
|
160
|
+
const l = this.disabled ? null : this.value;
|
|
161
|
+
this._internals.setFormValue(l);
|
|
152
162
|
}
|
|
153
163
|
if (this.pattern) {
|
|
154
|
-
const
|
|
155
|
-
this.error = !
|
|
164
|
+
const l = new RegExp(this.pattern);
|
|
165
|
+
this.error = !l.test(this.value);
|
|
156
166
|
}
|
|
157
167
|
this.dispatchEvent(new Event("input", { bubbles: !0, composed: !0 })), this.dispatchEvent(
|
|
158
168
|
new CustomEvent("onValueChanged", {
|
|
@@ -165,14 +175,18 @@ ${this.value}</textarea
|
|
|
165
175
|
this.dispatchEvent(new Event("change", { bubbles: !0, composed: !0 }));
|
|
166
176
|
}), e.addEventListener("select", () => {
|
|
167
177
|
this.dispatchEvent(new Event("select", { bubbles: !0, composed: !0 }));
|
|
168
|
-
})
|
|
178
|
+
}), e.addEventListener("focus", () => {
|
|
179
|
+
this._inputFocused = !0, d(this, n, p).call(this);
|
|
180
|
+
}), e.addEventListener("blur", () => {
|
|
181
|
+
this._inputFocused = !1, d(this, n, p).call(this);
|
|
182
|
+
})), d(this, n, f).call(this);
|
|
169
183
|
}
|
|
170
184
|
updated(t) {
|
|
171
185
|
if (super.updated(t), this.toggleAttribute("aria-disabled", this.disabled), this._internals && (t.has("value") || t.has("disabled"))) {
|
|
172
186
|
const e = this.disabled ? null : this.value;
|
|
173
187
|
this._internals.setFormValue(e);
|
|
174
188
|
}
|
|
175
|
-
(t.has("spacing") || t.has("spacingTop") || t.has("spacingBottom")) &&
|
|
189
|
+
(t.has("spacing") || t.has("spacingTop") || t.has("spacingBottom")) && d(this, n, f).call(this);
|
|
176
190
|
}
|
|
177
191
|
// Körs av webbläsaren när formuläret sätter disabled på kontrollen
|
|
178
192
|
formDisabledCallback(t) {
|
|
@@ -187,10 +201,10 @@ ${this.value}</textarea
|
|
|
187
201
|
this.value = this._initialValue;
|
|
188
202
|
const t = (e = this.shadowRoot) == null ? void 0 : e.querySelector(".scb-textfield");
|
|
189
203
|
t && (t instanceof HTMLInputElement || t instanceof HTMLTextAreaElement) && (t.value = this._initialValue), this.error = !1;
|
|
190
|
-
}, this._form.addEventListener("reset", this._formResetHandler, !0));
|
|
204
|
+
}, this._form.addEventListener("reset", this._formResetHandler, !0)), window.addEventListener("keydown", this._onGlobalKeydown, !0), window.addEventListener("pointerdown", this._onGlobalPointerDown, !0);
|
|
191
205
|
}
|
|
192
206
|
disconnectedCallback() {
|
|
193
|
-
super.disconnectedCallback(), this._form && this._formSubmitHandler && (this._form.removeEventListener("submit", this._formSubmitHandler, !0), this._formResetHandler && this._form.removeEventListener("reset", this._formResetHandler, !0));
|
|
207
|
+
super.disconnectedCallback(), this._form && this._formSubmitHandler && (this._form.removeEventListener("submit", this._formSubmitHandler, !0), this._formResetHandler && this._form.removeEventListener("reset", this._formResetHandler, !0)), window.removeEventListener("keydown", this._onGlobalKeydown, !0), window.removeEventListener("pointerdown", this._onGlobalPointerDown, !0);
|
|
194
208
|
}
|
|
195
209
|
/**
|
|
196
210
|
* Kallar på reportValidity på den inbyggda input/textarea och sätter felstatus till error-text.
|
|
@@ -202,8 +216,8 @@ ${this.value}</textarea
|
|
|
202
216
|
this.required && !t.value ? t.setCustomValidity(this.errorText || "Ogiltig inmatning.") : t.setCustomValidity("");
|
|
203
217
|
const i = t.reportValidity();
|
|
204
218
|
this.error = !i;
|
|
205
|
-
const
|
|
206
|
-
return i || (this.errorText =
|
|
219
|
+
const o = i ? "" : this.errorText || t.validationMessage || "Ogiltig inmatning.";
|
|
220
|
+
return i || (this.errorText = o), this._internals && (i ? this._internals.setValidity({}) : this._internals.setValidity({ customError: !0 }, o, t)), i;
|
|
207
221
|
}
|
|
208
222
|
return !0;
|
|
209
223
|
}
|
|
@@ -230,19 +244,24 @@ ${this.value}</textarea
|
|
|
230
244
|
}
|
|
231
245
|
};
|
|
232
246
|
n = /* @__PURE__ */ new WeakSet();
|
|
233
|
-
|
|
234
|
-
const t =
|
|
247
|
+
f = function() {
|
|
248
|
+
const t = d(this, n, h).call(this, this.spacing), e = d(this, n, h).call(this, this.spacingTop) ?? t, i = d(this, n, h).call(this, this.spacingBottom) ?? t;
|
|
235
249
|
e ? this.style.setProperty("--scb-textfield-spacing-block-start", e) : this.style.removeProperty("--scb-textfield-spacing-block-start"), i ? this.style.setProperty("--scb-textfield-spacing-block-end", i) : this.style.removeProperty("--scb-textfield-spacing-block-end");
|
|
236
250
|
};
|
|
237
|
-
|
|
251
|
+
h = function(t) {
|
|
238
252
|
if (!t) return;
|
|
239
253
|
const e = String(t).trim();
|
|
240
254
|
if (e)
|
|
241
255
|
return /^\d+$/.test(e) ? `var(--spacing-${Math.max(0, Math.min(14, parseInt(e, 10)))})` : e;
|
|
242
256
|
};
|
|
257
|
+
p = function() {
|
|
258
|
+
var e;
|
|
259
|
+
const t = (e = this.renderRoot) == null ? void 0 : e.querySelector(".ripple-wrapper");
|
|
260
|
+
t && (this._inputFocused && this._kbShouldShowRing ? t.setAttribute("data-kb-focus", "true") : t.removeAttribute("data-kb-focus"));
|
|
261
|
+
};
|
|
243
262
|
s.formAssociated = !0;
|
|
244
263
|
s.styles = [
|
|
245
|
-
|
|
264
|
+
v`
|
|
246
265
|
:host {
|
|
247
266
|
--scb-textfield-number-max-width: 280px;
|
|
248
267
|
--scb-textfield-text-max-width: 400px;
|
|
@@ -258,6 +277,8 @@ s.styles = [
|
|
|
258
277
|
/* Vertikalt avstånd styrs av spacing-attributen via CSS-variabler */
|
|
259
278
|
margin-block-start: var(--scb-textfield-spacing-block-start, 0);
|
|
260
279
|
margin-block-end: var(--scb-textfield-spacing-block-end, 0);
|
|
280
|
+
|
|
281
|
+
-webkit-tap-highlight-color: transparent;
|
|
261
282
|
}
|
|
262
283
|
|
|
263
284
|
:host([type='number']) {
|
|
@@ -337,6 +358,8 @@ s.styles = [
|
|
|
337
358
|
box-sizing: border-box;
|
|
338
359
|
background-color: transparent;
|
|
339
360
|
color: var(--md-sys-color-on-surface);
|
|
361
|
+
position: relative;
|
|
362
|
+
z-index: 1;
|
|
340
363
|
}
|
|
341
364
|
|
|
342
365
|
:host([type='search']) .scb-textfield {
|
|
@@ -354,6 +377,7 @@ s.styles = [
|
|
|
354
377
|
transform: translateY(-50%);
|
|
355
378
|
pointer-events: none;
|
|
356
379
|
font-size: var(--scale-06);
|
|
380
|
+
z-index: 2;
|
|
357
381
|
}
|
|
358
382
|
|
|
359
383
|
.scb-textfield:focus-visible {
|
|
@@ -368,6 +392,35 @@ s.styles = [
|
|
|
368
392
|
width: 100%;
|
|
369
393
|
}
|
|
370
394
|
|
|
395
|
+
/* Wrapper som bär ripple och md-focus-ring */
|
|
396
|
+
.ripple-wrapper {
|
|
397
|
+
position: relative;
|
|
398
|
+
width: 100%;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
md-focus-ring.input-ring {
|
|
402
|
+
position: absolute;
|
|
403
|
+
inset: 0;
|
|
404
|
+
pointer-events: none;
|
|
405
|
+
display: none;
|
|
406
|
+
border-radius: var(--md-sys-shape-corner-small);
|
|
407
|
+
z-index: 3;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
.ripple-wrapper[data-kb-focus='true'] md-focus-ring.input-ring {
|
|
411
|
+
display: block;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
md-ripple {
|
|
415
|
+
border-radius: var(--md-sys-shape-corner-small);
|
|
416
|
+
position: absolute;
|
|
417
|
+
inset: 0;
|
|
418
|
+
z-index: 0;
|
|
419
|
+
pointer-events: none;
|
|
420
|
+
--md-ripple-hover-color: transparent;
|
|
421
|
+
--md-ripple-hover-opacity: 0;
|
|
422
|
+
}
|
|
423
|
+
|
|
371
424
|
input[type='search']::-webkit-search-cancel-button {
|
|
372
425
|
appearance: none;
|
|
373
426
|
display: none;
|
|
@@ -381,6 +434,7 @@ s.styles = [
|
|
|
381
434
|
pointer-events: none;
|
|
382
435
|
font-size: var(--scale-06);
|
|
383
436
|
color: var(--md-sys-color-error);
|
|
437
|
+
z-index: 2;
|
|
384
438
|
}
|
|
385
439
|
|
|
386
440
|
.scb-textfield.has-error-icon {
|
|
@@ -406,6 +460,7 @@ s.styles = [
|
|
|
406
460
|
justify-content: center;
|
|
407
461
|
cursor: pointer;
|
|
408
462
|
color: var(--md-sys-color-on-surface);
|
|
463
|
+
z-index: 2;
|
|
409
464
|
}
|
|
410
465
|
|
|
411
466
|
:host([error]) .scb-textfield-clear {
|
|
@@ -473,7 +528,7 @@ r([
|
|
|
473
528
|
a({ type: Boolean })
|
|
474
529
|
], s.prototype, "_showDatepicker", 2);
|
|
475
530
|
s = r([
|
|
476
|
-
|
|
531
|
+
y("scb-textfield")
|
|
477
532
|
], s);
|
|
478
533
|
export {
|
|
479
534
|
s as ScbTextField
|