scb-wc-test 0.1.322 → 0.1.324
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.
|
@@ -23,7 +23,7 @@ import{_ as S}from"../../vendor/preload-helper.js";import{a as L,n as a,i as E,x
|
|
|
23
23
|
</div>
|
|
24
24
|
`}return null}mapSpacingToken(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}__syncStringAttribute(t,e){this.__isSyncingManagedSocialAttributes=!0;try{typeof e=="string"&&e.trim()!==""?this.setAttribute(t,e):this.removeAttribute(t)}finally{this.__isSyncingManagedSocialAttributes=!1}}__syncNumberAttribute(t,e){this.__isSyncingManagedSocialAttributes=!0;try{typeof e=="number"&&Number.isFinite(e)?this.setAttribute(t,String(e)):this.removeAttribute(t)}finally{this.__isSyncingManagedSocialAttributes=!1}}__syncBooleanAttribute(t,e){this.__isSyncingManagedSocialAttributes=!0;try{e?this.setAttribute(t,""):this.removeAttribute(t)}finally{this.__isSyncingManagedSocialAttributes=!1}}__syncSocialAttributes(){this.type==="social"&&(this.__syncStringAttribute("social-comments-text",this.commentsText),this.__syncNumberAttribute("social-comments",this.comments),this.__syncStringAttribute("social-comments-href",this.commentsHref),this.__syncStringAttribute("social-likes-text",this.likesText),this.__syncNumberAttribute("social-likes",this.likes),this.__syncStringAttribute("social-likes-hover-content",this.likesHoverContent),this.__syncBooleanAttribute("social-has-liked",this.hasLiked),this.__syncBooleanAttribute("social-likes-interactive",this.likesInteractive),this.__syncBooleanAttribute("social-author",this.author),this.__syncStringAttribute("social-author-text",this.authorText),this.__syncStringAttribute("social-author-href",this.authorHref))}render(){const t=this.variant?`${this.variant.toLowerCase()}`:"",e=this.type==="list"||this.type==="container"?"vertical":this.direction?this.direction.toLowerCase():"vertical",n=this.__effectiveHref(),c=(this.type==="standard"||this.type==="social")&&!!n,o=c?"clickable":"",l=this.date instanceof Date?this.date.toISOString().slice(0,10):this.date||"",h=(g=!1)=>g?r`<a class="title" href="${n}" tabindex="-1"
|
|
25
25
|
>${this.title}</a
|
|
26
|
-
><md-icon>arrow_forward</md-icon>`:r`<span class="title">${this.title}</span>`,T=()=>this.
|
|
26
|
+
><md-icon>arrow_forward</md-icon>`:r`<span class="title">${this.title}</span>`,T=()=>this.__mediaTemplate(),b=g=>r`
|
|
27
27
|
<div
|
|
28
28
|
class="scb-card ${t} ${e} ${o}"
|
|
29
29
|
@click=${c?this.__handleHrefNavigation:null}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as _,n,r as w,i as $,x as d,t as z}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 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(i,c
|
|
1
|
+
import{a as _,n,r as w,i as $,x as d,t as z}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 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(i,o,c){try{customElements.get(i)||t(i,o,c)}catch(h){var p=String(h||"");if(p.indexOf("already been used")===-1&&p.indexOf("NotSupportedError")===-1)throw h}}}}catch{}})();var k=Object.defineProperty,E=Object.getOwnPropertyDescriptor,v=e=>{throw TypeError(e)},a=(e,t,i,o)=>{for(var c=o>1?void 0:o?E(t,i):t,p=e.length-1,h;p>=0;p--)(h=e[p])&&(c=(o?h(t,i,c):h(c))||c);return o&&c&&k(t,i,c),c},S=(e,t,i)=>t.has(e)||v("Cannot "+i),L=(e,t,i)=>t.has(e)?v("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,i),r=(e,t,i)=>(S(e,t,"access private method"),i),l,f,b,g,x,m,y,u;let s=class extends ${constructor(){super(),L(this,l),this._internals=null,this._inputFocused=!1,this._kbShouldShowRing=!1,this._onGlobalKeydown=e=>{e.key==="Tab"&&(this._kbShouldShowRing=!0,this._inputFocused&&r(this,l,u).call(this))},this._onGlobalPointerDown=()=>{this._kbShouldShowRing=!1,this._inputFocused&&r(this,l,u).call(this)},this._hasRenderedOnce=!1,this._boundField=null,this._onFieldInput=()=>{const e=this._boundField;if(!e)return;const t=e;if(this.value=t.value,this._internals){const i=this.disabled?null:this.value;this._internals.setFormValue(i)}r(this,l,g).call(this),this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("onValueChanged",{detail:{value:this.value},bubbles:!0,composed:!0}))},this._onFieldChange=()=>{this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))},this._onFieldSelect=()=>{this.dispatchEvent(new Event("select",{bubbles:!0,composed:!0}))},this._onFieldFocus=()=>{this._inputFocused=!0,r(this,l,u).call(this)},this._onFieldBlur=()=>{this._inputFocused=!1,r(this,l,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.size="large",this.spacing=void 0,this.spacingTop=void 0,this.spacingBottom=void 0,this.spacingLeft=void 0,this.spacingRight=void 0,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)}r(this,l,g).call(this),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())}_syncDensityForSize(){this.size==="extra-small"?this.setAttribute("data-density","-5"):this.size==="small"?this.setAttribute("data-density","-4"):this.size==="medium"?this.setAttribute("data-density","-2"):this.removeAttribute("data-density")}render(){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;this.underLabel=this.error?this.errorText||"Ogiltig inmatning.":this.supportingText,this.value=this.value||"";const i=this.underLabel?`${this._inputId}-supporting-text`:void 0,o=this.type==="search"&&this.value?d`
|
|
2
2
|
<button
|
|
3
3
|
type="button"
|
|
4
4
|
class="scb-textfield-clear"
|
|
@@ -182,7 +182,7 @@ import{a as _,n,r as w,i as $,x as d,t as z}from"../../vendor/vendor.js";import"
|
|
|
182
182
|
?required=${this.required}
|
|
183
183
|
aria-invalid=${this.error?"true":"false"}
|
|
184
184
|
aria-describedby=${i}
|
|
185
|
-
@input=${
|
|
185
|
+
@input=${c=>{const p=c.target;if(this.value=p.value,this._internals){const h=this.disabled?null:this.value;this._internals.setFormValue(h)}this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("onValueChanged",{detail:{value:this.value},bubbles:!0,composed:!0}))}}
|
|
186
186
|
/>
|
|
187
187
|
${t}
|
|
188
188
|
<md-ripple></md-ripple>
|
|
@@ -215,13 +215,13 @@ import{a as _,n,r as w,i as $,x as d,t as z}from"../../vendor/vendor.js";import"
|
|
|
215
215
|
aria-invalid=${this.error?"true":"false"}
|
|
216
216
|
aria-describedby=${i}
|
|
217
217
|
/>
|
|
218
|
-
${
|
|
218
|
+
${o}
|
|
219
219
|
${t}
|
|
220
220
|
<md-ripple></md-ripple>
|
|
221
221
|
<md-focus-ring class="input-ring"></md-focus-ring>
|
|
222
222
|
</div>
|
|
223
223
|
</div>
|
|
224
|
-
`}firstUpdated(e){super.firstUpdated(e),this._initialValue=this.value,this._internals&&this.value&&this._internals.setFormValue(this.value),r(this,l,x).call(this),r(this,l,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")&&(r(this,l,x).call(this),this._hasRenderedOnce&&r(this,l,y).call(this)),(e.has("spacing")||e.has("spacingTop")||e.has("spacingBottom")||e.has("spacingLeft")||e.has("spacingRight"))&&r(this,l,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)),r(this,l,m).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(
|
|
224
|
+
`}firstUpdated(e){super.firstUpdated(e),this._initialValue=this.value,this._internals&&this.value&&this._internals.setFormValue(this.value),r(this,l,x).call(this),r(this,l,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")&&(r(this,l,x).call(this),this._hasRenderedOnce&&r(this,l,y).call(this)),(e.has("spacing")||e.has("spacingTop")||e.has("spacingBottom")||e.has("spacingLeft")||e.has("spacingRight"))&&r(this,l,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)),r(this,l,m).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)){const t=this.errorText||"Ogiltig inmatning.";this.error||this.required&&!e.value?e.setCustomValidity(t):e.setCustomValidity("");const i=e.reportValidity();this.error=!i;const o=i?"":this.errorText||e.validationMessage||"Ogiltig inmatning.";return i||(this.errorText=o),this._internals&&(i?this._internals.setValidity({}):this._internals.setValidity({customError:!0},o,e)),i}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()}}};l=new WeakSet;f=function(){const e=r(this,l,b).call(this,this.spacing),t=r(this,l,b).call(this,this.spacingTop)??e,i=r(this,l,b).call(this,this.spacingBottom)??e,o=r(this,l,b).call(this,this.spacingLeft),c=r(this,l,b).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"),c?this.style.setProperty("--scb-textfield-spacing-inline-end",c):this.style.removeProperty("--scb-textfield-spacing-inline-end")};b=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)};x=function(){const e=this.shadowRoot?.querySelector(".scb-textfield");e&&(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)&&this._boundField!==e&&(r(this,l,m).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))};m=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({})}};u=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=[_`
|
|
225
225
|
:host {
|
|
226
226
|
--scb-textfield-number-max-width: 280px;
|
|
227
227
|
--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.324",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "index.js",
|
|
@@ -390,5 +390,5 @@
|
|
|
390
390
|
},
|
|
391
391
|
"./mvc/*": "./mvc/*"
|
|
392
392
|
},
|
|
393
|
-
"buildHash": "
|
|
393
|
+
"buildHash": "C6A67F12EB9180CEF557D85DC19F8EA5F9E7DD61209BFE28A9DA5E3CA66D42DB"
|
|
394
394
|
}
|
package/scb-card/scb-card.js
CHANGED
|
@@ -174,7 +174,7 @@ let i = class extends C {
|
|
|
174
174
|
render() {
|
|
175
175
|
const t = this.variant ? `${this.variant.toLowerCase()}` : "", e = this.type === "list" || this.type === "container" ? "vertical" : this.direction ? this.direction.toLowerCase() : "vertical", n = this.__effectiveHref(), c = (this.type === "standard" || this.type === "social") && !!n, o = c ? "clickable" : "", d = this.date instanceof Date ? this.date.toISOString().slice(0, 10) : this.date || "", h = (g = !1) => g ? r`<a class="title" href="${n}" tabindex="-1"
|
|
176
176
|
>${this.title}</a
|
|
177
|
-
><md-icon>arrow_forward</md-icon>` : r`<span class="title">${this.title}</span>`, T = () => this.
|
|
177
|
+
><md-icon>arrow_forward</md-icon>` : r`<span class="title">${this.title}</span>`, T = () => this.__mediaTemplate(), b = (g) => r`
|
|
178
178
|
<div
|
|
179
179
|
class="scb-card ${t} ${e} ${o}"
|
|
180
180
|
@click=${c ? this.__handleHrefNavigation : null}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { css as _, LitElement as w, html as
|
|
1
|
+
import { css as _, LitElement as w, html as c } from "lit";
|
|
2
2
|
import { property as n, state as $, customElement as z } from "lit/decorators.js";
|
|
3
3
|
import "@material/web/icon/icon.js";
|
|
4
4
|
import "@material/web/ripple/ripple.js";
|
|
@@ -7,10 +7,10 @@ import "../scb-datepicker/scb-datepicker.js";
|
|
|
7
7
|
import "../scb-icon-button/scb-icon-button.js";
|
|
8
8
|
var k = Object.defineProperty, E = Object.getOwnPropertyDescriptor, v = (e) => {
|
|
9
9
|
throw TypeError(e);
|
|
10
|
-
}, a = (e, t, i,
|
|
11
|
-
for (var
|
|
12
|
-
(b = e[h]) && (
|
|
13
|
-
return
|
|
10
|
+
}, a = (e, t, i, d) => {
|
|
11
|
+
for (var o = d > 1 ? void 0 : d ? E(t, i) : t, h = e.length - 1, b; h >= 0; h--)
|
|
12
|
+
(b = e[h]) && (o = (d ? b(t, i, o) : b(o)) || o);
|
|
13
|
+
return d && o && k(t, i, o), o;
|
|
14
14
|
}, L = (e, t, i) => t.has(e) || v("Cannot " + i), S = (e, t, i) => t.has(e) ? v("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, i), r = (e, t, i) => (L(e, t, "access private method"), i), l, f, p, g, x, m, y, u;
|
|
15
15
|
let s = class extends w {
|
|
16
16
|
constructor() {
|
|
@@ -61,9 +61,9 @@ let s = class extends w {
|
|
|
61
61
|
this.size === "extra-small" ? this.setAttribute("data-density", "-5") : this.size === "small" ? this.setAttribute("data-density", "-4") : this.size === "medium" ? this.setAttribute("data-density", "-2") : this.removeAttribute("data-density");
|
|
62
62
|
}
|
|
63
63
|
render() {
|
|
64
|
-
const e = this.leadingIcon ?
|
|
64
|
+
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;
|
|
65
65
|
this.underLabel = this.error ? this.errorText || "Ogiltig inmatning." : this.supportingText, this.value = this.value || "";
|
|
66
|
-
const i = this.underLabel ? `${this._inputId}-supporting-text` : void 0,
|
|
66
|
+
const i = this.underLabel ? `${this._inputId}-supporting-text` : void 0, d = this.type === "search" && this.value ? c`
|
|
67
67
|
<button
|
|
68
68
|
type="button"
|
|
69
69
|
class="scb-textfield-clear"
|
|
@@ -98,14 +98,14 @@ let s = class extends w {
|
|
|
98
98
|
</svg>
|
|
99
99
|
</button>
|
|
100
100
|
` : null;
|
|
101
|
-
return this.type === "textarea" ?
|
|
101
|
+
return this.type === "textarea" ? c`
|
|
102
102
|
<label
|
|
103
103
|
class="scb-textfield-label ${this.underLabel ? "" : "scb-textfield-label--without-supporting"}"
|
|
104
104
|
for="${this._inputId}"
|
|
105
105
|
>
|
|
106
106
|
${this.label}
|
|
107
107
|
</label>
|
|
108
|
-
${this.underLabel ?
|
|
108
|
+
${this.underLabel ? c`
|
|
109
109
|
<span class="scb-textfield-supporting-text" id="${this._inputId}-supporting-text">
|
|
110
110
|
${this.underLabel}
|
|
111
111
|
</span>
|
|
@@ -126,14 +126,14 @@ let s = class extends w {
|
|
|
126
126
|
<md-focus-ring class="input-ring"></md-focus-ring>
|
|
127
127
|
</div>
|
|
128
128
|
</div>
|
|
129
|
-
` : this.type === "date" ?
|
|
129
|
+
` : this.type === "date" ? c`
|
|
130
130
|
<label
|
|
131
131
|
class="scb-textfield-label ${this.underLabel ? "" : "scb-textfield-label--without-supporting"}"
|
|
132
132
|
for="${this._inputId}"
|
|
133
133
|
>
|
|
134
134
|
${this.label}
|
|
135
135
|
</label>
|
|
136
|
-
${this.underLabel ?
|
|
136
|
+
${this.underLabel ? c`
|
|
137
137
|
<span class="scb-textfield-supporting-text" id="${this._inputId}-supporting-text">
|
|
138
138
|
${this.underLabel}
|
|
139
139
|
</span>
|
|
@@ -158,7 +158,7 @@ let s = class extends w {
|
|
|
158
158
|
<md-ripple></md-ripple>
|
|
159
159
|
<md-focus-ring class="input-ring"></md-focus-ring>
|
|
160
160
|
</div>
|
|
161
|
-
${this.error ? t :
|
|
161
|
+
${this.error ? t : c`
|
|
162
162
|
<scb-icon-button
|
|
163
163
|
class="scb-textfield-datepicker-button"
|
|
164
164
|
icon="calendar_today"
|
|
@@ -173,14 +173,14 @@ let s = class extends w {
|
|
|
173
173
|
@date-selected=${this._onDateSelected}
|
|
174
174
|
></scb-datepicker>
|
|
175
175
|
</div>
|
|
176
|
-
` : this.type === "datetime-local" ?
|
|
176
|
+
` : this.type === "datetime-local" ? c`
|
|
177
177
|
<label
|
|
178
178
|
class="scb-textfield-label ${this.underLabel ? "" : "scb-textfield-label--without-supporting"}"
|
|
179
179
|
for="${this._inputId}"
|
|
180
180
|
>
|
|
181
181
|
${this.label}
|
|
182
182
|
</label>
|
|
183
|
-
${this.underLabel ?
|
|
183
|
+
${this.underLabel ? c`
|
|
184
184
|
<span class="scb-textfield-supporting-text" id="${this._inputId}-supporting-text">
|
|
185
185
|
${this.underLabel}
|
|
186
186
|
</span>
|
|
@@ -207,7 +207,7 @@ let s = class extends w {
|
|
|
207
207
|
<md-focus-ring class="input-ring"></md-focus-ring>
|
|
208
208
|
</div>
|
|
209
209
|
|
|
210
|
-
${this.error ? t :
|
|
210
|
+
${this.error ? t : c`
|
|
211
211
|
<scb-icon-button
|
|
212
212
|
class="scb-textfield-datepicker-button"
|
|
213
213
|
icon="calendar_today"
|
|
@@ -223,14 +223,14 @@ let s = class extends w {
|
|
|
223
223
|
@date-selected=${this._onDateSelected}
|
|
224
224
|
></scb-datepicker>
|
|
225
225
|
</div>
|
|
226
|
-
` : this.type === "time" ?
|
|
226
|
+
` : this.type === "time" ? c`
|
|
227
227
|
<label
|
|
228
228
|
class="scb-textfield-label ${this.underLabel ? "" : "scb-textfield-label--without-supporting"}"
|
|
229
229
|
for="${this._inputId}"
|
|
230
230
|
>
|
|
231
231
|
${this.label}
|
|
232
232
|
</label>
|
|
233
|
-
${this.underLabel ?
|
|
233
|
+
${this.underLabel ? c`
|
|
234
234
|
<span class="scb-textfield-supporting-text" id="${this._inputId}-supporting-text">
|
|
235
235
|
${this.underLabel}
|
|
236
236
|
</span>
|
|
@@ -248,8 +248,8 @@ let s = class extends w {
|
|
|
248
248
|
?required=${this.required}
|
|
249
249
|
aria-invalid=${this.error ? "true" : "false"}
|
|
250
250
|
aria-describedby=${i}
|
|
251
|
-
@input=${(
|
|
252
|
-
const h =
|
|
251
|
+
@input=${(o) => {
|
|
252
|
+
const h = o.target;
|
|
253
253
|
if (this.value = h.value, this._internals) {
|
|
254
254
|
const b = this.disabled ? null : this.value;
|
|
255
255
|
this._internals.setFormValue(b);
|
|
@@ -268,14 +268,14 @@ let s = class extends w {
|
|
|
268
268
|
<md-focus-ring class="input-ring"></md-focus-ring>
|
|
269
269
|
</div>
|
|
270
270
|
</div>
|
|
271
|
-
` :
|
|
271
|
+
` : c`
|
|
272
272
|
<label
|
|
273
273
|
class="scb-textfield-label ${this.underLabel ? "" : "scb-textfield-label--without-supporting"}"
|
|
274
274
|
for="${this._inputId}"
|
|
275
275
|
>
|
|
276
276
|
${this.label}
|
|
277
277
|
</label>
|
|
278
|
-
${this.underLabel ?
|
|
278
|
+
${this.underLabel ? c`
|
|
279
279
|
<span class="scb-textfield-supporting-text" id="${this._inputId}-supporting-text">
|
|
280
280
|
${this.underLabel}
|
|
281
281
|
</span>
|
|
@@ -294,7 +294,7 @@ let s = class extends w {
|
|
|
294
294
|
aria-invalid=${this.error ? "true" : "false"}
|
|
295
295
|
aria-describedby=${i}
|
|
296
296
|
/>
|
|
297
|
-
${
|
|
297
|
+
${d}
|
|
298
298
|
${t}
|
|
299
299
|
<md-ripple></md-ripple>
|
|
300
300
|
<md-focus-ring class="input-ring"></md-focus-ring>
|
|
@@ -341,11 +341,12 @@ let s = class extends w {
|
|
|
341
341
|
var t;
|
|
342
342
|
const e = (t = this.shadowRoot) == null ? void 0 : t.querySelector(".scb-textfield");
|
|
343
343
|
if (e && (e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement)) {
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
344
|
+
const i = this.errorText || "Ogiltig inmatning.";
|
|
345
|
+
this.error || this.required && !e.value ? e.setCustomValidity(i) : e.setCustomValidity("");
|
|
346
|
+
const d = e.reportValidity();
|
|
347
|
+
this.error = !d;
|
|
348
|
+
const o = d ? "" : this.errorText || e.validationMessage || "Ogiltig inmatning.";
|
|
349
|
+
return d || (this.errorText = o), this._internals && (d ? this._internals.setValidity({}) : this._internals.setValidity({ customError: !0 }, o, e)), d;
|
|
349
350
|
}
|
|
350
351
|
return !0;
|
|
351
352
|
}
|
|
@@ -373,8 +374,8 @@ let s = class extends w {
|
|
|
373
374
|
};
|
|
374
375
|
l = /* @__PURE__ */ new WeakSet();
|
|
375
376
|
f = function() {
|
|
376
|
-
const e = r(this, l, p).call(this, this.spacing), t = r(this, l, p).call(this, this.spacingTop) ?? e, i = r(this, l, p).call(this, this.spacingBottom) ?? e,
|
|
377
|
-
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"),
|
|
377
|
+
const e = r(this, l, p).call(this, this.spacing), t = r(this, l, p).call(this, this.spacingTop) ?? e, i = r(this, l, p).call(this, this.spacingBottom) ?? e, d = r(this, l, p).call(this, this.spacingLeft), o = r(this, l, p).call(this, this.spacingRight);
|
|
378
|
+
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"), d ? this.style.setProperty("--scb-textfield-spacing-inline-start", d) : this.style.removeProperty("--scb-textfield-spacing-inline-start"), o ? this.style.setProperty("--scb-textfield-spacing-inline-end", o) : this.style.removeProperty("--scb-textfield-spacing-inline-end");
|
|
378
379
|
};
|
|
379
380
|
p = function(e) {
|
|
380
381
|
if (!e) return;
|
package/scb-wc-test.bundle.js
CHANGED
|
@@ -3989,7 +3989,7 @@
|
|
|
3989
3989
|
<md-focus-ring class="input-ring"></md-focus-ring>
|
|
3990
3990
|
</div>
|
|
3991
3991
|
</div>
|
|
3992
|
-
`}firstUpdated(e){super.firstUpdated(e),this._initialValue=this.value,this._internals&&this.value&&this._internals.setFormValue(this.value),Me(this,xe,Tl).call(this),Me(this,xe,Cl).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")&&(Me(this,xe,Tl).call(this),this._hasRenderedOnce&&Me(this,xe,fp).call(this)),(e.has("spacing")||e.has("spacingTop")||e.has("spacingBottom")||e.has("spacingLeft")||e.has("spacingRight"))&&Me(this,xe,Cl).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=()=>{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)),Me(this,xe,Al).call(this),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(
|
|
3992
|
+
`}firstUpdated(e){super.firstUpdated(e),this._initialValue=this.value,this._internals&&this.value&&this._internals.setFormValue(this.value),Me(this,xe,Tl).call(this),Me(this,xe,Cl).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")&&(Me(this,xe,Tl).call(this),this._hasRenderedOnce&&Me(this,xe,fp).call(this)),(e.has("spacing")||e.has("spacingTop")||e.has("spacingBottom")||e.has("spacingLeft")||e.has("spacingRight"))&&Me(this,xe,Cl).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=()=>{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)),Me(this,xe,Al).call(this),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)){const i=this.errorText||"Ogiltig inmatning.";this.error||this.required&&!e.value?e.setCustomValidity(i):e.setCustomValidity("");const s=e.reportValidity();this.error=!s;const r=s?"":this.errorText||e.validationMessage||"Ogiltig inmatning.";return s||(this.errorText=r),this._internals&&(s?this._internals.setValidity({}):this._internals.setValidity({customError:!0},r,e)),s}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()}}};xe=new WeakSet,Cl=function(){const e=Me(this,xe,er).call(this,this.spacing),t=Me(this,xe,er).call(this,this.spacingTop)??e,i=Me(this,xe,er).call(this,this.spacingBottom)??e,s=Me(this,xe,er).call(this,this.spacingLeft),r=Me(this,xe,er).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"),s?this.style.setProperty("--scb-textfield-spacing-inline-start",s):this.style.removeProperty("--scb-textfield-spacing-inline-start"),r?this.style.setProperty("--scb-textfield-spacing-inline-end",r):this.style.removeProperty("--scb-textfield-spacing-inline-end")},er=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},El=function(){if(!this.pattern)return;if(!this.value){this.error=!1;return}const e=new RegExp(this.pattern);this.error=!e.test(this.value)},Tl=function(){var t;const e=(t=this.shadowRoot)==null?void 0:t.querySelector(".scb-textfield");e&&(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)&&this._boundField!==e&&(Me(this,xe,Al).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))},Al=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)},fp=function(){var t;this._showDatepicker=!1;const e=(t=this.shadowRoot)==null?void 0:t.querySelector(".scb-textfield");if(e&&(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)&&(e.value="",e.setCustomValidity("")),this.value="",this.error=!1,this._internals){const i=this.disabled?null:"";this._internals.setFormValue(i),this._internals.setValidity({})}},ra=function(){var t;const e=(t=this.renderRoot)==null?void 0:t.querySelector(".ripple-wrapper");e&&(this._inputFocused&&this._kbShouldShowRing?e.setAttribute("data-kb-focus","true"):e.removeAttribute("data-kb-focus"))},ne.formAssociated=!0,ne.styles=[g`
|
|
3993
3993
|
:host {
|
|
3994
3994
|
--scb-textfield-number-max-width: 280px;
|
|
3995
3995
|
--scb-textfield-text-max-width: 400px;
|
|
@@ -5817,7 +5817,7 @@
|
|
|
5817
5817
|
</div>
|
|
5818
5818
|
`}return null}mapSpacingToken(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}__syncStringAttribute(e,t){this.__isSyncingManagedSocialAttributes=!0;try{typeof t=="string"&&t.trim()!==""?this.setAttribute(e,t):this.removeAttribute(e)}finally{this.__isSyncingManagedSocialAttributes=!1}}__syncNumberAttribute(e,t){this.__isSyncingManagedSocialAttributes=!0;try{typeof t=="number"&&Number.isFinite(t)?this.setAttribute(e,String(t)):this.removeAttribute(e)}finally{this.__isSyncingManagedSocialAttributes=!1}}__syncBooleanAttribute(e,t){this.__isSyncingManagedSocialAttributes=!0;try{t?this.setAttribute(e,""):this.removeAttribute(e)}finally{this.__isSyncingManagedSocialAttributes=!1}}__syncSocialAttributes(){this.type==="social"&&(this.__syncStringAttribute("social-comments-text",this.commentsText),this.__syncNumberAttribute("social-comments",this.comments),this.__syncStringAttribute("social-comments-href",this.commentsHref),this.__syncStringAttribute("social-likes-text",this.likesText),this.__syncNumberAttribute("social-likes",this.likes),this.__syncStringAttribute("social-likes-hover-content",this.likesHoverContent),this.__syncBooleanAttribute("social-has-liked",this.hasLiked),this.__syncBooleanAttribute("social-likes-interactive",this.likesInteractive),this.__syncBooleanAttribute("social-author",this.author),this.__syncStringAttribute("social-author-text",this.authorText),this.__syncStringAttribute("social-author-href",this.authorHref))}render(){const e=this.variant?`${this.variant.toLowerCase()}`:"",t=this.type==="list"||this.type==="container"?"vertical":this.direction?this.direction.toLowerCase():"vertical",i=this.__effectiveHref(),s=(this.type==="standard"||this.type==="social")&&!!i,r=s?"clickable":"",a=this.date instanceof Date?this.date.toISOString().slice(0,10):this.date||"",n=(h=!1)=>h?c`<a class="title" href="${i}" tabindex="-1"
|
|
5819
5819
|
>${this.title}</a
|
|
5820
|
-
><md-icon>arrow_forward</md-icon>`:c`<span class="title">${this.title}</span>`,l=()=>this.
|
|
5820
|
+
><md-icon>arrow_forward</md-icon>`:c`<span class="title">${this.title}</span>`,l=()=>this.__mediaTemplate(),d=h=>c`
|
|
5821
5821
|
<div
|
|
5822
5822
|
class="scb-card ${e} ${t} ${r}"
|
|
5823
5823
|
@click=${s?this.__handleHrefNavigation:null}
|