scb-wc-test 0.1.116 → 0.1.117
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,4 +1,4 @@
|
|
|
1
|
-
import{a as v,n as a,r as x,i as g,x as d,t as y}from"../../vendor/vendor.js";import"../../vendor/vendor-material.js";import"../scb-datepicker/scb-datepicker.js";import"../scb-icon-button/scb-icon-button.js";import"../scb-button/scb-button.js";import"../scb-divider/scb-divider.js";import"../../vendor/preload-helper.js";(function(){try{var t=typeof globalThis<"u"?globalThis:window;if(!t.__scb_ce_guard_installed__){t.__scb_ce_guard_installed__=!0;var e=customElements.define.bind(customElements);customElements.define=function(i,l,n){try{customElements.get(i)||e(i,l,n)}catch(h){var p=String(h||"");if(p.indexOf("already been used")===-1&&p.indexOf("NotSupportedError")===-1)throw h}}}}catch{}})();var _=Object.defineProperty,w=Object.getOwnPropertyDescriptor,m=t=>{throw TypeError(t)},r=(t,e,i,l)=>{for(var n=l>1?void 0:l?w(e,i):e,p=t.length-1,h;p>=0;p--)(h=t[p])&&(n=(l?h(e,i,n):h(n))||n);return l&&n&&_(e,i,n),n},$=(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),c=(t,e,i)=>($(t,e,"access private method"),i),o,f,b,u;let s=class extends g{constructor(){super(),k(this,o),this._internals=null,this._inputFocused=!1,this._kbShouldShowRing=!1,this._onGlobalKeydown=t=>{t.key==="Tab"&&(this._kbShouldShowRing=!0,this._inputFocused&&c(this,o,u).call(this))},this._onGlobalPointerDown=()=>{this._kbShouldShowRing=!1,this._inputFocused&&c(this,o,u).call(this)},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=()=>{this._showDatepicker=!this._showDatepicker},this._onDateSelected=t=>{if(this.value=t.detail.value,this._showDatepicker=!1,this._internals){const e=this.disabled?null:this.value;this._internals.setFormValue(e)}if(this.pattern){const e=new RegExp(this.pattern);this.error=!e.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}))},"attachInternals"in this&&(this._internals=this.attachInternals())}render(){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;this.underLabel=this.error?this.errorText||"Ogiltig inmatning.":this.supportingText,this.value=this.value||"";const i=this.underLabel?`${this._inputId}-supporting-text`:void 0,l=this.type==="search"&&this.value?d`
|
|
1
|
+
import{a as v,n as a,r as x,i as g,x as d,t as y}from"../../vendor/vendor.js";import"../../vendor/vendor-material.js";import"../scb-datepicker/scb-datepicker.js";import"../scb-icon-button/scb-icon-button.js";import"../scb-button/scb-button.js";import"../scb-divider/scb-divider.js";import"../../vendor/preload-helper.js";(function(){try{var t=typeof globalThis<"u"?globalThis:window;if(!t.__scb_ce_guard_installed__){t.__scb_ce_guard_installed__=!0;var e=customElements.define.bind(customElements);customElements.define=function(i,l,n){try{customElements.get(i)||e(i,l,n)}catch(h){var p=String(h||"");if(p.indexOf("already been used")===-1&&p.indexOf("NotSupportedError")===-1)throw h}}}}catch{}})();var _=Object.defineProperty,w=Object.getOwnPropertyDescriptor,m=t=>{throw TypeError(t)},r=(t,e,i,l)=>{for(var n=l>1?void 0:l?w(e,i):e,p=t.length-1,h;p>=0;p--)(h=t[p])&&(n=(l?h(e,i,n):h(n))||n);return l&&n&&_(e,i,n),n},$=(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),c=(t,e,i)=>($(t,e,"access private method"),i),o,f,b,u;let s=class extends g{constructor(){super(),k(this,o),this._internals=null,this._inputFocused=!1,this._kbShouldShowRing=!1,this._onGlobalKeydown=t=>{t.key==="Tab"&&(this._kbShouldShowRing=!0,this._inputFocused&&c(this,o,u).call(this))},this._onGlobalPointerDown=()=>{this._kbShouldShowRing=!1,this._inputFocused&&c(this,o,u).call(this)},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=()=>{this._showDatepicker=!this._showDatepicker},this._onDateSelected=t=>{if(this.value=t.detail.value,this._showDatepicker=!1,this._internals){const e=this.disabled?null:this.value;this._internals.setFormValue(e)}if(this.pattern)if(!this.value)this.error=!1;else{const e=new RegExp(this.pattern);this.error=!e.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}))},"attachInternals"in this&&(this._internals=this.attachInternals())}render(){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;this.underLabel=this.error?this.errorText||"Ogiltig inmatning.":this.supportingText,this.value=this.value||"";const i=this.underLabel?`${this._inputId}-supporting-text`:void 0,l=this.type==="search"&&this.value?d`
|
|
2
2
|
<button
|
|
3
3
|
type="button"
|
|
4
4
|
class="scb-textfield-clear"
|
|
@@ -6,30 +6,9 @@ import{a as v,n as a,r as x,i as g,x as d,t as y}from"../../vendor/vendor.js";im
|
|
|
6
6
|
aria-label="Rensa fält"
|
|
7
7
|
>
|
|
8
8
|
<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false">
|
|
9
|
-
<circle
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
r="10"
|
|
13
|
-
fill="none"
|
|
14
|
-
stroke="currentColor"
|
|
15
|
-
stroke-width="2"
|
|
16
|
-
></circle>
|
|
17
|
-
<line
|
|
18
|
-
x1="8"
|
|
19
|
-
y1="8"
|
|
20
|
-
x2="16"
|
|
21
|
-
y2="16"
|
|
22
|
-
stroke="currentColor"
|
|
23
|
-
stroke-width="2"
|
|
24
|
-
></line>
|
|
25
|
-
<line
|
|
26
|
-
x1="16"
|
|
27
|
-
y1="8"
|
|
28
|
-
x2="8"
|
|
29
|
-
y2="16"
|
|
30
|
-
stroke="currentColor"
|
|
31
|
-
stroke-width="2"
|
|
32
|
-
></line>
|
|
9
|
+
<circle cx="12" cy="12" r="10" fill="none" stroke="currentColor" stroke-width="2"></circle>
|
|
10
|
+
<line x1="8" y1="8" x2="16" y2="16" stroke="currentColor" stroke-width="2"></line>
|
|
11
|
+
<line x1="16" y1="8" x2="8" y2="16" stroke="currentColor" stroke-width="2"></line>
|
|
33
12
|
</svg>
|
|
34
13
|
</button>
|
|
35
14
|
`:null;return this.type==="textarea"?d`
|
|
@@ -84,12 +63,13 @@ ${this.value}</textarea
|
|
|
84
63
|
<md-focus-ring class="input-ring"></md-focus-ring>
|
|
85
64
|
</div>
|
|
86
65
|
${this.error?e:d`
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
66
|
+
<scb-icon-button
|
|
67
|
+
class="scb-textfield-datepicker-button"
|
|
68
|
+
icon="calendar_today"
|
|
69
|
+
@click=${this._toggleDatepicker}
|
|
70
|
+
aria-label="Välj datum"
|
|
71
|
+
></scb-icon-button>
|
|
72
|
+
`}
|
|
93
73
|
<scb-datepicker
|
|
94
74
|
.selectedValue=${this.value}
|
|
95
75
|
.open=${this._showDatepicker}
|
|
@@ -105,33 +85,34 @@ ${this.value}</textarea
|
|
|
105
85
|
>
|
|
106
86
|
<div class="scb-textfield-wrapper" style="position:relative;">
|
|
107
87
|
${t}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
88
|
+
<div class="ripple-wrapper">
|
|
89
|
+
<input
|
|
90
|
+
class="scb-textfield${this.error?" has-error-icon":""}"
|
|
91
|
+
.value=${this.value}
|
|
92
|
+
type="text"
|
|
93
|
+
name="${this.name}"
|
|
94
|
+
id="${this._inputId}"
|
|
95
|
+
?disabled=${this.disabled}
|
|
96
|
+
?required=${this.required}
|
|
97
|
+
aria-invalid=${this.error?"true":"false"}
|
|
98
|
+
aria-describedby=${i}
|
|
99
|
+
readonly
|
|
100
|
+
@focus=${this._toggleDatepicker}
|
|
101
|
+
@click=${this._toggleDatepicker}
|
|
102
|
+
/>
|
|
103
|
+
|
|
104
|
+
<md-ripple></md-ripple>
|
|
105
|
+
<md-focus-ring class="input-ring"></md-focus-ring>
|
|
126
106
|
</div>
|
|
127
107
|
|
|
128
108
|
${this.error?e:d`
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
109
|
+
<scb-icon-button
|
|
110
|
+
class="scb-textfield-datepicker-button"
|
|
111
|
+
icon="calendar_today"
|
|
112
|
+
@click=${this._toggleDatepicker}
|
|
113
|
+
aria-label="Välj datum"
|
|
114
|
+
></scb-icon-button>
|
|
115
|
+
`}
|
|
135
116
|
<scb-datepicker
|
|
136
117
|
variant="datetime-local"
|
|
137
118
|
.selectedValue=${this.value}
|
|
@@ -193,7 +174,7 @@ ${this.value}</textarea
|
|
|
193
174
|
<md-focus-ring class="input-ring"></md-focus-ring>
|
|
194
175
|
</div>
|
|
195
176
|
</div>
|
|
196
|
-
`}firstUpdated(t){super.firstUpdated(t),this._initialValue=this.value;const e=this.shadowRoot?.querySelector(".scb-textfield");e&&(e.addEventListener("input",()=>{const i=e;if(this.value=i.value,this._internals){const l=this.disabled?null:this.value;this._internals.setFormValue(l)}if(this.pattern){const l=new RegExp(this.pattern);this.error=!l.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}))}),e.addEventListener("change",()=>{this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}),e.addEventListener("select",()=>{this.dispatchEvent(new Event("select",{bubbles:!0,composed:!0}))}),e.addEventListener("focus",()=>{this._inputFocused=!0,c(this,o,u).call(this)}),e.addEventListener("blur",()=>{this._inputFocused=!1,c(this,o,u).call(this)})),c(this,o,f).call(this)}updated(t){if(super.updated(t),this.toggleAttribute("aria-disabled",this.disabled),this._internals&&(t.has("value")||t.has("disabled"))){const e=this.disabled?null:this.value;this._internals.setFormValue(e)}(t.has("spacing")||t.has("spacingTop")||t.has("spacingBottom"))&&c(this,o,f).call(this)}formDisabledCallback(t){this.disabled=t}connectedCallback(){super.connectedCallback(),this._inputId=this.id||`scb-textfield-${Math.random().toString(36).substr(2,9)}`,this._formSubmitHandler=t=>{this.reportValidity()||(t.preventDefault(),t.stopPropagation())},this._form=this.closest("form"),this._form&&(this._form.addEventListener("submit",this._formSubmitHandler,!0),this._formResetHandler=()=>{this.value=this._initialValue;const t=this.shadowRoot?.querySelector(".scb-textfield");t&&(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement)&&(t.value=this._initialValue),this.error=!1},this._form.addEventListener("reset",this._formResetHandler,!0)),window.addEventListener("keydown",this._onGlobalKeydown,!0),window.addEventListener("pointerdown",this._onGlobalPointerDown,!0)}disconnectedCallback(){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)}reportValidity(){const t=this.shadowRoot?.querySelector(".scb-textfield");if(t&&(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement)){this.required&&!t.value?t.setCustomValidity(this.errorText||"Ogiltig inmatning."):t.setCustomValidity("");const e=t.reportValidity();this.error=!e;const i=e?"":this.errorText||t.validationMessage||"Ogiltig inmatning.";return e||(this.errorText=i),this._internals&&(e?this._internals.setValidity({}):this._internals.setValidity({customError:!0},i,t)),e}return!0}_onClearClick(){const t=this.shadowRoot?.querySelector(".scb-textfield");if(t&&(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement)){if(t.value="",this.value="",this._internals){const e=this.disabled?null:this.value;this._internals.setFormValue(e),this._internals.setValidity({})}this.error=!1,t.setCustomValidity(""),this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("onValueChanged",{detail:{value:this.value},bubbles:!0,composed:!0})),t.focus()}}};o=new WeakSet;f=function(){const t=c(this,o,b).call(this,this.spacing),e=c(this,o,b).call(this,this.spacingTop)??t,i=c(this,o,b).call(this,this.spacingBottom)??t;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")};b=function(t){if(!t)return;const e=String(t).trim();if(e)return/^\d+$/.test(e)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(e,10)))})`:e};u=function(){const t=this.renderRoot?.querySelector(".ripple-wrapper");t&&(this._inputFocused&&this._kbShouldShowRing?t.setAttribute("data-kb-focus","true"):t.removeAttribute("data-kb-focus"))};s.formAssociated=!0;s.styles=[v`
|
|
177
|
+
`}firstUpdated(t){super.firstUpdated(t),this._initialValue=this.value;const e=this.shadowRoot?.querySelector(".scb-textfield");e&&(e.addEventListener("input",()=>{const i=e;if(this.value=i.value,this._internals){const l=this.disabled?null:this.value;this._internals.setFormValue(l)}if(this.pattern)if(!this.value)this.error=!1;else{const l=new RegExp(this.pattern);this.error=!l.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}))}),e.addEventListener("change",()=>{this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}),e.addEventListener("select",()=>{this.dispatchEvent(new Event("select",{bubbles:!0,composed:!0}))}),e.addEventListener("focus",()=>{this._inputFocused=!0,c(this,o,u).call(this)}),e.addEventListener("blur",()=>{this._inputFocused=!1,c(this,o,u).call(this)})),c(this,o,f).call(this)}updated(t){if(super.updated(t),this.toggleAttribute("aria-disabled",this.disabled),this._internals&&(t.has("value")||t.has("disabled"))){const e=this.disabled?null:this.value;this._internals.setFormValue(e)}(t.has("spacing")||t.has("spacingTop")||t.has("spacingBottom"))&&c(this,o,f).call(this)}formDisabledCallback(t){this.disabled=t}connectedCallback(){super.connectedCallback(),this._inputId=this.id||`scb-textfield-${Math.random().toString(36).substr(2,9)}`,this._formSubmitHandler=t=>{this.reportValidity()||(t.preventDefault(),t.stopPropagation())},this._form=this.closest("form"),this._form&&(this._form.addEventListener("submit",this._formSubmitHandler,!0),this._formResetHandler=()=>{this.value=this._initialValue;const t=this.shadowRoot?.querySelector(".scb-textfield");t&&(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement)&&(t.value=this._initialValue),this.error=!1},this._form.addEventListener("reset",this._formResetHandler,!0)),window.addEventListener("keydown",this._onGlobalKeydown,!0),window.addEventListener("pointerdown",this._onGlobalPointerDown,!0)}disconnectedCallback(){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)}reportValidity(){const t=this.shadowRoot?.querySelector(".scb-textfield");if(t&&(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement)){this.required&&!t.value?t.setCustomValidity(this.errorText||"Ogiltig inmatning."):t.setCustomValidity("");const e=t.reportValidity();this.error=!e;const i=e?"":this.errorText||t.validationMessage||"Ogiltig inmatning.";return e||(this.errorText=i),this._internals&&(e?this._internals.setValidity({}):this._internals.setValidity({customError:!0},i,t)),e}return!0}_onClearClick(){const t=this.shadowRoot?.querySelector(".scb-textfield");if(t&&(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement)){if(t.value="",this.value="",this._internals){const e=this.disabled?null:this.value;this._internals.setFormValue(e),this._internals.setValidity({})}this.error=!1,t.setCustomValidity(""),this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("onValueChanged",{detail:{value:this.value},bubbles:!0,composed:!0})),t.focus()}}};o=new WeakSet;f=function(){const t=c(this,o,b).call(this,this.spacing),e=c(this,o,b).call(this,this.spacingTop)??t,i=c(this,o,b).call(this,this.spacingBottom)??t;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")};b=function(t){if(!t)return;const e=String(t).trim();if(e)return/^\d+$/.test(e)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(e,10)))})`:e};u=function(){const t=this.renderRoot?.querySelector(".ripple-wrapper");t&&(this._inputFocused&&this._kbShouldShowRing?t.setAttribute("data-kb-focus","true"):t.removeAttribute("data-kb-focus"))};s.formAssociated=!0;s.styles=[v`
|
|
197
178
|
:host {
|
|
198
179
|
--scb-textfield-number-max-width: 280px;
|
|
199
180
|
--scb-textfield-text-max-width: 400px;
|
|
@@ -249,9 +230,9 @@ ${this.value}</textarea
|
|
|
249
230
|
:host([type='time']) {
|
|
250
231
|
--scb-textfield-max-width: var(--scb-textfield-text-max-width);
|
|
251
232
|
}
|
|
252
|
-
input[type=
|
|
253
|
-
|
|
254
|
-
|
|
233
|
+
input[type='time']::-webkit-calendar-picker-indicator {
|
|
234
|
+
display: none;
|
|
235
|
+
background: none;
|
|
255
236
|
}
|
|
256
237
|
|
|
257
238
|
:host {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "scb-wc-test",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.117",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "index.js",
|
|
@@ -345,5 +345,5 @@
|
|
|
345
345
|
},
|
|
346
346
|
"./mvc/*": "./mvc/*"
|
|
347
347
|
},
|
|
348
|
-
"buildHash": "
|
|
348
|
+
"buildHash": "03ECEAD50961B1BBA8E3789EBE4A84C4722E11CFD45A579261C40482660A244E"
|
|
349
349
|
}
|
|
@@ -25,10 +25,13 @@ let s = class extends x {
|
|
|
25
25
|
const e = this.disabled ? null : this.value;
|
|
26
26
|
this._internals.setFormValue(e);
|
|
27
27
|
}
|
|
28
|
-
if (this.pattern)
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
if (this.pattern)
|
|
29
|
+
if (!this.value)
|
|
30
|
+
this.error = !1;
|
|
31
|
+
else {
|
|
32
|
+
const e = new RegExp(this.pattern);
|
|
33
|
+
this.error = !e.test(this.value);
|
|
34
|
+
}
|
|
32
35
|
this.dispatchEvent(new Event("input", { bubbles: !0, composed: !0 })), this.dispatchEvent(
|
|
33
36
|
new CustomEvent("onValueChanged", {
|
|
34
37
|
detail: { value: this.value },
|
|
@@ -49,30 +52,9 @@ let s = class extends x {
|
|
|
49
52
|
aria-label="Rensa fält"
|
|
50
53
|
>
|
|
51
54
|
<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false">
|
|
52
|
-
<circle
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
r="10"
|
|
56
|
-
fill="none"
|
|
57
|
-
stroke="currentColor"
|
|
58
|
-
stroke-width="2"
|
|
59
|
-
></circle>
|
|
60
|
-
<line
|
|
61
|
-
x1="8"
|
|
62
|
-
y1="8"
|
|
63
|
-
x2="16"
|
|
64
|
-
y2="16"
|
|
65
|
-
stroke="currentColor"
|
|
66
|
-
stroke-width="2"
|
|
67
|
-
></line>
|
|
68
|
-
<line
|
|
69
|
-
x1="16"
|
|
70
|
-
y1="8"
|
|
71
|
-
x2="8"
|
|
72
|
-
y2="16"
|
|
73
|
-
stroke="currentColor"
|
|
74
|
-
stroke-width="2"
|
|
75
|
-
></line>
|
|
55
|
+
<circle cx="12" cy="12" r="10" fill="none" stroke="currentColor" stroke-width="2"></circle>
|
|
56
|
+
<line x1="8" y1="8" x2="16" y2="16" stroke="currentColor" stroke-width="2"></line>
|
|
57
|
+
<line x1="16" y1="8" x2="8" y2="16" stroke="currentColor" stroke-width="2"></line>
|
|
76
58
|
</svg>
|
|
77
59
|
</button>
|
|
78
60
|
` : null;
|
|
@@ -128,12 +110,13 @@ ${this.value}</textarea
|
|
|
128
110
|
<md-focus-ring class="input-ring"></md-focus-ring>
|
|
129
111
|
</div>
|
|
130
112
|
${this.error ? e : d`
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
113
|
+
<scb-icon-button
|
|
114
|
+
class="scb-textfield-datepicker-button"
|
|
115
|
+
icon="calendar_today"
|
|
116
|
+
@click=${this._toggleDatepicker}
|
|
117
|
+
aria-label="Välj datum"
|
|
118
|
+
></scb-icon-button>
|
|
119
|
+
`}
|
|
137
120
|
<scb-datepicker
|
|
138
121
|
.selectedValue=${this.value}
|
|
139
122
|
.open=${this._showDatepicker}
|
|
@@ -149,33 +132,34 @@ ${this.value}</textarea
|
|
|
149
132
|
>
|
|
150
133
|
<div class="scb-textfield-wrapper" style="position:relative;">
|
|
151
134
|
${t}
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
135
|
+
<div class="ripple-wrapper">
|
|
136
|
+
<input
|
|
137
|
+
class="scb-textfield${this.error ? " has-error-icon" : ""}"
|
|
138
|
+
.value=${this.value}
|
|
139
|
+
type="text"
|
|
140
|
+
name="${this.name}"
|
|
141
|
+
id="${this._inputId}"
|
|
142
|
+
?disabled=${this.disabled}
|
|
143
|
+
?required=${this.required}
|
|
144
|
+
aria-invalid=${this.error ? "true" : "false"}
|
|
145
|
+
aria-describedby=${i}
|
|
146
|
+
readonly
|
|
147
|
+
@focus=${this._toggleDatepicker}
|
|
148
|
+
@click=${this._toggleDatepicker}
|
|
149
|
+
/>
|
|
150
|
+
|
|
151
|
+
<md-ripple></md-ripple>
|
|
152
|
+
<md-focus-ring class="input-ring"></md-focus-ring>
|
|
170
153
|
</div>
|
|
171
154
|
|
|
172
155
|
${this.error ? e : d`
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
156
|
+
<scb-icon-button
|
|
157
|
+
class="scb-textfield-datepicker-button"
|
|
158
|
+
icon="calendar_today"
|
|
159
|
+
@click=${this._toggleDatepicker}
|
|
160
|
+
aria-label="Välj datum"
|
|
161
|
+
></scb-icon-button>
|
|
162
|
+
`}
|
|
179
163
|
<scb-datepicker
|
|
180
164
|
variant="datetime-local"
|
|
181
165
|
.selectedValue=${this.value}
|
|
@@ -266,10 +250,13 @@ ${this.value}</textarea
|
|
|
266
250
|
const l = this.disabled ? null : this.value;
|
|
267
251
|
this._internals.setFormValue(l);
|
|
268
252
|
}
|
|
269
|
-
if (this.pattern)
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
253
|
+
if (this.pattern)
|
|
254
|
+
if (!this.value)
|
|
255
|
+
this.error = !1;
|
|
256
|
+
else {
|
|
257
|
+
const l = new RegExp(this.pattern);
|
|
258
|
+
this.error = !l.test(this.value);
|
|
259
|
+
}
|
|
273
260
|
this.dispatchEvent(new Event("input", { bubbles: !0, composed: !0 })), this.dispatchEvent(
|
|
274
261
|
new CustomEvent("onValueChanged", {
|
|
275
262
|
detail: { value: this.value },
|
|
@@ -423,9 +410,9 @@ s.styles = [
|
|
|
423
410
|
:host([type='time']) {
|
|
424
411
|
--scb-textfield-max-width: var(--scb-textfield-text-max-width);
|
|
425
412
|
}
|
|
426
|
-
input[type=
|
|
427
|
-
|
|
428
|
-
|
|
413
|
+
input[type='time']::-webkit-calendar-picker-indicator {
|
|
414
|
+
display: none;
|
|
415
|
+
background: none;
|
|
429
416
|
}
|
|
430
417
|
|
|
431
418
|
:host {
|
package/scb-wc-test.bundle.js
CHANGED
|
@@ -4241,7 +4241,7 @@ var ScbWcTest=function(a){"use strict";var kl;function d(o,e,t,i){var r=argument
|
|
|
4241
4241
|
.close-datepicker:hover {
|
|
4242
4242
|
background: var(--md-sys-color-primary-container, #e3f2fd);
|
|
4243
4243
|
}
|
|
4244
|
-
`],Ce([w()],a.ScbDatepicker.prototype,"_currentDate",2),Ce([w()],a.ScbDatepicker.prototype,"_selectedDate",2),Ce([w()],a.ScbDatepicker.prototype,"_showMonthDropdown",2),Ce([w()],a.ScbDatepicker.prototype,"_showYearDropdown",2),Ce([n({type:String})],a.ScbDatepicker.prototype,"variant",2),Ce([n({type:String})],a.ScbDatepicker.prototype,"lang",2),Ce([n({type:String})],a.ScbDatepicker.prototype,"selectedValue",2),Ce([n({type:Boolean})],a.ScbDatepicker.prototype,"open",2),Ce([w()],a.ScbDatepicker.prototype,"_selectedHour",2),Ce([w()],a.ScbDatepicker.prototype,"_selectedMinute",2),a.ScbDatepicker=Ce([g("scb-datepicker")],a.ScbDatepicker);var zp=Object.defineProperty,Ip=Object.getOwnPropertyDescriptor,Kn=o=>{throw TypeError(o)},Y=(o,e,t,i)=>{for(var r=i>1?void 0:i?Ip(e,t):e,s=o.length-1,l;s>=0;s--)(l=o[s])&&(r=(i?l(e,t,r):l(r))||r);return i&&r&&zp(e,t,r),r},Pp=(o,e,t)=>e.has(o)||Kn("Cannot "+t),Op=(o,e,t)=>e.has(o)?Kn("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(o):e.set(o,t),Ke=(o,e,t)=>(Pp(o,e,"access private method"),t),Ee,Ha,Zr,Oi;a.ScbTextField=class extends y{constructor(){super(),Op(this,Ee),this._internals=null,this._inputFocused=!1,this._kbShouldShowRing=!1,this._onGlobalKeydown=e=>{e.key==="Tab"&&(this._kbShouldShowRing=!0,this._inputFocused&&Ke(this,Ee,Oi).call(this))},this._onGlobalPointerDown=()=>{this._kbShouldShowRing=!1,this._inputFocused&&Ke(this,Ee,Oi).call(this)},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=()=>{this._showDatepicker=!this._showDatepicker},this._onDateSelected=e=>{if(this.value=e.detail.value,this._showDatepicker=!1,this._internals){const t=this.disabled?null:this.value;this._internals.setFormValue(t)}if(this.pattern){const t=new RegExp(this.pattern);this.error=!t.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}))},"attachInternals"in this&&(this._internals=this.attachInternals())}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 i=this.underLabel?`${this._inputId}-supporting-text`:void 0,r=this.type==="search"&&this.value?c`
|
|
4244
|
+
`],Ce([w()],a.ScbDatepicker.prototype,"_currentDate",2),Ce([w()],a.ScbDatepicker.prototype,"_selectedDate",2),Ce([w()],a.ScbDatepicker.prototype,"_showMonthDropdown",2),Ce([w()],a.ScbDatepicker.prototype,"_showYearDropdown",2),Ce([n({type:String})],a.ScbDatepicker.prototype,"variant",2),Ce([n({type:String})],a.ScbDatepicker.prototype,"lang",2),Ce([n({type:String})],a.ScbDatepicker.prototype,"selectedValue",2),Ce([n({type:Boolean})],a.ScbDatepicker.prototype,"open",2),Ce([w()],a.ScbDatepicker.prototype,"_selectedHour",2),Ce([w()],a.ScbDatepicker.prototype,"_selectedMinute",2),a.ScbDatepicker=Ce([g("scb-datepicker")],a.ScbDatepicker);var zp=Object.defineProperty,Ip=Object.getOwnPropertyDescriptor,Kn=o=>{throw TypeError(o)},Y=(o,e,t,i)=>{for(var r=i>1?void 0:i?Ip(e,t):e,s=o.length-1,l;s>=0;s--)(l=o[s])&&(r=(i?l(e,t,r):l(r))||r);return i&&r&&zp(e,t,r),r},Pp=(o,e,t)=>e.has(o)||Kn("Cannot "+t),Op=(o,e,t)=>e.has(o)?Kn("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(o):e.set(o,t),Ke=(o,e,t)=>(Pp(o,e,"access private method"),t),Ee,Ha,Zr,Oi;a.ScbTextField=class extends y{constructor(){super(),Op(this,Ee),this._internals=null,this._inputFocused=!1,this._kbShouldShowRing=!1,this._onGlobalKeydown=e=>{e.key==="Tab"&&(this._kbShouldShowRing=!0,this._inputFocused&&Ke(this,Ee,Oi).call(this))},this._onGlobalPointerDown=()=>{this._kbShouldShowRing=!1,this._inputFocused&&Ke(this,Ee,Oi).call(this)},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=()=>{this._showDatepicker=!this._showDatepicker},this._onDateSelected=e=>{if(this.value=e.detail.value,this._showDatepicker=!1,this._internals){const t=this.disabled?null:this.value;this._internals.setFormValue(t)}if(this.pattern)if(!this.value)this.error=!1;else{const t=new RegExp(this.pattern);this.error=!t.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}))},"attachInternals"in this&&(this._internals=this.attachInternals())}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 i=this.underLabel?`${this._inputId}-supporting-text`:void 0,r=this.type==="search"&&this.value?c`
|
|
4245
4245
|
<button
|
|
4246
4246
|
type="button"
|
|
4247
4247
|
class="scb-textfield-clear"
|
|
@@ -4249,30 +4249,9 @@ var ScbWcTest=function(a){"use strict";var kl;function d(o,e,t,i){var r=argument
|
|
|
4249
4249
|
aria-label="Rensa fält"
|
|
4250
4250
|
>
|
|
4251
4251
|
<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false">
|
|
4252
|
-
<circle
|
|
4253
|
-
|
|
4254
|
-
|
|
4255
|
-
r="10"
|
|
4256
|
-
fill="none"
|
|
4257
|
-
stroke="currentColor"
|
|
4258
|
-
stroke-width="2"
|
|
4259
|
-
></circle>
|
|
4260
|
-
<line
|
|
4261
|
-
x1="8"
|
|
4262
|
-
y1="8"
|
|
4263
|
-
x2="16"
|
|
4264
|
-
y2="16"
|
|
4265
|
-
stroke="currentColor"
|
|
4266
|
-
stroke-width="2"
|
|
4267
|
-
></line>
|
|
4268
|
-
<line
|
|
4269
|
-
x1="16"
|
|
4270
|
-
y1="8"
|
|
4271
|
-
x2="8"
|
|
4272
|
-
y2="16"
|
|
4273
|
-
stroke="currentColor"
|
|
4274
|
-
stroke-width="2"
|
|
4275
|
-
></line>
|
|
4252
|
+
<circle cx="12" cy="12" r="10" fill="none" stroke="currentColor" stroke-width="2"></circle>
|
|
4253
|
+
<line x1="8" y1="8" x2="16" y2="16" stroke="currentColor" stroke-width="2"></line>
|
|
4254
|
+
<line x1="16" y1="8" x2="8" y2="16" stroke="currentColor" stroke-width="2"></line>
|
|
4276
4255
|
</svg>
|
|
4277
4256
|
</button>
|
|
4278
4257
|
`:null;return this.type==="textarea"?c`
|
|
@@ -4327,12 +4306,13 @@ ${this.value}</textarea
|
|
|
4327
4306
|
<md-focus-ring class="input-ring"></md-focus-ring>
|
|
4328
4307
|
</div>
|
|
4329
4308
|
${this.error?t:c`
|
|
4330
|
-
|
|
4331
|
-
|
|
4332
|
-
|
|
4333
|
-
|
|
4334
|
-
|
|
4335
|
-
|
|
4309
|
+
<scb-icon-button
|
|
4310
|
+
class="scb-textfield-datepicker-button"
|
|
4311
|
+
icon="calendar_today"
|
|
4312
|
+
@click=${this._toggleDatepicker}
|
|
4313
|
+
aria-label="Välj datum"
|
|
4314
|
+
></scb-icon-button>
|
|
4315
|
+
`}
|
|
4336
4316
|
<scb-datepicker
|
|
4337
4317
|
.selectedValue=${this.value}
|
|
4338
4318
|
.open=${this._showDatepicker}
|
|
@@ -4348,33 +4328,34 @@ ${this.value}</textarea
|
|
|
4348
4328
|
>
|
|
4349
4329
|
<div class="scb-textfield-wrapper" style="position:relative;">
|
|
4350
4330
|
${e}
|
|
4351
|
-
|
|
4352
|
-
|
|
4353
|
-
|
|
4354
|
-
|
|
4355
|
-
|
|
4356
|
-
|
|
4357
|
-
|
|
4358
|
-
|
|
4359
|
-
|
|
4360
|
-
|
|
4361
|
-
|
|
4362
|
-
|
|
4363
|
-
|
|
4364
|
-
|
|
4365
|
-
|
|
4366
|
-
|
|
4367
|
-
|
|
4368
|
-
|
|
4331
|
+
<div class="ripple-wrapper">
|
|
4332
|
+
<input
|
|
4333
|
+
class="scb-textfield${this.error?" has-error-icon":""}"
|
|
4334
|
+
.value=${this.value}
|
|
4335
|
+
type="text"
|
|
4336
|
+
name="${this.name}"
|
|
4337
|
+
id="${this._inputId}"
|
|
4338
|
+
?disabled=${this.disabled}
|
|
4339
|
+
?required=${this.required}
|
|
4340
|
+
aria-invalid=${this.error?"true":"false"}
|
|
4341
|
+
aria-describedby=${i}
|
|
4342
|
+
readonly
|
|
4343
|
+
@focus=${this._toggleDatepicker}
|
|
4344
|
+
@click=${this._toggleDatepicker}
|
|
4345
|
+
/>
|
|
4346
|
+
|
|
4347
|
+
<md-ripple></md-ripple>
|
|
4348
|
+
<md-focus-ring class="input-ring"></md-focus-ring>
|
|
4369
4349
|
</div>
|
|
4370
4350
|
|
|
4371
4351
|
${this.error?t:c`
|
|
4372
|
-
|
|
4373
|
-
|
|
4374
|
-
|
|
4375
|
-
|
|
4376
|
-
|
|
4377
|
-
|
|
4352
|
+
<scb-icon-button
|
|
4353
|
+
class="scb-textfield-datepicker-button"
|
|
4354
|
+
icon="calendar_today"
|
|
4355
|
+
@click=${this._toggleDatepicker}
|
|
4356
|
+
aria-label="Välj datum"
|
|
4357
|
+
></scb-icon-button>
|
|
4358
|
+
`}
|
|
4378
4359
|
<scb-datepicker
|
|
4379
4360
|
variant="datetime-local"
|
|
4380
4361
|
.selectedValue=${this.value}
|
|
@@ -4436,7 +4417,7 @@ ${this.value}</textarea
|
|
|
4436
4417
|
<md-focus-ring class="input-ring"></md-focus-ring>
|
|
4437
4418
|
</div>
|
|
4438
4419
|
</div>
|
|
4439
|
-
`}firstUpdated(e){var i;super.firstUpdated(e),this._initialValue=this.value;const t=(i=this.shadowRoot)==null?void 0:i.querySelector(".scb-textfield");t&&(t.addEventListener("input",()=>{const r=t;if(this.value=r.value,this._internals){const s=this.disabled?null:this.value;this._internals.setFormValue(s)}if(this.pattern){const s=new RegExp(this.pattern);this.error=!s.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",()=>{this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}),t.addEventListener("select",()=>{this.dispatchEvent(new Event("select",{bubbles:!0,composed:!0}))}),t.addEventListener("focus",()=>{this._inputFocused=!0,Ke(this,Ee,Oi).call(this)}),t.addEventListener("blur",()=>{this._inputFocused=!1,Ke(this,Ee,Oi).call(this)})),Ke(this,Ee,Ha).call(this)}updated(e){if(super.updated(e),this.toggleAttribute("aria-disabled",this.disabled),this._internals&&(e.has("value")||e.has("disabled"))){const t=this.disabled?null:this.value;this._internals.setFormValue(t)}(e.has("spacing")||e.has("spacingTop")||e.has("spacingBottom"))&&Ke(this,Ee,Ha).call(this)}formDisabledCallback(e){this.disabled=e}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=()=>{var t;this.value=this._initialValue;const e=(t=this.shadowRoot)==null?void 0:t.querySelector(".scb-textfield");e&&(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)&&(e.value=this._initialValue),this.error=!1},this._form.addEventListener("reset",this._formResetHandler,!0)),window.addEventListener("keydown",this._onGlobalKeydown,!0),window.addEventListener("pointerdown",this._onGlobalPointerDown,!0)}disconnectedCallback(){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)}reportValidity(){var t;const e=(t=this.shadowRoot)==null?void 0:t.querySelector(".scb-textfield");if(e&&(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)){this.required&&!e.value?e.setCustomValidity(this.errorText||"Ogiltig inmatning."):e.setCustomValidity("");const i=e.reportValidity();this.error=!i;const r=i?"":this.errorText||e.validationMessage||"Ogiltig inmatning.";return i||(this.errorText=r),this._internals&&(i?this._internals.setValidity({}):this._internals.setValidity({customError:!0},r,e)),i}return!0}_onClearClick(){var t;const e=(t=this.shadowRoot)==null?void 0:t.querySelector(".scb-textfield");if(e&&(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)){if(e.value="",this.value="",this._internals){const i=this.disabled?null:this.value;this._internals.setFormValue(i),this._internals.setValidity({})}this.error=!1,e.setCustomValidity(""),this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("onValueChanged",{detail:{value:this.value},bubbles:!0,composed:!0})),e.focus()}}},Ee=new WeakSet,Ha=function(){const o=Ke(this,Ee,Zr).call(this,this.spacing),e=Ke(this,Ee,Zr).call(this,this.spacingTop)??o,t=Ke(this,Ee,Zr).call(this,this.spacingBottom)??o;e?this.style.setProperty("--scb-textfield-spacing-block-start",e):this.style.removeProperty("--scb-textfield-spacing-block-start"),t?this.style.setProperty("--scb-textfield-spacing-block-end",t):this.style.removeProperty("--scb-textfield-spacing-block-end")},Zr=function(o){if(!o)return;const e=String(o).trim();if(e)return/^\d+$/.test(e)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(e,10)))})`:e},Oi=function(){var e;const o=(e=this.renderRoot)==null?void 0:e.querySelector(".ripple-wrapper");o&&(this._inputFocused&&this._kbShouldShowRing?o.setAttribute("data-kb-focus","true"):o.removeAttribute("data-kb-focus"))},a.ScbTextField.formAssociated=!0,a.ScbTextField.styles=[m`
|
|
4420
|
+
`}firstUpdated(e){var i;super.firstUpdated(e),this._initialValue=this.value;const t=(i=this.shadowRoot)==null?void 0:i.querySelector(".scb-textfield");t&&(t.addEventListener("input",()=>{const r=t;if(this.value=r.value,this._internals){const s=this.disabled?null:this.value;this._internals.setFormValue(s)}if(this.pattern)if(!this.value)this.error=!1;else{const s=new RegExp(this.pattern);this.error=!s.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",()=>{this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}),t.addEventListener("select",()=>{this.dispatchEvent(new Event("select",{bubbles:!0,composed:!0}))}),t.addEventListener("focus",()=>{this._inputFocused=!0,Ke(this,Ee,Oi).call(this)}),t.addEventListener("blur",()=>{this._inputFocused=!1,Ke(this,Ee,Oi).call(this)})),Ke(this,Ee,Ha).call(this)}updated(e){if(super.updated(e),this.toggleAttribute("aria-disabled",this.disabled),this._internals&&(e.has("value")||e.has("disabled"))){const t=this.disabled?null:this.value;this._internals.setFormValue(t)}(e.has("spacing")||e.has("spacingTop")||e.has("spacingBottom"))&&Ke(this,Ee,Ha).call(this)}formDisabledCallback(e){this.disabled=e}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=()=>{var t;this.value=this._initialValue;const e=(t=this.shadowRoot)==null?void 0:t.querySelector(".scb-textfield");e&&(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)&&(e.value=this._initialValue),this.error=!1},this._form.addEventListener("reset",this._formResetHandler,!0)),window.addEventListener("keydown",this._onGlobalKeydown,!0),window.addEventListener("pointerdown",this._onGlobalPointerDown,!0)}disconnectedCallback(){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)}reportValidity(){var t;const e=(t=this.shadowRoot)==null?void 0:t.querySelector(".scb-textfield");if(e&&(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)){this.required&&!e.value?e.setCustomValidity(this.errorText||"Ogiltig inmatning."):e.setCustomValidity("");const i=e.reportValidity();this.error=!i;const r=i?"":this.errorText||e.validationMessage||"Ogiltig inmatning.";return i||(this.errorText=r),this._internals&&(i?this._internals.setValidity({}):this._internals.setValidity({customError:!0},r,e)),i}return!0}_onClearClick(){var t;const e=(t=this.shadowRoot)==null?void 0:t.querySelector(".scb-textfield");if(e&&(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)){if(e.value="",this.value="",this._internals){const i=this.disabled?null:this.value;this._internals.setFormValue(i),this._internals.setValidity({})}this.error=!1,e.setCustomValidity(""),this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("onValueChanged",{detail:{value:this.value},bubbles:!0,composed:!0})),e.focus()}}},Ee=new WeakSet,Ha=function(){const o=Ke(this,Ee,Zr).call(this,this.spacing),e=Ke(this,Ee,Zr).call(this,this.spacingTop)??o,t=Ke(this,Ee,Zr).call(this,this.spacingBottom)??o;e?this.style.setProperty("--scb-textfield-spacing-block-start",e):this.style.removeProperty("--scb-textfield-spacing-block-start"),t?this.style.setProperty("--scb-textfield-spacing-block-end",t):this.style.removeProperty("--scb-textfield-spacing-block-end")},Zr=function(o){if(!o)return;const e=String(o).trim();if(e)return/^\d+$/.test(e)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(e,10)))})`:e},Oi=function(){var e;const o=(e=this.renderRoot)==null?void 0:e.querySelector(".ripple-wrapper");o&&(this._inputFocused&&this._kbShouldShowRing?o.setAttribute("data-kb-focus","true"):o.removeAttribute("data-kb-focus"))},a.ScbTextField.formAssociated=!0,a.ScbTextField.styles=[m`
|
|
4440
4421
|
:host {
|
|
4441
4422
|
--scb-textfield-number-max-width: 280px;
|
|
4442
4423
|
--scb-textfield-text-max-width: 400px;
|
|
@@ -4492,9 +4473,9 @@ ${this.value}</textarea
|
|
|
4492
4473
|
:host([type='time']) {
|
|
4493
4474
|
--scb-textfield-max-width: var(--scb-textfield-text-max-width);
|
|
4494
4475
|
}
|
|
4495
|
-
input[type=
|
|
4496
|
-
|
|
4497
|
-
|
|
4476
|
+
input[type='time']::-webkit-calendar-picker-indicator {
|
|
4477
|
+
display: none;
|
|
4478
|
+
background: none;
|
|
4498
4479
|
}
|
|
4499
4480
|
|
|
4500
4481
|
:host {
|