scb-wc-test 0.1.259 → 0.1.260
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.
|
@@ -43,15 +43,14 @@ import{a as _,n,r as w,i as $,x as c,t as k}from"../../vendor/vendor.js";import"
|
|
|
43
43
|
<div class="ripple-wrapper">
|
|
44
44
|
<textarea
|
|
45
45
|
class="scb-textfield"
|
|
46
|
+
.value=${this.value}
|
|
46
47
|
?disabled=${this.disabled}
|
|
47
48
|
name="${this.name}"
|
|
48
49
|
id="${this._inputId}"
|
|
49
50
|
?required=${this.required}
|
|
50
51
|
aria-invalid=${this.error?"true":"false"}
|
|
51
52
|
aria-describedby=${i}
|
|
52
|
-
>
|
|
53
|
-
${this.value}</textarea
|
|
54
|
-
>
|
|
53
|
+
></textarea>
|
|
55
54
|
<md-ripple></md-ripple>
|
|
56
55
|
<md-focus-ring class="input-ring"></md-focus-ring>
|
|
57
56
|
</div>
|
|
@@ -197,7 +196,7 @@ ${this.value}</textarea
|
|
|
197
196
|
<md-focus-ring class="input-ring"></md-focus-ring>
|
|
198
197
|
</div>
|
|
199
198
|
</div>
|
|
200
|
-
`}firstUpdated(e){super.firstUpdated(e),this._initialValue=this.value,l(this,r,m).call(this),l(this,r,f).call(this)
|
|
199
|
+
`}firstUpdated(e){super.firstUpdated(e),this._initialValue=this.value,this._internals&&this.value&&this._internals.setFormValue(this.value),l(this,r,m).call(this),l(this,r,f).call(this)}updated(e){if(super.updated(e),this.toggleAttribute("aria-disabled",this.disabled),e.has("size")&&this._syncDensityForSize(),this._internals&&(e.has("value")||e.has("disabled"))){const t=this.disabled?null:this.value;this._internals.setFormValue(t)}e.has("type")&&(l(this,r,m).call(this),this._hasRenderedOnce&&l(this,r,y).call(this)),(e.has("spacing")||e.has("spacingTop")||e.has("spacingBottom")||e.has("spacingLeft")||e.has("spacingRight"))&&l(this,r,f).call(this),this._hasRenderedOnce=!0}formDisabledCallback(e){this.disabled=e}connectedCallback(){super.connectedCallback(),this._syncDensityForSize(),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)),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)),l(this,r,x).call(this),window.removeEventListener("keydown",this._onGlobalKeydown,!0),window.removeEventListener("pointerdown",this._onGlobalPointerDown,!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();this.error=!t;const i=t?"":this.errorText||e.validationMessage||"Ogiltig inmatning.";return t||(this.errorText=i),this._internals&&(t?this._internals.setValidity({}):this._internals.setValidity({customError:!0},i,e)),t}return!0}_onClearClick(){const e=this.shadowRoot?.querySelector(".scb-textfield");if(e&&(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)){if(e.value="",this.value="",this._internals){const t=this.disabled?null:this.value;this._internals.setFormValue(t),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()}}};r=new WeakSet;f=function(){const e=l(this,r,u).call(this,this.spacing),t=l(this,r,u).call(this,this.spacingTop)??e,i=l(this,r,u).call(this,this.spacingBottom)??e,o=l(this,r,u).call(this,this.spacingLeft),d=l(this,r,u).call(this,this.spacingRight);t?this.style.setProperty("--scb-textfield-spacing-block-start",t):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"),o?this.style.setProperty("--scb-textfield-spacing-inline-start",o):this.style.removeProperty("--scb-textfield-spacing-inline-start"),d?this.style.setProperty("--scb-textfield-spacing-inline-end",d):this.style.removeProperty("--scb-textfield-spacing-inline-end")};u=function(e){if(!e)return;const t=String(e).trim();if(t)return/^\d+$/.test(t)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(t,10)))})`:t};g=function(){if(!this.pattern)return;if(!this.value){this.error=!1;return}const e=new RegExp(this.pattern);this.error=!e.test(this.value)};m=function(){const e=this.shadowRoot?.querySelector(".scb-textfield");e&&(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)&&this._boundField!==e&&(l(this,r,x).call(this),this._boundField=e,this.type!=="time"&&e.addEventListener("input",this._onFieldInput),e.addEventListener("change",this._onFieldChange),e.addEventListener("select",this._onFieldSelect),e.addEventListener("focus",this._onFieldFocus),e.addEventListener("blur",this._onFieldBlur))};x=function(){const e=this._boundField;e&&(e.removeEventListener("input",this._onFieldInput),e.removeEventListener("change",this._onFieldChange),e.removeEventListener("select",this._onFieldSelect),e.removeEventListener("focus",this._onFieldFocus),e.removeEventListener("blur",this._onFieldBlur),this._boundField=null)};y=function(){this._showDatepicker=!1;const e=this.shadowRoot?.querySelector(".scb-textfield");if(e&&(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)&&(e.value="",e.setCustomValidity("")),this.value="",this.error=!1,this._internals){const t=this.disabled?null:"";this._internals.setFormValue(t),this._internals.setValidity({})}};b=function(){const e=this.renderRoot?.querySelector(".ripple-wrapper");e&&(this._inputFocused&&this._kbShouldShowRing?e.setAttribute("data-kb-focus","true"):e.removeAttribute("data-kb-focus"))};s.formAssociated=!0;s.styles=[_`
|
|
201
200
|
:host {
|
|
202
201
|
--scb-textfield-number-max-width: 280px;
|
|
203
202
|
--scb-textfield-text-max-width: 400px;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "scb-wc-test",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.260",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "index.js",
|
|
@@ -382,5 +382,5 @@
|
|
|
382
382
|
},
|
|
383
383
|
"./mvc/*": "./mvc/*"
|
|
384
384
|
},
|
|
385
|
-
"buildHash": "
|
|
385
|
+
"buildHash": "48B5F131B8DB9CFE9460BFE488F5AC54293571568EEA714CDC92FD1AEBD7FCB0"
|
|
386
386
|
}
|
|
@@ -109,15 +109,14 @@ let s = class extends w {
|
|
|
109
109
|
<div class="ripple-wrapper">
|
|
110
110
|
<textarea
|
|
111
111
|
class="scb-textfield"
|
|
112
|
+
.value=${this.value}
|
|
112
113
|
?disabled=${this.disabled}
|
|
113
114
|
name="${this.name}"
|
|
114
115
|
id="${this._inputId}"
|
|
115
116
|
?required=${this.required}
|
|
116
117
|
aria-invalid=${this.error ? "true" : "false"}
|
|
117
118
|
aria-describedby=${i}
|
|
118
|
-
>
|
|
119
|
-
${this.value}</textarea
|
|
120
|
-
>
|
|
119
|
+
></textarea>
|
|
121
120
|
<md-ripple></md-ripple>
|
|
122
121
|
<md-focus-ring class="input-ring"></md-focus-ring>
|
|
123
122
|
</div>
|
|
@@ -283,14 +282,14 @@ ${this.value}</textarea
|
|
|
283
282
|
* Vi kör också ett customevent onValueChanged.
|
|
284
283
|
*/
|
|
285
284
|
firstUpdated(e) {
|
|
286
|
-
super.firstUpdated(e), this._initialValue = this.value, l(this, r, m).call(this), l(this, r, f).call(this)
|
|
285
|
+
super.firstUpdated(e), this._initialValue = this.value, this._internals && this.value && this._internals.setFormValue(this.value), l(this, r, m).call(this), l(this, r, f).call(this);
|
|
287
286
|
}
|
|
288
287
|
updated(e) {
|
|
289
288
|
if (super.updated(e), this.toggleAttribute("aria-disabled", this.disabled), e.has("size") && this._syncDensityForSize(), this._internals && (e.has("value") || e.has("disabled"))) {
|
|
290
289
|
const t = this.disabled ? null : this.value;
|
|
291
290
|
this._internals.setFormValue(t);
|
|
292
291
|
}
|
|
293
|
-
e.has("type") && (l(this, r, m).call(this), this._hasRenderedOnce && l(this, r, y).call(this)), (e.has("spacing") || e.has("spacingTop") || e.has("spacingBottom") || e.has("spacingLeft") || e.has("spacingRight")) && l(this, r, f).call(this);
|
|
292
|
+
e.has("type") && (l(this, r, m).call(this), this._hasRenderedOnce && l(this, r, y).call(this)), (e.has("spacing") || e.has("spacingTop") || e.has("spacingBottom") || e.has("spacingLeft") || e.has("spacingRight")) && l(this, r, f).call(this), this._hasRenderedOnce = !0;
|
|
294
293
|
}
|
|
295
294
|
// Körs av webbläsaren när formuläret sätter disabled på kontrollen
|
|
296
295
|
formDisabledCallback(e) {
|
package/scb-wc-test.bundle.js
CHANGED
|
@@ -3810,15 +3810,14 @@
|
|
|
3810
3810
|
<div class="ripple-wrapper">
|
|
3811
3811
|
<textarea
|
|
3812
3812
|
class="scb-textfield"
|
|
3813
|
+
.value=${this.value}
|
|
3813
3814
|
?disabled=${this.disabled}
|
|
3814
3815
|
name="${this.name}"
|
|
3815
3816
|
id="${this._inputId}"
|
|
3816
3817
|
?required=${this.required}
|
|
3817
3818
|
aria-invalid=${this.error?"true":"false"}
|
|
3818
3819
|
aria-describedby=${i}
|
|
3819
|
-
>
|
|
3820
|
-
${this.value}</textarea
|
|
3821
|
-
>
|
|
3820
|
+
></textarea>
|
|
3822
3821
|
<md-ripple></md-ripple>
|
|
3823
3822
|
<md-focus-ring class="input-ring"></md-focus-ring>
|
|
3824
3823
|
</div>
|
|
@@ -3964,7 +3963,7 @@ ${this.value}</textarea
|
|
|
3964
3963
|
<md-focus-ring class="input-ring"></md-focus-ring>
|
|
3965
3964
|
</div>
|
|
3966
3965
|
</div>
|
|
3967
|
-
`}firstUpdated(t){super.firstUpdated(t),this._initialValue=this.value,Ce(this,me,vl).call(this),Ce(this,me,ul).call(this)
|
|
3966
|
+
`}firstUpdated(t){super.firstUpdated(t),this._initialValue=this.value,this._internals&&this.value&&this._internals.setFormValue(this.value),Ce(this,me,vl).call(this),Ce(this,me,ul).call(this)}updated(t){if(super.updated(t),this.toggleAttribute("aria-disabled",this.disabled),t.has("size")&&this._syncDensityForSize(),this._internals&&(t.has("value")||t.has("disabled"))){const e=this.disabled?null:this.value;this._internals.setFormValue(e)}t.has("type")&&(Ce(this,me,vl).call(this),this._hasRenderedOnce&&Ce(this,me,Ud).call(this)),(t.has("spacing")||t.has("spacingTop")||t.has("spacingBottom")||t.has("spacingLeft")||t.has("spacingRight"))&&Ce(this,me,ul).call(this),this._hasRenderedOnce=!0}formDisabledCallback(t){this.disabled=t}connectedCallback(){super.connectedCallback(),this._syncDensityForSize(),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=()=>{var e;this.value=this._initialValue;const t=(e=this.shadowRoot)==null?void 0:e.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)),Ce(this,me,ml).call(this),window.removeEventListener("keydown",this._onGlobalKeydown,!0),window.removeEventListener("pointerdown",this._onGlobalPointerDown,!0)}reportValidity(){var e;const t=(e=this.shadowRoot)==null?void 0:e.querySelector(".scb-textfield");if(t&&(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement)){this.required&&!t.value?t.setCustomValidity(this.errorText||"Ogiltig inmatning."):t.setCustomValidity("");const i=t.reportValidity();this.error=!i;const r=i?"":this.errorText||t.validationMessage||"Ogiltig inmatning.";return i||(this.errorText=r),this._internals&&(i?this._internals.setValidity({}):this._internals.setValidity({customError:!0},r,t)),i}return!0}_onClearClick(){var e;const t=(e=this.shadowRoot)==null?void 0:e.querySelector(".scb-textfield");if(t&&(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement)){if(t.value="",this.value="",this._internals){const i=this.disabled?null:this.value;this._internals.setFormValue(i),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()}}};me=new WeakSet,ul=function(){const t=Ce(this,me,Gr).call(this,this.spacing),e=Ce(this,me,Gr).call(this,this.spacingTop)??t,i=Ce(this,me,Gr).call(this,this.spacingBottom)??t,r=Ce(this,me,Gr).call(this,this.spacingLeft),s=Ce(this,me,Gr).call(this,this.spacingRight);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"),r?this.style.setProperty("--scb-textfield-spacing-inline-start",r):this.style.removeProperty("--scb-textfield-spacing-inline-start"),s?this.style.setProperty("--scb-textfield-spacing-inline-end",s):this.style.removeProperty("--scb-textfield-spacing-inline-end")},Gr=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},bl=function(){if(!this.pattern)return;if(!this.value){this.error=!1;return}const t=new RegExp(this.pattern);this.error=!t.test(this.value)},vl=function(){var e;const t=(e=this.shadowRoot)==null?void 0:e.querySelector(".scb-textfield");t&&(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement)&&this._boundField!==t&&(Ce(this,me,ml).call(this),this._boundField=t,this.type!=="time"&&t.addEventListener("input",this._onFieldInput),t.addEventListener("change",this._onFieldChange),t.addEventListener("select",this._onFieldSelect),t.addEventListener("focus",this._onFieldFocus),t.addEventListener("blur",this._onFieldBlur))},ml=function(){const t=this._boundField;t&&(t.removeEventListener("input",this._onFieldInput),t.removeEventListener("change",this._onFieldChange),t.removeEventListener("select",this._onFieldSelect),t.removeEventListener("focus",this._onFieldFocus),t.removeEventListener("blur",this._onFieldBlur),this._boundField=null)},Ud=function(){var e;this._showDatepicker=!1;const t=(e=this.shadowRoot)==null?void 0:e.querySelector(".scb-textfield");if(t&&(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement)&&(t.value="",t.setCustomValidity("")),this.value="",this.error=!1,this._internals){const i=this.disabled?null:"";this._internals.setFormValue(i),this._internals.setValidity({})}},Ys=function(){var e;const t=(e=this.renderRoot)==null?void 0:e.querySelector(".ripple-wrapper");t&&(this._inputFocused&&this._kbShouldShowRing?t.setAttribute("data-kb-focus","true"):t.removeAttribute("data-kb-focus"))},ie.formAssociated=!0,ie.styles=[f`
|
|
3968
3967
|
:host {
|
|
3969
3968
|
--scb-textfield-number-max-width: 280px;
|
|
3970
3969
|
--scb-textfield-text-max-width: 400px;
|