scb-wc 0.1.83 → 0.1.85
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -41
- package/all.js +5 -0
- package/fonts/material-symbols-outlined/files/material-symbols-outlined-subset.woff2 +0 -0
- package/index.js +93 -88
- package/mvc/components/all.js +5 -0
- package/mvc/components/scb-accordion/scb-accordion-item.js +1 -1
- package/mvc/components/scb-button/scb-button.js +3 -3
- package/mvc/components/scb-calendar/scb-calendar.js +1 -1
- package/mvc/components/scb-calendar-card/scb-calendar-card.js +4 -4
- package/mvc/components/scb-card/scb-card.js +5 -5
- package/mvc/{vendor → components/scb-chevron}/scb-chevron.js +1 -1
- package/mvc/components/scb-datepicker/scb-datepicker.js +118 -0
- package/mvc/components/scb-dropdown/scb-dropdown.js +1 -1
- package/mvc/components/scb-header/scb-header.js +2 -2
- package/mvc/components/scb-horizontal-scroller/scb-horizontal-scroller.js +13 -23
- package/mvc/components/scb-icon-button/scb-icon-button.js +5 -5
- package/mvc/components/scb-keyfigure-card/scb-keyfigure-card.js +6 -6
- package/mvc/components/scb-list/scb-list-item.js +2 -2
- package/mvc/components/scb-menu/scb-menu-item.js +1 -1
- package/mvc/components/scb-nav/scb-nav.js +27 -5
- package/mvc/components/scb-options-menu/scb-options-menu-item.js +1 -1
- package/mvc/components/scb-progress-stepper/scb-progress-step.js +2 -2
- package/mvc/components/scb-search/scb-search.js +1 -1
- package/mvc/components/scb-segmented-button/scb-segmented-item.js +1 -1
- package/mvc/components/scb-select/scb-select-option.js +1 -1
- package/mvc/components/scb-select/scb-select.js +1 -1
- package/mvc/components/scb-stepper/scb-step.js +1 -1
- package/mvc/components/scb-textfield/scb-textfield.js +24 -141
- package/mvc/components/scb-toc/scb-toc-item.js +1 -1
- package/mvc/components/shared/lazy-focus-ring.js +2 -0
- package/mvc/components/shared/lazy-ripple.js +2 -0
- package/mvc/components/shared/scb-icon-svg.js +11 -0
- package/mvc/fonts/material-symbols-outlined/files/material-symbols-outlined-subset.woff2 +0 -0
- package/package.json +2 -2
- package/scb-chevron/scb-chevron.js +1 -0
- package/scb-components/index.d.ts +102 -0
- package/scb-components/scb-chevron/scb-chevron.d.ts +11 -0
- package/scb-components/scb-datepicker/scb-datepicker.d.ts +41 -0
- package/scb-components/scb-nav/scb-nav.d.ts +14 -0
- package/scb-components/shared/lazy-focus-ring.d.ts +4 -0
- package/scb-components/shared/lazy-ripple.d.ts +9 -0
- package/scb-components/shared/scb-icon-svg.d.ts +3 -0
- package/scb-datepicker/scb-datepicker.js +1 -0
- package/scb-horizontal-scroller/scb-horizontal-scroller.js +50 -6
- package/scb-nav/scb-nav.js +289 -31
- package/scb-wc.bundle.js +526 -273
- package/scb-wc.d.ts +204 -194
- package/mvc/vendor/lazy-focus-ring.js +0 -2
- package/mvc/vendor/lazy-ripple.js +0 -2
- package/scb-wc-public-entry/index.d.ts +0 -97
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{f as b,h as f,m as u,p as l,v as r,y as m}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import"../../vendor/ripple.js";import{
|
|
1
|
+
import{f as b,h as f,m as u,p as l,v as r,y as m}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import"../../vendor/ripple.js";import{ensureFocusRingOnFocusVisible as c}from"../shared/lazy-focus-ring.js";import{t as o}from"../../vendor/decorate.js";(function(){try{var a=typeof globalThis<"u"?globalThis:window;if(!a.__scb_ce_guard_installed__){a.__scb_ce_guard_installed__=!0;var t=customElements.define.bind(customElements);customElements.define=function(s,i,h){try{customElements.get(s)||t(s,i,h)}catch(d){var n=String(d||"");if(n.indexOf("already been used")===-1&&n.indexOf("NotSupportedError")===-1)throw d}}}}catch{}})();var p,e=(p=class extends f{constructor(...t){super(...t),this.width="100%",this.active=!1,this.disabled=!1,this.href="",this.label="",this.position="top",this._stepId=`scb-step-${Math.random().toString(36).slice(2)}`}updated(t){super.updated?.(t),this.style.setProperty("--progress-step-width",this.width)}_onClick(){const t={width:this.width,label:this.label,active:this.active,disabled:this.disabled,href:this.href||void 0};this.dispatchEvent(new CustomEvent("step-click",{detail:t,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("stepclick",{detail:t,bubbles:!0,composed:!0}))}firstUpdated(t){super.firstUpdated?.(t),this._setupTooltipPositioning()}_setupTooltipPositioning(){new MutationObserver(()=>this._adjustTooltipPosition()).observe(this,{attributes:!0,childList:!0,subtree:!0}),window.addEventListener("resize",()=>this._adjustTooltipPosition())}_adjustTooltipPosition(){const t=this.renderRoot.querySelector(".tooltip");if(!t)return;t.style.left="50%",t.style.right="",t.style.transform="translateX(-50%)",t.classList.remove("tooltip-left","tooltip-right");const s=t.getBoundingClientRect(),i=8;s.right>window.innerWidth-i&&(t.style.left="auto",t.style.right=`${i}px`,t.style.transform="none",t.classList.add("tooltip-right")),s.left<i&&(t.style.left=`${i}px`,t.style.right="auto",t.style.transform="none",t.classList.add("tooltip-left"))}render(){return r`
|
|
2
2
|
${this.href&&!this.disabled?r`
|
|
3
3
|
<a
|
|
4
4
|
id=${this._stepId}
|
|
@@ -27,4 +27,4 @@ import{f as b,h as f,m as u,p as l,v as r,y as m}from"../../vendor/vendor.js";im
|
|
|
27
27
|
`}
|
|
28
28
|
${this.disabled?"":r`<md-focus-ring for="${this._stepId}"></md-focus-ring>`}
|
|
29
29
|
${this.label&&!this.disabled?r`<div class="tooltip ${this.position==="bottom"?"bottom":"top"}">${this.label}</div>`:""}
|
|
30
|
-
`}},
|
|
30
|
+
`}},p.styles=m`:host{display:block;width:var(--progress-step-width, 100%);height:100%;cursor:pointer;background:0 0;position:relative}.progress-step{width:100%;height:100%;background:0 0;position:relative;overflow:hidden;border-right:2px solid var(--md-sys-color-surface);outline:0;box-shadow:none;display:block}:host(.last-step) .progress-step{border-right:none!important}.progress-step:focus{outline:0;box-shadow:none}:host([active]) .progress-step{border-right:2px solid var(--md-sys-color-surface)}:host([disabled]){cursor:not-allowed}:host([disabled]) .progress-step{background:#e6e6e699;border-right:2px solid #e6e6e699}md-focus-ring{pointer-events:none;position:absolute;inset:0;opacity:0;border-radius:0;transition:opacity .15s;z-index:4}.progress-step:focus+md-focus-ring,.progress-step:focus-visible+md-focus-ring{opacity:1}.tooltip{visibility:hidden;opacity:0;position:absolute;left:50%;transform:translateX(-50%);z-index:10;max-width:220px;width:max-content;background:var(--md-sys-color-inverse-surface);border-radius:var(--md-sys-shape-corner-extra-small);padding:var(--spacing-2) var(--spacing-3);color:var(--md-sys-color-inverse-on-surface);font-family:var(--brand-font);font-size:var(--md-sys-typescale-body-small-size);font-style:normal;line-height:var(--md-sys-typescale-body-small-line-height);letter-spacing:var(--md-sys-typescale-body-small-tracking);white-space:normal;pointer-events:none;transition:opacity .2s,visibility .2s;text-align:center}.tooltip.top{top:calc(100% + 10px)}.tooltip.bottom{bottom:calc(100% + 10px)}.progress-step:focus~.tooltip,.progress-step:hover~.tooltip{visibility:visible;opacity:1}.tooltip::after{content:"";position:absolute;left:50%;transform:translateX(-50%);width:0;height:0;pointer-events:none;display:block}.tooltip.bottom::after,.tooltip.top::after{border-left:8px solid transparent;border-right:8px solid transparent}.tooltip.top::after{top:-6px;border-bottom:8px solid var(--md-sys-color-inverse-surface);border-top:none}.tooltip.bottom::after{bottom:-6px;border-top:8px solid var(--md-sys-color-inverse-surface);border-bottom:none}.tooltip.tooltip-left::after{left:2px;transform:none}.tooltip.tooltip-right::after{right:2px;left:auto;transform:none}`,p);o([l({type:String})],e.prototype,"width",void 0);o([l({type:Boolean,reflect:!0})],e.prototype,"active",void 0);o([l({type:Boolean,reflect:!0})],e.prototype,"disabled",void 0);o([l({type:String,reflect:!0})],e.prototype,"href",void 0);o([l({type:String})],e.prototype,"label",void 0);o([l({type:String})],e.prototype,"position",void 0);o([b()],e.prototype,"_stepId",void 0);e=o([u("scb-progress-step")],e);export{e as ScbProgressStep};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../scb-list/scb-list.js","../../vendor/decorate.js","../../vendor/vendor.js","../../vendor/vendor-lit.js","../scb-list/scb-list-item.js","../../vendor/preload-helper.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{f as x,g as v,h as S,m as w,p as o,v as h,y as A}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import"../../vendor/icon.js";import"../../vendor/ripple.js";import{t as k}from"../../vendor/preload-helper.js";import{
|
|
2
|
+
import{f as x,g as v,h as S,m as w,p as o,v as h,y as A}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import"../../vendor/icon.js";import"../../vendor/ripple.js";import{t as k}from"../../vendor/preload-helper.js";import{ensureFocusRingReady as E}from"../shared/lazy-focus-ring.js";import{t as a}from"../../vendor/decorate.js";(function(){try{var u=typeof globalThis<"u"?globalThis:window;if(!u.__scb_ce_guard_installed__){u.__scb_ce_guard_installed__=!0;var t=customElements.define.bind(customElements);customElements.define=function(e,s,r){try{customElements.get(e)||t(e,s,r)}catch(l){var i=String(l||"");if(i.indexOf("already been used")===-1&&i.indexOf("NotSupportedError")===-1)throw l}}}}catch{}})();var d,I=0,n=(d=class extends S{async _ensureListDepsLoaded(){this._listDepsLoaded||(this._listDepsPromise??(this._listDepsPromise=k(()=>import("../scb-list/scb-list.js").then(()=>{this._listDepsLoaded=!0}),__vite__mapDeps([0,1,2,3,4,5]),import.meta.url)),await this._listDepsPromise)}_ensureListDepsWhenNeeded(){const t=(this.value??"").trim().length>0;!this._inputFocused||!t||!this._hasSuggestions||this._ensureListDepsLoaded().then(()=>this.requestUpdate())}constructor(){super(),this._internals=null,this.supportingText="",this.value="",this.name="",this.disabled=!1,this.required=!1,this.autocomplete=!1,this.spacing=void 0,this.spacingTop=void 0,this.spacingBottom=void 0,this.spacingLeft=void 0,this.spacingRight=void 0,this.size="large",this.fullScreen=!1,this._inputFocused=!1,this._visibleSuggestions=0,this._listDepsLoaded=!1,this._activeIndex=-1,this._listboxId=`scb-search-listbox-${++I}`,this._kbMode=!1,this._valueOnFocus="",this._lastChangeValue="",this._kbShouldShowRing=!1,this._onGlobalKeydown=t=>{t.key==="Tab"&&(E(),this._kbShouldShowRing=!0,this._inputFocused&&this._updateInputRingVisibility())},this._onGlobalPointerDown=()=>{this._kbShouldShowRing=!1,this._inputFocused&&this._updateInputRingVisibility()},this._form=null,this._formResetHandler=null,this._formSubmitHandler=null,this._initialValue="",this._customValidationMessage="",this._listScrollHandler=()=>{const t=this._getActiveItem();this._kbMode&&t&&this._positionOptionRing(t)},"attachInternals"in this&&(this._internals=this.attachInternals())}_syncDensityForSize(){this.size==="small"?this.setAttribute("data-density","-4"):this.size==="medium"?this.setAttribute("data-density","-2"):this.removeAttribute("data-density")}connectedCallback(){super.connectedCallback(),this._syncDensityForSize(),this._onWindowResize=this._onWindowResize.bind(this),window.addEventListener("resize",this._onWindowResize,{passive:!0}),window.addEventListener("keydown",this._onGlobalKeydown,!0),window.addEventListener("pointerdown",this._onGlobalPointerDown,!0),this._initialValue=this.value??"",this._lastChangeValue=this.value??"",this._form=this.closest("form"),this._form&&(this._formSubmitHandler=t=>{this.reportValidity()||(t.preventDefault(),t.stopPropagation())},this._form.addEventListener("submit",this._formSubmitHandler,!0),this._formResetHandler=()=>{this.value=this._initialValue;const t=this._inputEl();t&&(t.value=this._initialValue),this._lastChangeValue=this._initialValue,this._syncFormValue(),this._filterSuggestions(this.value),this._activeIndex=-1,this._kbMode=!1,this._updateComboboxA11y()},this._form.addEventListener("reset",this._formResetHandler,!0)),this._syncFormValue(),this._syncValidity()}disconnectedCallback(){const t=this._inputEl();t&&this._boundNativeKeydown&&t.removeEventListener("keydown",this._boundNativeKeydown,!0),this._detachListScrollListener(),window.removeEventListener("resize",this._onWindowResize),window.removeEventListener("keydown",this._onGlobalKeydown,!0),window.removeEventListener("pointerdown",this._onGlobalPointerDown,!0),this._form&&this._formResetHandler&&this._form.removeEventListener("reset",this._formResetHandler,!0),this._form&&this._formSubmitHandler&&this._form.removeEventListener("submit",this._formSubmitHandler,!0),super.disconnectedCallback()}firstUpdated(){this._ensureListboxA11y(),this._updateComboboxA11y();const t=this._inputEl();t&&(this._boundNativeKeydown=e=>this._handleKey(e),t.addEventListener("keydown",this._boundNativeKeydown,!0),t.disabled=this.disabled),this.applySpacing()}updated(t){if(super.updated(t),t.has("size")&&this._syncDensityForSize(),this._ensureListboxA11y(),this._updateComboboxA11y(),this._attachListScrollListener(),(t.has("value")||t.has("disabled"))&&this._syncFormValue(),(t.has("value")||t.has("disabled")||t.has("required"))&&this._syncValidity(),t.has("disabled")){this.toggleAttribute("aria-disabled",this.disabled);const e=this._inputEl();e&&(e.disabled=this.disabled)}(t.has("spacing")||t.has("spacingTop")||t.has("spacingBottom")||t.has("spacingLeft")||t.has("spacingRight"))&&this.applySpacing()}render(){const t=(this.value??"").trim().length>0,e=this._inputFocused&&t&&this._hasSuggestions&&this._listDepsLoaded;return h`
|
|
3
3
|
<div class="ripple-wrapper">
|
|
4
4
|
<md-icon class="leading">${t?"arrow_back":"search"}</md-icon>
|
|
5
5
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{h as m,m as p,p as n,v as s,y as f}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import"../../vendor/icon.js";import"../../vendor/ripple.js";import{
|
|
1
|
+
import{h as m,m as p,p as n,v as s,y as f}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import"../../vendor/icon.js";import"../../vendor/ripple.js";import{ensureFocusRingOnFocusVisible as h}from"../shared/lazy-focus-ring.js";import{t as o}from"../../vendor/decorate.js";(function(){try{var l=typeof globalThis<"u"?globalThis:window;if(!l.__scb_ce_guard_installed__){l.__scb_ce_guard_installed__=!0;var e=customElements.define.bind(customElements);customElements.define=function(t,i,c){try{customElements.get(t)||e(t,i,c)}catch(d){var a=String(d||"");if(a.indexOf("already been used")===-1&&a.indexOf("NotSupportedError")===-1)throw d}}}}catch{}})();var u,r=(u=class extends m{constructor(...e){super(...e),this.label="",this.value="",this.selected=!1,this.icon="",this.href="",this.disabled=!1,this.onHostKeydown=t=>{if(!this.href||this.isEffectivelyDisabled||t.code!=="Space"&&t.code!=="Enter"&&t.code!=="NumpadEnter")return;const i=this.shadowRoot?.querySelector("a[href]");i&&(t.preventDefault(),t.stopPropagation(),i.click())}}get isEffectivelyDisabled(){const e=this.parentElement?.hasAttribute?.("disabled");return this.disabled||!!e}get hasDefaultSlotContent(){return Array.from(this.childNodes).some(e=>e.nodeType===1?!0:e.nodeType===3?(e.textContent??"").trim()!=="":!1)}connectedCallback(){super.connectedCallback(),this.addEventListener("focusin",h)}render(){const e=this.isEffectivelyDisabled,t=!!this.icon,i=!!this.label||this.hasDefaultSlotContent,c=this.label?s`${this.label}`:s`<slot></slot>`,a=`segmented-item${t||this.selected?" has-icon":""}${i?"":" no-label"}`,d=s`
|
|
2
2
|
<md-ripple ?disabled="${e}"></md-ripple>
|
|
3
3
|
${this.selected?t&&i?s`<md-icon>check</md-icon>`:t?s`<md-icon>check</md-icon><md-icon>${this.icon}</md-icon>`:s`<md-icon>check</md-icon>`:t?s`<md-icon>${this.icon}</md-icon>`:""}
|
|
4
4
|
${i?s`<span>${c}</span>`:""}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{h as b,m,p as o,v as i,y as u}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import"../../vendor/icon.js";import"../../vendor/ripple.js";import{
|
|
1
|
+
import{h as b,m,p as o,v as i,y as u}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import"../../vendor/icon.js";import"../../vendor/ripple.js";import{ensureFocusRingOnFocusVisible as d}from"../shared/lazy-focus-ring.js";import{t}from"../../vendor/decorate.js";(function(){try{var s=typeof globalThis<"u"?globalThis:window;if(!s.__scb_ce_guard_installed__){s.__scb_ce_guard_installed__=!0;var c=customElements.define.bind(customElements);customElements.define=function(a,h,p){try{customElements.get(a)||c(a,h,p)}catch(r){var l=String(r||"");if(l.indexOf("already been used")===-1&&l.indexOf("NotSupportedError")===-1)throw r}}}}catch{}})();var n,e=(n=class extends b{constructor(...c){super(...c),this.value="",this.disabled=!1,this.showCheckbox=!1,this.checked=!1,this.showRadio=!1,this.label="",this.noHighlightSelected=!1}connectedCallback(){super.connectedCallback(),this.addEventListener("focusin",d)}disconnectedCallback(){this.removeEventListener("focusin",d),super.disconnectedCallback()}render(){return i`
|
|
2
2
|
<div class="item ${this.checked?"checked":""}" ?aria-disabled=${this.disabled}>
|
|
3
3
|
<md-ripple></md-ripple>
|
|
4
4
|
${this.showCheckbox?i`<md-icon class="${this.checked?"checkbox-checked":""}" aria-hidden="true">${this.checked?"check_box":"check_box_outline_blank"}</md-icon>`:null}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as p,h as u,m as b,p as l,v as d,y as g}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import{
|
|
1
|
+
import{a as p,h as u,m as b,p as l,v as d,y as g}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import{ensureFocusRingOnFocusVisible as m}from"../shared/lazy-focus-ring.js";import{t as a}from"../../vendor/decorate.js";import"../scb-chevron/scb-chevron.js";import"./scb-select-option.js";(function(){try{var h=typeof globalThis<"u"?globalThis:window;if(!h.__scb_ce_guard_installed__){h.__scb_ce_guard_installed__=!0;var e=customElements.define.bind(customElements);customElements.define=function(t,s,o){try{customElements.get(t)||e(t,s,o)}catch(r){var n=String(r||"");if(n.indexOf("already been used")===-1&&n.indexOf("NotSupportedError")===-1)throw r}}}}catch{}})();var c,i=(c=class extends u{constructor(){super(),this._optionsObserver=null,this._internals=null,this.focusedIndex=-1,this.variant="single-select",this.value="",this.values=[],this.disabled=!1,this.required=!1,this.open=!1,this.label="",this.name="",this.placeholder="",this.supportingText="",this.withRadiobuttons=!1,this.noHighlightSelected=!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.zIndex=void 0,this._form=null,this._formResetHandler=null,this._formSubmitHandler=null,this._initialValue="",this._initialValues=[],this._customValidationMessage="",this._onDocumentClick=e=>{this.open&&(e.composedPath().includes(this)||this._setOpen(!1))},this._onSlotClick=e=>{const t=this.shadowRoot?.querySelector("slot");if(!t)return;const s=t.assignedElements({flatten:!0}).filter(r=>r.tagName.toLowerCase()==="scb-select-option"),o=e.composedPath(),n=s.find(r=>o.includes(r));n&&(this._selectOption(n),e.stopPropagation())},this._onKeyDown=e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),this._toggleOpen())},this._onOptionKeyDown=e=>{if(e.key==="Enter"||e.key===" "){e.preventDefault();const t=this.shadowRoot?.querySelector("slot");if(!t)return;const s=t.assignedElements({flatten:!0}).filter(r=>r.tagName.toLowerCase()==="scb-select-option"),o=e.composedPath(),n=s.find(r=>o.includes(r));n&&this._selectOption(n)}},"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")}connectedCallback(){super.connectedCallback(),document.addEventListener("mousedown",this._onDocumentClick),this._optionsObserver=new MutationObserver(()=>{this.requestUpdate()}),this._optionsObserver.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["label","value","disabled"]}),this._syncDensityForSize(),this._initialValue=this.value,this._initialValues=Array.isArray(this.values)?[...this.values]:[],this._form=this.closest("form"),this._form&&(this._formResetHandler=()=>{this.value=this._initialValue,this.values=Array.isArray(this._initialValues)?[...this._initialValues]:[],this._syncFormValue(),this._syncValidity(),this.requestUpdate()},this._formSubmitHandler=e=>{this.reportValidity()||(e.preventDefault(),e.stopPropagation())},this._form.addEventListener("reset",this._formResetHandler,!0),this._form.addEventListener("submit",this._formSubmitHandler,!0))}disconnectedCallback(){document.removeEventListener("mousedown",this._onDocumentClick),this._form&&this._formResetHandler&&this._form.removeEventListener("reset",this._formResetHandler,!0),this._form&&this._formSubmitHandler&&this._form.removeEventListener("submit",this._formSubmitHandler,!0),this._optionsObserver?.disconnect(),this._optionsObserver=null,super.disconnectedCallback()}_getMultiValues(){return Array.isArray(this.values)&&this.values.length>0?this.values:this.value?this.value.split(",").map(e=>e.trim()).filter(Boolean):[]}_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}_applySpacing(){const e=this._mapSpacingToken(this.spacing),t=this._mapSpacingToken(this.spacingTop)??e,s=this._mapSpacingToken(this.spacingBottom)??e,o=this._mapSpacingToken(this.spacingLeft),n=this._mapSpacingToken(this.spacingRight);t?this.style.setProperty("--scb-select-spacing-block-start",t):this.style.removeProperty("--scb-select-spacing-block-start"),s?this.style.setProperty("--scb-select-spacing-block-end",s):this.style.removeProperty("--scb-select-spacing-block-end"),o?this.style.setProperty("--scb-select-spacing-inline-start",o):this.style.removeProperty("--scb-select-spacing-inline-start"),n?this.style.setProperty("--scb-select-spacing-inline-end",n):this.style.removeProperty("--scb-select-spacing-inline-end")}_setOpen(e){this.open!==e&&(this.open=e,e?(this.focusedIndex=0,this.requestUpdate()):this.focusedIndex=-1)}_toggleOpen(){this.disabled||this._setOpen(!this.open)}_hasMoreThanFourOptions(){const e=this.shadowRoot?.querySelector("slot");if(!e)return!1;const t=e.assignedElements({flatten:!0}).filter(s=>s.tagName.toLowerCase()==="scb-select-option");return["extra-small","small","medium"].includes(this.size)?t.length>5:t.length>4}_selectOption(e){if(!e.disabled){if(this.variant==="multi-select"){const t=this._getMultiValues();t.indexOf(e.value)>-1?this.values=t.filter(s=>s!==e.value):this.values=[...t,e.value],this.value=this.values.join(","),this.dispatchEvent(new CustomEvent("change",{detail:{values:this.values},bubbles:!0,composed:!0}))}else this.variant==="single-select"&&this.withRadiobuttons?(this.value=e.value,this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value},bubbles:!0,composed:!0}))):(this.value=e.value,this._setOpen(!1),this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value},bubbles:!0,composed:!0})));this._updateOptionsChecked(),this.requestUpdate()}}_getOptionLabel(e){return e.label||e.textContent?.trim()||""}_getSelectedLabel(){const e=this.shadowRoot?.querySelector("slot");if(!e)return"";const t=e.assignedElements({flatten:!0}).filter(s=>s.tagName.toLowerCase()==="scb-select-option");if(this.variant==="multi-select"){const s=this._getMultiValues(),o=t.filter(n=>s.includes(n.value));return o&&o.length>0?o.map(n=>this._getOptionLabel(n)).join(", "):""}else{const s=t.find(o=>o.value===this.value);return s?this._getOptionLabel(s):""}}firstUpdated(){this._updateOptionsChecked(),this._syncFormValue(),this._syncValidity(),this._applySpacing()}updated(e){this._updateOptionsChecked(),this._syncFormValue(),this._syncValidity(),e.has("size")&&this._syncDensityForSize(),(e.has("spacing")||e.has("spacingTop")||e.has("spacingBottom")||e.has("spacingLeft")||e.has("spacingRight"))&&this._applySpacing()}_syncFormValue(){if(this._internals){if(this.disabled||!this.name){this._internals.setFormValue(null);return}if(this.variant==="multi-select"){const e=this._getMultiValues();if(e.length===0){this._internals.setFormValue(null);return}const t=new FormData;e.forEach(s=>t.append(this.name,s)),this._internals.setFormValue(t);return}this._internals.setFormValue(this.value||null)}}_getValidationMessage(){return this._customValidationMessage?this._customValidationMessage:this.required&&!(this.variant==="multi-select"?this._getMultiValues().length>0:this.value)?"Välj ett alternativ.":""}_syncValidity(){if(!this._internals)return;const e=this.disabled?"":this._getValidationMessage(),t=this.shadowRoot?.querySelector(".selected-value");if(!e){this._internals.setValidity({}),this.removeAttribute("aria-invalid"),t&&t.setCustomValidity("");return}t&&t.setCustomValidity(e),this._internals.setValidity({valueMissing:!0},e,t??void 0),this.setAttribute("aria-invalid","true")}checkValidity(){return!this._getValidationMessage()}reportValidity(){return this._syncValidity(),this._internals?this._internals.reportValidity():this.checkValidity()}setCustomValidity(e){this._customValidationMessage=e,this._syncValidity()}get validity(){return this._internals?.validity}get validationMessage(){return this._internals?.validationMessage??this._getValidationMessage()}get willValidate(){return this._internals?.willValidate??!0}_updateOptionsChecked(){const e=this.shadowRoot?.querySelector("slot");e&&e.assignedElements({flatten:!0}).filter(t=>t.tagName.toLowerCase()==="scb-select-option").forEach(t=>{if(this.noHighlightSelected?t.setAttribute("no-highlight-selected",""):t.removeAttribute("no-highlight-selected"),this.variant==="multi-select"){const s=this._getMultiValues();t.showCheckbox=!0,t.checked=s.includes(t.value),t.showRadio=!1}else t.showCheckbox=!1,t.checked=this.value===t.value,this.withRadiobuttons&&(t.showRadio=!0)})}render(){return d`
|
|
2
2
|
${this.label?d`
|
|
3
3
|
<label
|
|
4
4
|
class="select-label ${this.supportingText?"":"select-label--without-supporting"}"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{h as p,m as h,p as a,v as s,y as u}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import"../../vendor/icon.js";import"../../vendor/ripple.js";import{n}from"
|
|
1
|
+
import{h as p,m as h,p as a,v as s,y as u}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import"../../vendor/icon.js";import"../../vendor/ripple.js";import{ensureFocusRingOnFocusVisible as n}from"../shared/lazy-focus-ring.js";import{t as i}from"../../vendor/decorate.js";(function(){try{var o=typeof globalThis<"u"?globalThis:window;if(!o.__scb_ce_guard_installed__){o.__scb_ce_guard_installed__=!0;var e=customElements.define.bind(customElements);customElements.define=function(l,m,b){try{customElements.get(l)||e(l,m,b)}catch(d){var c=String(d||"");if(c.indexOf("already been used")===-1&&c.indexOf("NotSupportedError")===-1)throw d}}}}catch{}})();var r,t=(r=class extends p{constructor(...e){super(...e),this.label="",this.subLabel="",this.symbolVariant="number",this.number=0,this.active=!1,this.completed=!1,this.changeOnCompleted=!1,this.islast=!1,this.variant="horizontal",this.widthWeight=1,this.icon=""}updated(){!this.subLabel||this.subLabel.trim()===""?this.setAttribute("no-content",""):this.removeAttribute("no-content"),this.widthWeight>0?this.style.setProperty("--scb-step-width-weight",String(this.widthWeight)):this.style.removeProperty("--scb-step-width-weight")}handleKeyDown(e){e.key==="Enter"||e.key===" "?(e.preventDefault(),this.dispatchEvent(new MouseEvent("click",{bubbles:!0,composed:!0}))):(e.key==="ArrowRight"||e.key==="ArrowLeft")&&(this.dispatchEvent(new CustomEvent("scb-stepper-keynav",{detail:{key:e.key},bubbles:!0,composed:!0})),e.preventDefault())}render(){const e=this.active?"step":void 0,l=this.label?`${this.label}${this.subLabel?": "+this.subLabel:""}`:void 0;switch(this.symbolVariant){case"icon":return s`
|
|
2
2
|
<div
|
|
3
3
|
class="scb-step-content"
|
|
4
4
|
tabindex="0"
|
|
@@ -1,121 +1,4 @@
|
|
|
1
|
-
import{f as
|
|
2
|
-
<div class="datepicker-popup popup">
|
|
3
|
-
<div class="header">
|
|
4
|
-
<div class="month-selector ${this._showMonthDropdown?"open":""} ${this._showYearDropdown?"disable":""}">
|
|
5
|
-
<scb-icon-button icon="chevron_left" @click=${this._prevMonth} aria-label=${this.lang=="sv"?"Föregående månad":"Previous month"}></scb-icon-button>
|
|
6
|
-
<div class="custom-dropdown month-dropdown">
|
|
7
|
-
<div
|
|
8
|
-
tabindex=${this._showYearDropdown?-1:0}
|
|
9
|
-
class="dropdown-selected"
|
|
10
|
-
@click=${()=>this._toggleMonthDropdown()}
|
|
11
|
-
@keydown=${n=>{(n.key==="Enter"||n.key===" ")&&(n.preventDefault(),this._toggleMonthDropdown())}}
|
|
12
|
-
>
|
|
13
|
-
${this._monthNames[t].slice(0,3)}
|
|
14
|
-
<md-icon>arrow_drop_down</md-icon>
|
|
15
|
-
<md-focus-ring></md-focus-ring>
|
|
16
|
-
<md-ripple></md-ripple>
|
|
17
|
-
</div>
|
|
18
|
-
</div>
|
|
19
|
-
<scb-icon-button icon="chevron_right" @click=${this._nextMonth} aria-label=${this.lang=="sv"?"Nästa månad":"Next month"}></scb-icon-button>
|
|
20
|
-
</div>
|
|
21
|
-
<div class="year-selector ${this._showMonthDropdown?"disable":""} ${this._showYearDropdown?"open":""}">
|
|
22
|
-
<scb-icon-button icon="chevron_left" @click=${this._prevYear} aria-label=${this.lang=="sv"?"Föregående år":"Previous year"}></scb-icon-button>
|
|
23
|
-
<div class="custom-dropdown year-dropdown">
|
|
24
|
-
<div
|
|
25
|
-
tabindex=${this._showMonthDropdown?-1:0}
|
|
26
|
-
class="dropdown-selected"
|
|
27
|
-
@click=${()=>this._toggleYearDropdown()}
|
|
28
|
-
@keydown=${n=>{(n.key==="Enter"||n.key===" ")&&(n.preventDefault(),this._toggleYearDropdown())}}
|
|
29
|
-
>
|
|
30
|
-
${e}
|
|
31
|
-
<md-icon>arrow_drop_down</md-icon>
|
|
32
|
-
<md-focus-ring></md-focus-ring>
|
|
33
|
-
<md-ripple></md-ripple>
|
|
34
|
-
</div>
|
|
35
|
-
</div>
|
|
36
|
-
<scb-icon-button icon="chevron_right" @click=${this._nextYear} aria-label=${this.lang=="sv"?"Nästa år":"Next year"}></scb-icon-button>
|
|
37
|
-
</div>
|
|
38
|
-
</div>
|
|
39
|
-
${this._showMonthDropdown||this._showYearDropdown?a`<scb-divider></scb-divider>`:""}
|
|
40
|
-
<div class="datepicker-content" style="position:relative;">
|
|
41
|
-
${this._showMonthDropdown?a`
|
|
42
|
-
<div class="dropdown-list">
|
|
43
|
-
${this._monthNames.map((n,d)=>a`
|
|
44
|
-
<div
|
|
45
|
-
@keydown=${f=>{(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),this._onMonthChangeCustom(d))}}
|
|
46
|
-
tabindex="0"
|
|
47
|
-
class="dropdown-item${d===t?" selected":""}"
|
|
48
|
-
@click=${()=>this._onMonthChangeCustom(d)}
|
|
49
|
-
id=${d===t?"selected-month":""}
|
|
50
|
-
>
|
|
51
|
-
${d===t?a`<md-icon>check</md-icon>`:""}
|
|
52
|
-
${n}
|
|
53
|
-
<md-ripple></md-ripple><md-focus-ring inward></md-focus-ring>
|
|
54
|
-
</div>
|
|
55
|
-
`)}
|
|
56
|
-
</div>
|
|
57
|
-
`:""}
|
|
58
|
-
${this._showYearDropdown?a`
|
|
59
|
-
<div class="dropdown-list">
|
|
60
|
-
${u.map(n=>a`
|
|
61
|
-
<div
|
|
62
|
-
@keydown=${d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),this._onYearChangeCustom(n))}}
|
|
63
|
-
tabindex="0"
|
|
64
|
-
class="dropdown-item${n===e?" selected":""}"
|
|
65
|
-
@click=${()=>this._onYearChangeCustom(n)}
|
|
66
|
-
id=${n===e?"selected-year":""}
|
|
67
|
-
>
|
|
68
|
-
${n===e?a`<md-icon>check</md-icon>`:""}
|
|
69
|
-
${n}
|
|
70
|
-
<md-ripple></md-ripple><md-focus-ring inward></md-focus-ring>
|
|
71
|
-
</div>
|
|
72
|
-
`)}
|
|
73
|
-
</div>
|
|
74
|
-
`:""}
|
|
75
|
-
${!this._showMonthDropdown&&!this._showYearDropdown?a`
|
|
76
|
-
<div class="datepicker-calendar">
|
|
77
|
-
<table>
|
|
78
|
-
<thead>
|
|
79
|
-
<tr>
|
|
80
|
-
<th>${this.lang=="sv"?"Må":"Mo"}</th><th>${this.lang=="sv"?"Ti":"Tu"}</th><th>${this.lang=="sv"?"On":"We"}</th><th>${this.lang=="sv"?"To":"Th"}</th><th>${this.lang=="sv","Fr"}</th><th>${this.lang=="sv"?"Lö":"Sa"}</th><th>${this.lang=="sv"?"Sö":"Su"}</th>
|
|
81
|
-
</tr>
|
|
82
|
-
</thead>
|
|
83
|
-
<tbody>
|
|
84
|
-
${o.map(n=>a`
|
|
85
|
-
<tr>
|
|
86
|
-
${n.map(d=>d?a`
|
|
87
|
-
<td>
|
|
88
|
-
<div
|
|
89
|
-
@keydown=${f=>{(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),this._selectDate(d))}}
|
|
90
|
-
role="button"
|
|
91
|
-
tabindex="0"
|
|
92
|
-
class="day${this._isToday(d,i)?" today":""}${this._isSelected(d)?" selected":""}"
|
|
93
|
-
@click=${()=>this._selectDate(d)}
|
|
94
|
-
>${d.getDate()}<md-ripple></md-ripple><md-focus-ring></md-focus-ring></div>
|
|
95
|
-
</td>
|
|
96
|
-
`:a`<td></td>`)}
|
|
97
|
-
</tr>
|
|
98
|
-
`)}
|
|
99
|
-
</tbody>
|
|
100
|
-
</table>
|
|
101
|
-
</div>
|
|
102
|
-
`:""}
|
|
103
|
-
</div>
|
|
104
|
-
${l?a`
|
|
105
|
-
<div style="padding: 0 24px;">
|
|
106
|
-
<label style="display:flex;align-items:center;gap:8px;">
|
|
107
|
-
<span>${this.lang=="sv"?"Tid:":"Time:"}</span>
|
|
108
|
-
<scb-textfield type="time" .value=${`${String(this._selectedHour).padStart(2,"0")}:${String(this._selectedMinute).padStart(2,"0")}`} @blur=${this._onTimeChange} aria-label="${this.lang=="sv"?"Tid":"Time"}"></scb-textfield>
|
|
109
|
-
</label>
|
|
110
|
-
</div>
|
|
111
|
-
`:""}
|
|
112
|
-
<div class="datepicker-footer">
|
|
113
|
-
${!this._showMonthDropdown&&!this._showYearDropdown?a`
|
|
114
|
-
<scb-button variant="text" label=${this.lang=="sv"?"Stäng":"Close"} @click=${this._close}></scb-button>
|
|
115
|
-
`:""}
|
|
116
|
-
</div>
|
|
117
|
-
</div>
|
|
118
|
-
`}_getMonthDays(e,t){const i=new Date(Date.UTC(e,t,1)),o=new Date(Date.UTC(e,t+1,0)),u=[];let l=[],n=i.getUTCDay(),d=n===0?6:n-1;for(let f=0;f<d;f++)l.push(null);for(let f=1;f<=o.getUTCDate();f++){const x=new Date(Date.UTC(e,t,f));l.push(x),l.length===7&&(u.push(l),l=[])}if(l.length){for(;l.length<7;)l.push(null);u.push(l)}return u}_toggleMonthDropdown(){this._showMonthDropdown=!this._showMonthDropdown,this._showMonthDropdown&&(this._showYearDropdown=!1,setTimeout(()=>{const e=this.renderRoot.querySelector("#selected-month");e&&e.scrollIntoView({block:"center"})},0))}_toggleYearDropdown(){this._showYearDropdown=!this._showYearDropdown,this._showYearDropdown&&(this._showMonthDropdown=!1,setTimeout(()=>{const e=this.renderRoot.querySelector("#selected-year");e&&e.scrollIntoView({block:"center"})},0))}_onMonthChangeCustom(e){const t=this._currentDate.getFullYear();this._currentDate=new Date(t,e,1),this._showMonthDropdown=!1}_onYearChangeCustom(e){const t=this._currentDate.getMonth();this._currentDate=new Date(e,t,1),this._showYearDropdown=!1}_isToday(e,t){return e.getDate()===t.getDate()&&e.getMonth()===t.getMonth()&&e.getFullYear()===t.getFullYear()}_isSelected(e){return this._selectedDate&&e.getDate()===this._selectedDate.getDate()&&e.getMonth()===this._selectedDate.getMonth()&&e.getFullYear()===this._selectedDate.getFullYear()}_selectDate(e){if(this._selectedDate=e,this.variant==="datetime-local"){const t=new Date(e);t.setHours(this._selectedHour??0,this._selectedMinute??0,0,0),this._selectedHour=t.getHours(),this._selectedMinute=t.getMinutes();const i=u=>u.toString().padStart(2,"0"),o=`${t.getFullYear()}-${i(t.getMonth()+1)}-${i(t.getDate())} ${i(t.getHours())}:${i(t.getMinutes())}`;this.dispatchEvent(new CustomEvent("date-selected",{detail:{value:o},bubbles:!0,composed:!0}))}else{const t=e.toISOString().slice(0,10);this.dispatchEvent(new CustomEvent("date-selected",{detail:{value:t},bubbles:!0,composed:!0}))}}_fireDateTimeChange(){if(this.variant==="datetime-local"&&this._selectedDate){const e=new Date(this._selectedDate);e.setHours(this._selectedHour??0,this._selectedMinute??0,0,0);const t=o=>o.toString().padStart(2,"0"),i=`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())} ${t(e.getHours())}:${t(e.getMinutes())}`;this.dispatchEvent(new CustomEvent("date-selected",{detail:{value:i},bubbles:!0,composed:!0}))}}},k.styles=[E`:host{--scb-datepicker-width:380px;--scb-datepicker-z-index:1100;--scb-datepicker-viewport-margin:8px;--scb-datepicker-offset:var(--spacing-2, 4px);max-width:var(--scb-datepicker-computed-width, min(var(--scb-datepicker-width), calc(100vw - (var(--scb-datepicker-viewport-margin) * 2))));font-family:var(--brand-font);color:var(--md-sys-color-on-surface);display:block;position:var(--scb-datepicker-position, absolute);top:var(--scb-datepicker-top, calc(100% + var(--scb-datepicker-offset)));bottom:var(--scb-datepicker-bottom, auto);left:var(--scb-datepicker-left, 0);width:var(--scb-datepicker-computed-width, min(var(--scb-datepicker-width), calc(100vw - (var(--scb-datepicker-viewport-margin) * 2))));transform:var(--scb-datepicker-transform, translateX(0px));z-index:var(--scb-datepicker-z-index)}.dropdown-selected,.month-selector,.year-selector{display:flex;align-items:center}.dropdown-selected{position:relative;border-radius:8px;font-size:16px;cursor:pointer;text-align:left;gap:8px;padding:4px 8px}.dropdown-selected:focus{outline:0}.dropdown-selected md-focus-ring{border-radius:8px}.dropdown-list{position:relative;background:var(--md-sys-color-surface);padding:4px 0}.dropdown-item{display:flex;position:relative;cursor:pointer;padding:var(--spacing-3) 56px;min-height:40px;align-items:center}.dropdown-item:focus-within{outline:0}.datepicker-popup,.dropdown-item md-focus-ring{border-radius:var(--md-sys-shape-corner-small)}.dropdown-item.selected{background:var(--md-sys-color-secondary-container, #e3f2fd);font-weight:500;padding-left:16px;gap:16px}.datepicker-popup{background:var(--md-sys-color-surface);box-shadow:0 1px 2px 0 rgba(0,0,0,.3),0 2px 6px 2px rgba(0,0,0,.15);max-width:100%;width:100%;max-height:var(--scb-datepicker-max-height, 80vh);overflow:auto;font-family:var(--brand-font)}.datepicker-content{overflow-y:auto;max-height:290px}.datepicker-content::-webkit-scrollbar{width:12px;background:var(--md-sys-color-surface);border-radius:var(--md-sys-shape-corner-small)}.datepicker-content::-webkit-scrollbar-thumb{background:var(--md-sys-color-outline);border-radius:var(--md-sys-shape-corner-small);border:4px solid var(--md-sys-color-surface)}.datepicker-content::-webkit-scrollbar-track{background:var(--md-sys-color-surface);border-radius:var(--md-sys-shape-corner-small)}.popup{position:absolute;top:0;left:0;z-index:1}.header{display:flex;align-items:center;justify-content:space-between;margin-bottom:30px;padding:20px 16px 0;flex-wrap:wrap}.datepicker-footer{padding:8px 16px 24px}.month-label{font-size:18px;font-weight:500}.datepicker-calendar{padding:0 16px}table{width:100%;border-collapse:collapse;margin-bottom:8px}th{color:var(--md-sys-color-on-surface-variant, #757575);font-size:16px;font-weight:600;padding-bottom:20px}td{text-align:center}.day:focus-within{outline:0}.close-datepicker,.day{background:0 0;font-size:16px;cursor:pointer}.day{position:relative;width:40px;height:40px;border-radius:50%;border:0;font-family:"Inter";align-content:center}.day.selected{background:var(--md-sys-color-secondary-container)}.close-datepicker{margin-top:8px;border-color:none;color:var(--md-sys-color-primary, #0057b8);padding:4px 12px;border-radius:8px}.close-datepicker:hover{background:var(--md-sys-color-primary-container, #e3f2fd)}`],k);r([m()],g.prototype,"_currentDate",void 0);r([m()],g.prototype,"_selectedDate",void 0);r([m()],g.prototype,"_showMonthDropdown",void 0);r([m()],g.prototype,"_showYearDropdown",void 0);r([p({type:String})],g.prototype,"variant",void 0);r([p({type:String})],g.prototype,"lang",void 0);r([p({type:String})],g.prototype,"selectedValue",void 0);r([p({type:Boolean})],g.prototype,"open",void 0);r([m()],g.prototype,"_selectedHour",void 0);r([m()],g.prototype,"_selectedMinute",void 0);g=r([S("scb-datepicker")],g);var c,y,h=(c=new WeakSet,y=class extends z{constructor(){super(),P(this,c),this._internals=null,this._inputFocused=!1,this._kbShouldShowRing=!1,this._onGlobalKeydown=e=>{e.key==="Tab"&&(I(),this._kbShouldShowRing=!0,this._inputFocused&&b(c,this,_).call(this))},this._onGlobalPointerDown=()=>{this._kbShouldShowRing=!1,this._inputFocused&&b(c,this,_).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)}b(c,this,w).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,b(c,this,_).call(this)},this._onFieldBlur=()=>{this._inputFocused=!1,b(c,this,_).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)}b(c,this,w).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?a`<md-icon class="scb-textfield-icon">${this.leadingIcon}</md-icon>`:null,t=this.error?a`<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?a`
|
|
1
|
+
import{f as _,h as w,m as $,p as d,v as o,y as z}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import"../../vendor/icon.js";import"../../vendor/ripple.js";import{ensureFocusRingReady as k}from"../shared/lazy-focus-ring.js";import{t as r}from"../../vendor/decorate.js";import{n as E,t as a}from"../../vendor/assertClassBrand.js";import"../scb-icon-button/scb-icon-button.js";import"../scb-datepicker/scb-datepicker.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,n,c){try{customElements.get(i)||e(i,n,c)}catch(u){var p=String(u||"");if(p.indexOf("already been used")===-1&&p.indexOf("NotSupportedError")===-1)throw u}}}}catch{}})();var s,b,l=(s=new WeakSet,b=class extends w{constructor(){super(),E(this,s),this._internals=null,this._inputFocused=!1,this._kbShouldShowRing=!1,this._onGlobalKeydown=e=>{e.key==="Tab"&&(k(),this._kbShouldShowRing=!0,this._inputFocused&&a(s,this,g).call(this))},this._onGlobalPointerDown=()=>{this._kbShouldShowRing=!1,this._inputFocused&&a(s,this,g).call(this)},this._hasRenderedOnce=!1,this._boundField=null,this._onFieldInput=()=>{const e=this._boundField;if(!e)return;const i=e;if(this.value=i.value,this._internals){const n=this.disabled?null:this.value;this._internals.setFormValue(n)}a(s,this,f).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,a(s,this,g).call(this)},this._onFieldBlur=()=>{this._inputFocused=!1,a(s,this,g).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 i=this.disabled?null:this.value;this._internals.setFormValue(i)}a(s,this,f).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?o`<md-icon class="scb-textfield-icon">${this.leadingIcon}</md-icon>`:null,i=this.error?o`<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 n=this.underLabel?`${this._inputId}-supporting-text`:void 0,c=this.type==="search"&&this.value?o`
|
|
119
2
|
<button
|
|
120
3
|
type="button"
|
|
121
4
|
class="scb-textfield-clear"
|
|
@@ -149,14 +32,14 @@ import{f as m,h as z,m as S,p,v as a,y as E}from"../../vendor/vendor.js";import"
|
|
|
149
32
|
></line>
|
|
150
33
|
</svg>
|
|
151
34
|
</button>
|
|
152
|
-
`:null;return this.type==="textarea"?
|
|
35
|
+
`:null;return this.type==="textarea"?o`
|
|
153
36
|
<label
|
|
154
37
|
class="scb-textfield-label ${this.underLabel?"":"scb-textfield-label--without-supporting"}"
|
|
155
38
|
for="${this._inputId}"
|
|
156
39
|
>
|
|
157
40
|
${this.label}
|
|
158
41
|
</label>
|
|
159
|
-
${this.underLabel?
|
|
42
|
+
${this.underLabel?o`
|
|
160
43
|
<span class="scb-textfield-supporting-text" id="${this._inputId}-supporting-text">
|
|
161
44
|
${this.underLabel}
|
|
162
45
|
</span>
|
|
@@ -171,20 +54,20 @@ import{f as m,h as z,m as S,p,v as a,y as E}from"../../vendor/vendor.js";import"
|
|
|
171
54
|
id="${this._inputId}"
|
|
172
55
|
?required=${this.required}
|
|
173
56
|
aria-invalid=${this.error?"true":"false"}
|
|
174
|
-
aria-describedby=${
|
|
57
|
+
aria-describedby=${n}
|
|
175
58
|
></textarea>
|
|
176
59
|
<md-ripple></md-ripple>
|
|
177
60
|
<md-focus-ring class="input-ring"></md-focus-ring>
|
|
178
61
|
</div>
|
|
179
62
|
</div>
|
|
180
|
-
`:this.type==="date"?
|
|
63
|
+
`:this.type==="date"?o`
|
|
181
64
|
<label
|
|
182
65
|
class="scb-textfield-label ${this.underLabel?"":"scb-textfield-label--without-supporting"}"
|
|
183
66
|
for="${this._inputId}"
|
|
184
67
|
>
|
|
185
68
|
${this.label}
|
|
186
69
|
</label>
|
|
187
|
-
${this.underLabel?
|
|
70
|
+
${this.underLabel?o`
|
|
188
71
|
<span class="scb-textfield-supporting-text" id="${this._inputId}-supporting-text">
|
|
189
72
|
${this.underLabel}
|
|
190
73
|
</span>
|
|
@@ -201,7 +84,7 @@ import{f as m,h as z,m as S,p,v as a,y as E}from"../../vendor/vendor.js";import"
|
|
|
201
84
|
?disabled=${this.disabled}
|
|
202
85
|
?required=${this.required}
|
|
203
86
|
aria-invalid=${this.error?"true":"false"}
|
|
204
|
-
aria-describedby=${
|
|
87
|
+
aria-describedby=${n}
|
|
205
88
|
readonly
|
|
206
89
|
@focus=${this._toggleDatepicker}
|
|
207
90
|
@click=${this._toggleDatepicker}
|
|
@@ -209,7 +92,7 @@ import{f as m,h as z,m as S,p,v as a,y as E}from"../../vendor/vendor.js";import"
|
|
|
209
92
|
<md-ripple></md-ripple>
|
|
210
93
|
<md-focus-ring class="input-ring"></md-focus-ring>
|
|
211
94
|
</div>
|
|
212
|
-
${this.error?
|
|
95
|
+
${this.error?i:o`
|
|
213
96
|
<scb-icon-button
|
|
214
97
|
class="scb-textfield-datepicker-button"
|
|
215
98
|
icon="calendar_today"
|
|
@@ -224,14 +107,14 @@ import{f as m,h as z,m as S,p,v as a,y as E}from"../../vendor/vendor.js";import"
|
|
|
224
107
|
@date-selected=${this._onDateSelected}
|
|
225
108
|
></scb-datepicker>
|
|
226
109
|
</div>
|
|
227
|
-
`:this.type==="datetime-local"?
|
|
110
|
+
`:this.type==="datetime-local"?o`
|
|
228
111
|
<label
|
|
229
112
|
class="scb-textfield-label ${this.underLabel?"":"scb-textfield-label--without-supporting"}"
|
|
230
113
|
for="${this._inputId}"
|
|
231
114
|
>
|
|
232
115
|
${this.label}
|
|
233
116
|
</label>
|
|
234
|
-
${this.underLabel?
|
|
117
|
+
${this.underLabel?o`
|
|
235
118
|
<span class="scb-textfield-supporting-text" id="${this._inputId}-supporting-text">
|
|
236
119
|
${this.underLabel}
|
|
237
120
|
</span>
|
|
@@ -248,7 +131,7 @@ import{f as m,h as z,m as S,p,v as a,y as E}from"../../vendor/vendor.js";import"
|
|
|
248
131
|
?disabled=${this.disabled}
|
|
249
132
|
?required=${this.required}
|
|
250
133
|
aria-invalid=${this.error?"true":"false"}
|
|
251
|
-
aria-describedby=${
|
|
134
|
+
aria-describedby=${n}
|
|
252
135
|
readonly
|
|
253
136
|
@focus=${this._toggleDatepicker}
|
|
254
137
|
@click=${this._toggleDatepicker}
|
|
@@ -258,7 +141,7 @@ import{f as m,h as z,m as S,p,v as a,y as E}from"../../vendor/vendor.js";import"
|
|
|
258
141
|
<md-focus-ring class="input-ring"></md-focus-ring>
|
|
259
142
|
</div>
|
|
260
143
|
|
|
261
|
-
${this.error?
|
|
144
|
+
${this.error?i:o`
|
|
262
145
|
<scb-icon-button
|
|
263
146
|
class="scb-textfield-datepicker-button"
|
|
264
147
|
icon="calendar_today"
|
|
@@ -274,14 +157,14 @@ import{f as m,h as z,m as S,p,v as a,y as E}from"../../vendor/vendor.js";import"
|
|
|
274
157
|
@date-selected=${this._onDateSelected}
|
|
275
158
|
></scb-datepicker>
|
|
276
159
|
</div>
|
|
277
|
-
`:this.type==="time"?
|
|
160
|
+
`:this.type==="time"?o`
|
|
278
161
|
<label
|
|
279
162
|
class="scb-textfield-label ${this.underLabel?"":"scb-textfield-label--without-supporting"}"
|
|
280
163
|
for="${this._inputId}"
|
|
281
164
|
>
|
|
282
165
|
${this.label}
|
|
283
166
|
</label>
|
|
284
|
-
${this.underLabel?
|
|
167
|
+
${this.underLabel?o`
|
|
285
168
|
<span class="scb-textfield-supporting-text" id="${this._inputId}-supporting-text">
|
|
286
169
|
${this.underLabel}
|
|
287
170
|
</span>
|
|
@@ -298,22 +181,22 @@ import{f as m,h as z,m as S,p,v as a,y as E}from"../../vendor/vendor.js";import"
|
|
|
298
181
|
?disabled=${this.disabled}
|
|
299
182
|
?required=${this.required}
|
|
300
183
|
aria-invalid=${this.error?"true":"false"}
|
|
301
|
-
aria-describedby=${
|
|
302
|
-
@input=${
|
|
184
|
+
aria-describedby=${n}
|
|
185
|
+
@input=${p=>{const u=p.target;if(this.value=u.value,this._internals){const y=this.disabled?null:this.value;this._internals.setFormValue(y)}a(s,this,f).call(this),this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("onValueChanged",{detail:{value:this.value},bubbles:!0,composed:!0}))}}
|
|
303
186
|
/>
|
|
304
|
-
${
|
|
187
|
+
${i}
|
|
305
188
|
<md-ripple></md-ripple>
|
|
306
189
|
<md-focus-ring class="input-ring"></md-focus-ring>
|
|
307
190
|
</div>
|
|
308
191
|
</div>
|
|
309
|
-
`:
|
|
192
|
+
`:o`
|
|
310
193
|
<label
|
|
311
194
|
class="scb-textfield-label ${this.underLabel?"":"scb-textfield-label--without-supporting"}"
|
|
312
195
|
for="${this._inputId}"
|
|
313
196
|
>
|
|
314
197
|
${this.label}
|
|
315
198
|
</label>
|
|
316
|
-
${this.underLabel?
|
|
199
|
+
${this.underLabel?o`
|
|
317
200
|
<span class="scb-textfield-supporting-text" id="${this._inputId}-supporting-text">
|
|
318
201
|
${this.underLabel}
|
|
319
202
|
</span>
|
|
@@ -330,15 +213,15 @@ import{f as m,h as z,m as S,p,v as a,y as E}from"../../vendor/vendor.js";import"
|
|
|
330
213
|
?disabled=${this.disabled}
|
|
331
214
|
?required=${this.required}
|
|
332
215
|
aria-invalid=${this.error?"true":"false"}
|
|
333
|
-
aria-describedby=${
|
|
216
|
+
aria-describedby=${n}
|
|
334
217
|
/>
|
|
335
|
-
${
|
|
336
|
-
${
|
|
218
|
+
${c}
|
|
219
|
+
${i}
|
|
337
220
|
<md-ripple></md-ripple>
|
|
338
221
|
<md-focus-ring class="input-ring"></md-focus-ring>
|
|
339
222
|
</div>
|
|
340
223
|
</div>
|
|
341
|
-
`}firstUpdated(e){super.firstUpdated(e),this._initialValue=this.value,this._internals&&this.value&&this._internals.setFormValue(this.value),
|
|
224
|
+
`}firstUpdated(e){super.firstUpdated(e),this._initialValue=this.value,this._internals&&this.value&&this._internals.setFormValue(this.value),a(s,this,m).call(this),a(s,this,x).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 i=this.disabled?null:this.value;this._internals.setFormValue(i)}e.has("type")&&(a(s,this,m).call(this),this._hasRenderedOnce&&a(s,this,S).call(this)),(e.has("spacing")||e.has("spacingTop")||e.has("spacingBottom")||e.has("spacingLeft")||e.has("spacingRight"))&&a(s,this,x).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)),a(s,this,v).call(this),window.removeEventListener("keydown",this._onGlobalKeydown,!0),window.removeEventListener("pointerdown",this._onGlobalPointerDown,!0)}reportValidity(){return a(s,this,f).call(this,!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 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()}}},b.formAssociated=!0,b.styles=[z`:host{--scb-textfield-number-max-width:280px;--scb-textfield-text-max-width:400px;--scb-textfield-search-max-width:600px;--scb-textfield-email-max-width:400px;--scb-textfield-password-max-width:400px;--scb-textfield-tel-max-width:400px;--scb-textfield-url-max-width:400px;--scb-textfield-textarea-max-width:600px;font-family:var(--brand-font);color:var(--md-sys-color-on-surface);margin-block-start:var(--scb-textfield-spacing-block-start, 0);margin-block-end:var(--scb-textfield-spacing-block-end, 0);margin-inline-start:var(--scb-textfield-spacing-inline-start, 0);margin-inline-end:var(--scb-textfield-spacing-inline-end, 0);-webkit-tap-highlight-color:transparent;--scb-textfield-padding-x:var(--spacing-5);--scb-textfield-padding-y:var(--spacing-2);--scb-textfield-min-height:56px;--scb-textfield-font-size:var(--md-sys-typescale-body-large-size);--scb-textfield-line-height:var(--md-sys-typescale-body-large-line-height);--scb-textfield-label-font-size:var(--md-sys-typescale-label-medium-size);--scb-textfield-label-line-height:var(--md-sys-typescale-label-medium-line-height);--scb-textfield-label-letter-spacing:var(--md-sys-typescale-label-medium-tracking);--scb-textfield-supporting-font-size:var(--md-sys-typescale-body-medium-size);--scb-textfield-supporting-line-height:var(--md-sys-typescale-body-medium-line-height);--scb-textfield-supporting-letter-spacing:var(--md-sys-typescale-body-medium-tracking);--scb-textfield-label-gap:var(--spacing-3);--scb-textfield-leading-inset:var(--spacing-4);--scb-textfield-leading-icon-size:var(--icon-size-medium, 24px);--scb-textfield-leading-gap:var(--spacing-4);--scb-textfield-leading-padding:calc(
|
|
342
225
|
var(--scb-textfield-leading-inset) +
|
|
343
226
|
var(--scb-textfield-leading-icon-size) +
|
|
344
227
|
var(--scb-textfield-leading-gap)
|
|
@@ -346,4 +229,4 @@ import{f as m,h as z,m as S,p,v as a,y as E}from"../../vendor/vendor.js";import"
|
|
|
346
229
|
var(--scb-textfield-trailing-inset) +
|
|
347
230
|
var(--scb-textfield-trailing-action-size) +
|
|
348
231
|
var(--spacing-2)
|
|
349
|
-
)}:host([size='extra-small']),:host([size='medium']),:host([size='small']){--scb-textfield-label-font-size:var(--md-sys-typescale-label-small-size);--scb-textfield-label-line-height:var(--md-sys-typescale-label-small-line-height);--scb-textfield-label-letter-spacing:var(--md-sys-typescale-label-small-tracking);--scb-textfield-supporting-font-size:var(--md-sys-typescale-body-small-size);--scb-textfield-supporting-line-height:var(--md-sys-typescale-body-small-line-height);--scb-textfield-supporting-letter-spacing:var(--md-sys-typescale-body-small-tracking);--scb-textfield-leading-inset:var(--spacing-3);--scb-textfield-trailing-inset:var(--spacing-3)}:host([size='medium']){--scb-textfield-padding-x:var(--spacing-4);--scb-textfield-padding-y:var(--spacing-3);--scb-textfield-min-height:48px;--scb-textfield-font-size:var(--md-sys-typescale-body-medium-size);--scb-textfield-line-height:var(--md-sys-typescale-body-medium-line-height);--scb-textfield-leading-icon-size:var(--icon-size-small, 20px);--scb-textfield-leading-gap:var(--spacing-5);--scb-textfield-trailing-icon-size:var(--icon-size-small, 20px);--scb-textfield-trailing-gap:var(--spacing-3);--scb-textfield-trailing-action-size:var(--scale-10, 40px)}:host([size='extra-small']),:host([size='small']){--scb-textfield-font-size:var(--md-sys-typescale-body-small-size);--scb-textfield-line-height:var(--md-sys-typescale-body-small-line-height)}:host([size='small']){--scb-textfield-padding-x:var(--spacing-4);--scb-textfield-padding-y:var(--spacing-3);--scb-textfield-min-height:40px;--scb-textfield-leading-icon-size:var(--icon-size-small, 20px);--scb-textfield-leading-gap:var(--spacing-5);--scb-textfield-trailing-icon-size:var(--icon-size-small, 20px);--scb-textfield-trailing-gap:var(--spacing-3);--scb-textfield-trailing-action-size:var(--scale-09, 36px)}:host([size='extra-small']){--scb-textfield-padding-x:var(--spacing-3);--scb-textfield-padding-y:var(--spacing-2);--scb-textfield-min-height:32px;--scb-textfield-leading-icon-size:var(--icon-size-extra-small, 16px);--scb-textfield-leading-gap:var(--spacing-4);--scb-textfield-trailing-icon-size:var(--icon-size-extra-small, 16px);--scb-textfield-trailing-gap:var(--spacing-2);--scb-textfield-trailing-action-size:var(--scale-08, 32px)}:host([type='number']){--scb-textfield-max-width:var(--scb-textfield-number-max-width)}:host([type='datetime-local']),:host([type='text']){--scb-textfield-max-width:var(--scb-textfield-text-max-width)}:host([type='search']){--scb-textfield-max-width:var(--scb-textfield-search-max-width)}:host([type='email']){--scb-textfield-max-width:var(--scb-textfield-email-max-width)}:host([type='password']){--scb-textfield-max-width:var(--scb-textfield-password-max-width)}:host([type='tel']){--scb-textfield-max-width:var(--scb-textfield-tel-max-width)}:host([type='url']){--scb-textfield-max-width:var(--scb-textfield-url-max-width)}:host([type='textarea']){--scb-textfield-max-width:var(--scb-textfield-textarea-max-width)}:host([type='date']),:host([type='time']){--scb-textfield-max-width:var(--scb-textfield-text-max-width)}input[type=time]::-webkit-calendar-picker-indicator{display:none;background:0 0}:host{display:flex;flex-direction:column;max-width:var(--scb-textfield-max-width)}:host([error]) .scb-textfield-supporting-text{color:var(--md-sys-color-error)}:host([error]) .scb-textfield{border-color:var(--md-sys-color-error)}:host([error]) .scb-textfield:focus-visible{border-color:var(--md-sys-color-error);box-shadow:inset 0 0 0 2px var(--md-sys-color-error)}:host([disabled]){opacity:.38;cursor:default}.scb-textfield-label{display:block;font-size:var(--scb-textfield-label-font-size);font-weight:var(--weight-semibold);line-height:var(--scb-textfield-label-line-height);letter-spacing:var(--scb-textfield-label-letter-spacing)}.scb-textfield-label--without-supporting,.scb-textfield-supporting-text{margin-bottom:var(--scb-textfield-label-gap)}.scb-textfield-supporting-text{display:block;font-size:var(--scb-textfield-supporting-font-size);line-height:var(--scb-textfield-supporting-line-height);letter-spacing:var(--scb-textfield-supporting-letter-spacing);color:var(--md-sys-color-on-surface-variant)}.scb-textfield{padding:var(--scb-textfield-padding-y) var(--scb-textfield-padding-x);min-height:var(--scb-textfield-min-height);border:1px solid var(--md-sys-color-outline);border-radius:var(--md-sys-shape-corner-small);font-size:var(--scb-textfield-font-size);font-family:var(--brand-font);line-height:var(--scb-textfield-line-height);width:100%;box-sizing:border-box;background-color:transparent;color:var(--md-sys-color-on-surface);position:relative;z-index:1}:host([type='date']) .scb-textfield,:host([type='search']) .scb-textfield{padding-right:var(--scb-textfield-trailing-reserved)}md-icon+.ripple-wrapper>.scb-textfield{padding-left:var(--scb-textfield-leading-padding)}.scb-textfield-icon{position:absolute;left:var(--scb-textfield-leading-inset);top:50%;transform:translateY(-50%);pointer-events:none;font-size:var(--scb-textfield-leading-icon-size);z-index:2}.scb-textfield:focus-visible{outline:0;box-shadow:inset 0 0 0 2px var(--md-sys-color-primary);border:1px solid var(--md-sys-color-primary)}.ripple-wrapper,.scb-textfield-wrapper{position:relative;width:100%}md-focus-ring.input-ring,md-ripple{border-radius:var(--md-sys-shape-corner-small);position:absolute;inset:0;pointer-events:none}md-focus-ring.input-ring{display:none;z-index:3}.ripple-wrapper[data-kb-focus=true] md-focus-ring.input-ring{display:block}md-ripple{z-index:0;--md-ripple-hover-color:transparent;--md-ripple-hover-opacity:0}input[type=search]::-webkit-search-cancel-button{appearance:none;display:none}.scb-textfield-clear,.scb-textfield-error-icon{position:absolute;right:var(--scb-textfield-trailing-inset);top:50%;transform:translateY(-50%);z-index:2}.scb-textfield-error-icon{pointer-events:none;font-size:var(--scb-textfield-trailing-icon-size);color:var(--md-sys-color-error)}.scb-textfield.has-error-icon{padding-right:calc(var(--scb-textfield-trailing-inset) + var(--scb-textfield-trailing-icon-size) + var(--scb-textfield-trailing-gap))}.scb-textfield-clear{width:var(--scb-textfield-trailing-icon-size);height:var(--scb-textfield-trailing-icon-size);padding:0;margin:0;border:0;background:0 0;display:inline-flex;align-items:center;justify-content:center;cursor:pointer;color:var(--md-sys-color-on-surface)}:host([error]) .scb-textfield-clear{right:calc(var(--scb-textfield-trailing-inset) + var(--scb-textfield-trailing-icon-size) + var(--spacing-2))}.scb-textfield-clear:focus-visible{outline:2px solid var(--md-sys-color-primary);outline-offset:2px}.scb-textfield-clear svg{width:100%;height:100%;display:block}.scb-textfield-datepicker-button{position:absolute;right:var(--scb-textfield-trailing-inset);top:50%;transform:translateY(-50%);z-index:4}`],y);function D(){const s=b(c,this,v).call(this,this.spacing),e=b(c,this,v).call(this,this.spacingTop)??s,t=b(c,this,v).call(this,this.spacingBottom)??s,i=b(c,this,v).call(this,this.spacingLeft),o=b(c,this,v).call(this,this.spacingRight);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"),i?this.style.setProperty("--scb-textfield-spacing-inline-start",i):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")}function v(s){if(!s)return;const e=String(s).trim();if(e)return/^\d+$/.test(e)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(e,10)))})`:e}function w(s=!1){const e=this.shadowRoot?.querySelector(".scb-textfield");if(!(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement))return!0;const t=this.errorText||"Ogiltig inmatning.";let i="";if(e.setCustomValidity(""),this.required&&!e.value)i=t,e.setCustomValidity(i);else if(this.pattern&&e.value)try{new RegExp(this.pattern).test(e.value)||(i=t,e.setCustomValidity(i))}catch{e.setCustomValidity("")}const o=s?e.reportValidity():e.checkValidity();if(this.error=!o,this._internals)if(o)this._internals.setValidity({});else{const u=i||e.validationMessage||t;this._internals.setValidity({customError:!0},u,e)}return o}function M(){const s=this.shadowRoot?.querySelector(".scb-textfield");s&&(s instanceof HTMLInputElement||s instanceof HTMLTextAreaElement)&&this._boundField!==s&&(b(c,this,L).call(this),this._boundField=s,this.type!=="time"&&s.addEventListener("input",this._onFieldInput),s.addEventListener("change",this._onFieldChange),s.addEventListener("select",this._onFieldSelect),s.addEventListener("focus",this._onFieldFocus),s.addEventListener("blur",this._onFieldBlur))}function L(){const s=this._boundField;s&&(s.removeEventListener("input",this._onFieldInput),s.removeEventListener("change",this._onFieldChange),s.removeEventListener("select",this._onFieldSelect),s.removeEventListener("focus",this._onFieldFocus),s.removeEventListener("blur",this._onFieldBlur),this._boundField=null)}function q(){this._showDatepicker=!1;const s=this.shadowRoot?.querySelector(".scb-textfield");if(s&&(s instanceof HTMLInputElement||s instanceof HTMLTextAreaElement)&&(s.value="",s.setCustomValidity("")),this.value="",this.error=!1,this._internals){const e=this.disabled?null:"";this._internals.setFormValue(e),this._internals.setValidity({})}}function _(){const s=this.renderRoot?.querySelector(".ripple-wrapper");s&&(this._inputFocused&&this._kbShouldShowRing?s.setAttribute("data-kb-focus","true"):s.removeAttribute("data-kb-focus"))}r([p({type:String,reflect:!0})],h.prototype,"type",void 0);r([p({type:String})],h.prototype,"label",void 0);r([p({type:String,attribute:"supporting-text"})],h.prototype,"supportingText",void 0);r([p({type:String,attribute:"error-text"})],h.prototype,"errorText",void 0);r([p({type:String,attribute:"leading-icon"})],h.prototype,"leadingIcon",void 0);r([p({type:String})],h.prototype,"name",void 0);r([p({type:String})],h.prototype,"pattern",void 0);r([p({type:String,attribute:"value"})],h.prototype,"value",void 0);r([p({type:String})],h.prototype,"underLabel",void 0);r([p({type:Boolean,reflect:!0})],h.prototype,"error",void 0);r([p({type:Boolean,reflect:!0})],h.prototype,"disabled",void 0);r([p({type:Boolean,reflect:!0})],h.prototype,"required",void 0);r([p({type:String,reflect:!0})],h.prototype,"size",void 0);r([p({type:String,reflect:!0})],h.prototype,"spacing",void 0);r([p({type:String,attribute:"spacing-top",reflect:!0})],h.prototype,"spacingTop",void 0);r([p({type:String,attribute:"spacing-bottom",reflect:!0})],h.prototype,"spacingBottom",void 0);r([p({type:String,attribute:"spacing-left",reflect:!0})],h.prototype,"spacingLeft",void 0);r([p({type:String,attribute:"spacing-right",reflect:!0})],h.prototype,"spacingRight",void 0);r([m()],h.prototype,"_showDatepicker",void 0);h=r([S("scb-textfield")],h);
|
|
232
|
+
)}:host([size='extra-small']),:host([size='medium']),:host([size='small']){--scb-textfield-label-font-size:var(--md-sys-typescale-label-small-size);--scb-textfield-label-line-height:var(--md-sys-typescale-label-small-line-height);--scb-textfield-label-letter-spacing:var(--md-sys-typescale-label-small-tracking);--scb-textfield-supporting-font-size:var(--md-sys-typescale-body-small-size);--scb-textfield-supporting-line-height:var(--md-sys-typescale-body-small-line-height);--scb-textfield-supporting-letter-spacing:var(--md-sys-typescale-body-small-tracking);--scb-textfield-leading-inset:var(--spacing-3);--scb-textfield-trailing-inset:var(--spacing-3)}:host([size='medium']){--scb-textfield-padding-x:var(--spacing-4);--scb-textfield-padding-y:var(--spacing-3);--scb-textfield-min-height:48px;--scb-textfield-font-size:var(--md-sys-typescale-body-medium-size);--scb-textfield-line-height:var(--md-sys-typescale-body-medium-line-height);--scb-textfield-leading-icon-size:var(--icon-size-small, 20px);--scb-textfield-leading-gap:var(--spacing-5);--scb-textfield-trailing-icon-size:var(--icon-size-small, 20px);--scb-textfield-trailing-gap:var(--spacing-3);--scb-textfield-trailing-action-size:var(--scale-10, 40px)}:host([size='extra-small']),:host([size='small']){--scb-textfield-font-size:var(--md-sys-typescale-body-small-size);--scb-textfield-line-height:var(--md-sys-typescale-body-small-line-height)}:host([size='small']){--scb-textfield-padding-x:var(--spacing-4);--scb-textfield-padding-y:var(--spacing-3);--scb-textfield-min-height:40px;--scb-textfield-leading-icon-size:var(--icon-size-small, 20px);--scb-textfield-leading-gap:var(--spacing-5);--scb-textfield-trailing-icon-size:var(--icon-size-small, 20px);--scb-textfield-trailing-gap:var(--spacing-3);--scb-textfield-trailing-action-size:var(--scale-09, 36px)}:host([size='extra-small']){--scb-textfield-padding-x:var(--spacing-3);--scb-textfield-padding-y:var(--spacing-2);--scb-textfield-min-height:32px;--scb-textfield-leading-icon-size:var(--icon-size-extra-small, 16px);--scb-textfield-leading-gap:var(--spacing-4);--scb-textfield-trailing-icon-size:var(--icon-size-extra-small, 16px);--scb-textfield-trailing-gap:var(--spacing-2);--scb-textfield-trailing-action-size:var(--scale-08, 32px)}:host([type='number']){--scb-textfield-max-width:var(--scb-textfield-number-max-width)}:host([type='datetime-local']),:host([type='text']){--scb-textfield-max-width:var(--scb-textfield-text-max-width)}:host([type='search']){--scb-textfield-max-width:var(--scb-textfield-search-max-width)}:host([type='email']){--scb-textfield-max-width:var(--scb-textfield-email-max-width)}:host([type='password']){--scb-textfield-max-width:var(--scb-textfield-password-max-width)}:host([type='tel']){--scb-textfield-max-width:var(--scb-textfield-tel-max-width)}:host([type='url']){--scb-textfield-max-width:var(--scb-textfield-url-max-width)}:host([type='textarea']){--scb-textfield-max-width:var(--scb-textfield-textarea-max-width)}:host([type='date']),:host([type='time']){--scb-textfield-max-width:var(--scb-textfield-text-max-width)}input[type=time]::-webkit-calendar-picker-indicator{display:none;background:0 0}:host{display:flex;flex-direction:column;max-width:var(--scb-textfield-max-width)}:host([error]) .scb-textfield-supporting-text{color:var(--md-sys-color-error)}:host([error]) .scb-textfield{border-color:var(--md-sys-color-error)}:host([error]) .scb-textfield:focus-visible{border-color:var(--md-sys-color-error);box-shadow:inset 0 0 0 2px var(--md-sys-color-error)}:host([disabled]){opacity:.38;cursor:default}.scb-textfield-label{display:block;font-size:var(--scb-textfield-label-font-size);font-weight:var(--weight-semibold);line-height:var(--scb-textfield-label-line-height);letter-spacing:var(--scb-textfield-label-letter-spacing)}.scb-textfield-label--without-supporting,.scb-textfield-supporting-text{margin-bottom:var(--scb-textfield-label-gap)}.scb-textfield-supporting-text{display:block;font-size:var(--scb-textfield-supporting-font-size);line-height:var(--scb-textfield-supporting-line-height);letter-spacing:var(--scb-textfield-supporting-letter-spacing);color:var(--md-sys-color-on-surface-variant)}.scb-textfield{padding:var(--scb-textfield-padding-y) var(--scb-textfield-padding-x);min-height:var(--scb-textfield-min-height);border:1px solid var(--md-sys-color-outline);border-radius:var(--md-sys-shape-corner-small);font-size:var(--scb-textfield-font-size);font-family:var(--brand-font);line-height:var(--scb-textfield-line-height);width:100%;box-sizing:border-box;background-color:transparent;color:var(--md-sys-color-on-surface);position:relative;z-index:1}:host([type='date']) .scb-textfield,:host([type='search']) .scb-textfield{padding-right:var(--scb-textfield-trailing-reserved)}md-icon+.ripple-wrapper>.scb-textfield{padding-left:var(--scb-textfield-leading-padding)}.scb-textfield-icon{position:absolute;left:var(--scb-textfield-leading-inset);top:50%;transform:translateY(-50%);pointer-events:none;font-size:var(--scb-textfield-leading-icon-size);z-index:2}.scb-textfield:focus-visible{outline:0;box-shadow:inset 0 0 0 2px var(--md-sys-color-primary);border:1px solid var(--md-sys-color-primary)}.ripple-wrapper,.scb-textfield-wrapper{position:relative;width:100%}md-focus-ring.input-ring,md-ripple{border-radius:var(--md-sys-shape-corner-small);position:absolute;inset:0;pointer-events:none}md-focus-ring.input-ring{display:none;z-index:3}.ripple-wrapper[data-kb-focus=true] md-focus-ring.input-ring{display:block}md-ripple{z-index:0;--md-ripple-hover-color:transparent;--md-ripple-hover-opacity:0}input[type=search]::-webkit-search-cancel-button{appearance:none;display:none}.scb-textfield-clear,.scb-textfield-error-icon{position:absolute;right:var(--scb-textfield-trailing-inset);top:50%;transform:translateY(-50%);z-index:2}.scb-textfield-error-icon{pointer-events:none;font-size:var(--scb-textfield-trailing-icon-size);color:var(--md-sys-color-error)}.scb-textfield.has-error-icon{padding-right:calc(var(--scb-textfield-trailing-inset) + var(--scb-textfield-trailing-icon-size) + var(--scb-textfield-trailing-gap))}.scb-textfield-clear{width:var(--scb-textfield-trailing-icon-size);height:var(--scb-textfield-trailing-icon-size);padding:0;margin:0;border:0;background:0 0;display:inline-flex;align-items:center;justify-content:center;cursor:pointer;color:var(--md-sys-color-on-surface)}:host([error]) .scb-textfield-clear{right:calc(var(--scb-textfield-trailing-inset) + var(--scb-textfield-trailing-icon-size) + var(--spacing-2))}.scb-textfield-clear:focus-visible{outline:2px solid var(--md-sys-color-primary);outline-offset:2px}.scb-textfield-clear svg{width:100%;height:100%;display:block}.scb-textfield-datepicker-button{position:absolute;right:var(--scb-textfield-trailing-inset);top:50%;transform:translateY(-50%);z-index:4}`],b);function x(){const t=a(s,this,h).call(this,this.spacing),e=a(s,this,h).call(this,this.spacingTop)??t,i=a(s,this,h).call(this,this.spacingBottom)??t,n=a(s,this,h).call(this,this.spacingLeft),c=a(s,this,h).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"),n?this.style.setProperty("--scb-textfield-spacing-inline-start",n):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")}function h(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}function f(t=!1){const e=this.shadowRoot?.querySelector(".scb-textfield");if(!(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement))return!0;const i=this.errorText||"Ogiltig inmatning.";let n="";if(e.setCustomValidity(""),this.required&&!e.value)n=i,e.setCustomValidity(n);else if(this.pattern&&e.value)try{new RegExp(this.pattern).test(e.value)||(n=i,e.setCustomValidity(n))}catch{e.setCustomValidity("")}const c=t?e.reportValidity():e.checkValidity();if(this.error=!c,this._internals)if(c)this._internals.setValidity({});else{const p=n||e.validationMessage||i;this._internals.setValidity({customError:!0},p,e)}return c}function m(){const t=this.shadowRoot?.querySelector(".scb-textfield");t&&(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement)&&this._boundField!==t&&(a(s,this,v).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))}function v(){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)}function S(){this._showDatepicker=!1;const t=this.shadowRoot?.querySelector(".scb-textfield");if(t&&(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement)&&(t.value="",t.setCustomValidity("")),this.value="",this.error=!1,this._internals){const e=this.disabled?null:"";this._internals.setFormValue(e),this._internals.setValidity({})}}function g(){const t=this.renderRoot?.querySelector(".ripple-wrapper");t&&(this._inputFocused&&this._kbShouldShowRing?t.setAttribute("data-kb-focus","true"):t.removeAttribute("data-kb-focus"))}r([d({type:String,reflect:!0})],l.prototype,"type",void 0);r([d({type:String})],l.prototype,"label",void 0);r([d({type:String,attribute:"supporting-text"})],l.prototype,"supportingText",void 0);r([d({type:String,attribute:"error-text"})],l.prototype,"errorText",void 0);r([d({type:String,attribute:"leading-icon"})],l.prototype,"leadingIcon",void 0);r([d({type:String})],l.prototype,"name",void 0);r([d({type:String})],l.prototype,"pattern",void 0);r([d({type:String,attribute:"value"})],l.prototype,"value",void 0);r([d({type:String})],l.prototype,"underLabel",void 0);r([d({type:Boolean,reflect:!0})],l.prototype,"error",void 0);r([d({type:Boolean,reflect:!0})],l.prototype,"disabled",void 0);r([d({type:Boolean,reflect:!0})],l.prototype,"required",void 0);r([d({type:String,reflect:!0})],l.prototype,"size",void 0);r([d({type:String,reflect:!0})],l.prototype,"spacing",void 0);r([d({type:String,attribute:"spacing-top",reflect:!0})],l.prototype,"spacingTop",void 0);r([d({type:String,attribute:"spacing-bottom",reflect:!0})],l.prototype,"spacingBottom",void 0);r([d({type:String,attribute:"spacing-left",reflect:!0})],l.prototype,"spacingLeft",void 0);r([d({type:String,attribute:"spacing-right",reflect:!0})],l.prototype,"spacingRight",void 0);r([_()],l.prototype,"_showDatepicker",void 0);l=r([$("scb-textfield")],l);
|