scb-wc 0.1.239 → 0.1.240
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 +16 -19
- package/all.d.ts +0 -14
- package/all.js +0 -14
- package/index.js +85 -99
- package/mvc/components/all.js +0 -9
- package/mvc/components/scb-accordion/scb-accordion-item.js +1 -1
- package/mvc/components/scb-accordion/scb-accordion.js +1 -1
- package/mvc/components/scb-app-bar/scb-app-bar.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 +2 -2
- package/mvc/components/scb-cookies-consent/scb-cookies-consent.js +1 -1
- package/mvc/components/scb-dialog/scb-dialog.js +1 -1
- package/mvc/components/scb-drawer/scb-drawer.js +3 -3
- package/mvc/components/scb-drop-zone/scb-drop-zone.js +1 -1
- package/mvc/components/scb-dropdown/scb-dropdown.js +1 -1
- package/mvc/components/scb-fact-card/scb-fact-card.js +1 -1
- package/mvc/components/scb-header/scb-header.js +2 -2
- package/mvc/components/scb-horizontal-scroller/scb-horizontal-scroller.js +6 -6
- 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-link/scb-link.js +1 -1
- package/mvc/components/scb-link-button/scb-link-button.js +1 -1
- package/mvc/components/scb-list/scb-list-item.js +6 -6
- package/mvc/components/scb-menu/scb-menu-item.js +1 -1
- package/mvc/components/scb-nav/scb-nav.js +1 -1
- package/mvc/components/scb-notification-card/scb-notification-card.js +1 -1
- package/mvc/components/scb-options-menu/scb-options-menu-item.js +1 -1
- package/mvc/components/scb-options-menu/scb-options-menu.js +2 -2
- package/mvc/components/scb-options-menu/scb-options-sub-menu.js +1 -1
- package/mvc/components/scb-overlay/scb-overlay.js +3 -3
- package/mvc/components/scb-pagination/scb-pagination.js +1 -1
- package/mvc/components/scb-progress-stepper/scb-progress-step.js +1 -1
- package/mvc/components/scb-search/scb-search.js +3 -3
- 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-snackbar/scb-snackbar.js +1 -1
- package/mvc/components/scb-stepper/scb-step.js +1 -1
- package/mvc/components/scb-table/scb-table.js +1 -1
- package/mvc/components/scb-table-advanced/scb-table-advanced.js +1 -1
- package/mvc/components/scb-textfield/scb-textfield.js +176 -34
- package/mvc/components/scb-toc/scb-toc-item.js +1 -1
- package/mvc/components/scb-tooltip/scb-tooltip.js +1 -1
- package/mvc/{components/shared → vendor}/component-size-token.js +1 -1
- package/mvc/vendor/lazy-focus-ring.js +2 -0
- package/mvc/vendor/lazy-ripple.js +2 -0
- package/mvc/{components/shared → vendor}/manual-popover.js +1 -1
- package/mvc/{components/scb-chevron → vendor}/scb-chevron.js +1 -1
- package/mvc/vendor/scb-icon-svg.js +11 -0
- package/package.json +2 -12
- package/scb-viz/scb-viz-series-differentiation-registry.js +7 -10
- package/scb-viz/scb-viz.js +43 -43
- package/scb-wc.bundle.js +286 -407
- package/scb-wc.d.ts +0 -28
- package/shared/scb-icon-svg.js +2 -5
- package/mvc/components/scb-datepicker/scb-datepicker.js +0 -143
- package/mvc/components/scb-table-next/read-table.js +0 -1
- package/mvc/components/scb-table-next/scb-table-next.js +0 -6
- package/mvc/components/shared/lazy-focus-ring.js +0 -2
- package/mvc/components/shared/lazy-ripple.js +0 -2
- package/mvc/components/shared/scb-icon-svg.js +0 -11
- package/scb-components/index.d.ts +0 -108
- package/scb-components/scb-table-next/read-table.d.ts +0 -29
- package/scb-components/scb-table-next/scb-table-next.d.ts +0 -22
- package/scb-components/scb-viz/scb-viz-actions-runtime.d.ts +0 -26
- package/scb-components/scb-viz/scb-viz-print-runtime.d.ts +0 -30
- package/scb-components/scb-viz/scb-viz-series-differentiation-registry.d.ts +0 -21
- package/scb-components/scb-viz/scb-viz-series-differentiation-runtime.d.ts +0 -42
- package/scb-components/scb-viz/scb-viz-table-runtime.d.ts +0 -28
- package/scb-components/shared/component-size-token.d.ts +0 -1
- package/scb-components/shared/lazy-focus-ring.d.ts +0 -4
- package/scb-components/shared/lazy-ripple.d.ts +0 -9
- package/scb-components/shared/manual-popover.d.ts +0 -7
- package/scb-components/shared/scb-icon-svg.d.ts +0 -3
- package/scb-table-next/read-table.js +0 -87
- package/scb-table-next/scb-table-next.js +0 -226
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{f as $,g as v,h as k,m as T,p as a,v as d,y as S}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import"../../vendor/ripple.js";import{
|
|
1
|
+
import{f as $,g as v,h as k,m as T,p as a,v as d,y as S}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import"../../vendor/ripple.js";import{n as f}from"../../vendor/lazy-focus-ring.js";import{t as r}from"../../vendor/decorate.js";import{a as E,i as m,t as y}from"../../vendor/manual-popover.js";(function(){try{var c=typeof globalThis<"u"?globalThis:window;if(!c.__scb_ce_guard_installed__){c.__scb_ce_guard_installed__=!0;var e=customElements.define.bind(customElements);customElements.define=function(t,p,l){try{customElements.get(t)||e(t,p,l)}catch(i){var o=String(i||"");if(o.indexOf("already been used")===-1&&o.indexOf("NotSupportedError")===-1)throw i}}}}catch{}})();var b,s=(b=class extends k{constructor(...e){super(...e),this.width="100%",this.active=!1,this.current=!1,this.disabled=!1,this.href="",this.label="",this.position="top",this._stepId=`scb-step-${Math.random().toString(36).slice(2)}`,this._showTooltip=()=>{const t=this.renderRoot.querySelector(".tooltip"),p=this.renderRoot.querySelector(".progress-step");!this.label||this.disabled||!E(t,p,"hint")||this._adjustTooltipPosition()},this._hideTooltip=()=>{y(this.renderRoot.querySelector(".tooltip"))},this._adjustTooltipPosition=()=>{const t=this.renderRoot.querySelector(".tooltip"),p=this.renderRoot.querySelector(".progress-step");if(!t||!p||!m(t))return;const l=10,o=8,i=p.getBoundingClientRect(),n=t.getBoundingClientRect(),w=this.position==="top",u=i.bottom+l+n.height<=window.innerHeight-o,g=i.top-l-n.height>=o,h=w?u||!g:!g&&u,_=Math.min(Math.max(i.left+(i.width-n.width)/2,o),Math.max(o,window.innerWidth-n.width-o)),x=h?Math.min(i.bottom+l,window.innerHeight-n.height-o):Math.max(o,i.top-l-n.height);t.classList.toggle("top",h),t.classList.toggle("bottom",!h),t.classList.remove("tooltip-left","tooltip-right"),t.style.left=`${_}px`,t.style.right="",t.style.top=`${x}px`,t.style.bottom="auto",t.style.transform="none"}}connectedCallback(){super.connectedCallback(),this.hasAttribute("role")||this.setAttribute("role","listitem")}disconnectedCallback(){this._tooltipObserver?.disconnect(),window.removeEventListener("resize",this._adjustTooltipPosition),window.removeEventListener("scroll",this._adjustTooltipPosition,!0),y(this.renderRoot.querySelector(".tooltip")),super.disconnectedCallback()}updated(e){super.updated?.(e),this.style.setProperty("--progress-step-width",this.width),(e.has("label")||e.has("position"))&&m(this.renderRoot.querySelector(".tooltip"))&&this._adjustTooltipPosition()}_onClick(){if(this.disabled)return;const e={width:this.width,label:this.label,active:this.active,disabled:this.disabled,href:this.href||void 0};this.dispatchEvent(new CustomEvent("step-click",{detail:e,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("stepclick",{detail:e,bubbles:!0,composed:!0}))}_onKeydown(e){if(e.key==="Tab"){this._hideTooltip();return}this.disabled||this.href||e.key!=="Enter"&&e.key!==" "||(e.preventDefault(),this._onClick())}firstUpdated(e){super.firstUpdated?.(e),this._setupTooltipPositioning()}_setupTooltipPositioning(){this._tooltipObserver=new MutationObserver(()=>this._adjustTooltipPosition()),this._tooltipObserver.observe(this,{attributes:!0}),window.addEventListener("resize",this._adjustTooltipPosition),window.addEventListener("scroll",this._adjustTooltipPosition,{passive:!0,capture:!0})}render(){const e=!!this.href&&!this.disabled,t=this.label?.trim()||"Steg";return d`
|
|
2
2
|
${e?d`
|
|
3
3
|
<a
|
|
4
4
|
id=${this._stepId}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../scb-list/scb-list.js","../../vendor/vendor.js","../../vendor/vendor-lit.js","../../vendor/component-defaults.js","../../vendor/decorate.js","../scb-list/scb-list-item.js","../../vendor/preload-helper.js","
|
|
2
|
-
import{f as w,g as b,h as k,m as z,p as c,v as d,y as S}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import"../../vendor/icon.js";import"../../vendor/ripple.js";import{t as A}from"../../vendor/preload-helper.js";import{
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../scb-list/scb-list.js","../../vendor/vendor.js","../../vendor/vendor-lit.js","../../vendor/component-defaults.js","../../vendor/decorate.js","../scb-list/scb-list-item.js","../../vendor/preload-helper.js","../../vendor/component-size-token.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{f as w,g as b,h as k,m as z,p as c,v as d,y as S}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import"../../vendor/icon.js";import"../../vendor/ripple.js";import{t as A}from"../../vendor/preload-helper.js";import{r as E}from"../../vendor/lazy-focus-ring.js";import{t as V}from"../../vendor/component-size-token.js";import{t as I}from"../../vendor/component-defaults.js";import{t as n}from"../../vendor/decorate.js";import{a as L,i as R,t as _}from"../../vendor/manual-popover.js";(function(){try{var f=typeof globalThis<"u"?globalThis:window;if(!f.__scb_ce_guard_installed__){f.__scb_ce_guard_installed__=!0;var e=customElements.define.bind(customElements);customElements.define=function(s,t,i){try{customElements.get(s)||e(s,t,i)}catch(l){var r=String(l||"");if(r.indexOf("already been used")===-1&&r.indexOf("NotSupportedError")===-1)throw l}}}}catch{}})();var m,C=0,a=(m=class extends k{async _ensureListDepsLoaded(){this._listDepsLoaded||(this._listDepsPromise??(this._listDepsPromise=A(()=>import("../scb-list/scb-list.js").then(()=>{this._listDepsLoaded=!0}),__vite__mapDeps([0,1,2,3,4,5,6,7]),import.meta.url)),await this._listDepsPromise)}_ensureListDepsWhenNeeded(){const e=(this.value??"").trim().length>0;!this._inputFocused||!e||!this._hasSuggestions||this._ensureListDepsLoaded().then(()=>this.requestUpdate())}constructor(){super(),this._internals=null,this.supportingText="",this.inputLabel="",this.clearLabel="Rensa sökfält",this.suggestionsLabel="Sökförslag",this.errorText="",this.value="",this.name="",this.disabled=!1,this.required=!1,this.error=!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=I["scb-search"].size,this.fullScreen=!1,this._inputFocused=!1,this._visibleSuggestions=0,this._listDepsLoaded=!1,this._activeIndex=-1,this._listboxId=`scb-search-listbox-${++C}`,this._kbMode=!1,this._valueOnFocus="",this._lastChangeValue="",this._kbShouldShowRing=!1,this._onGlobalKeydown=e=>{e.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._validationMessage="",this._hasValidationBeenReported=!1,this._onViewportScroll=()=>{this._positionSuggestionPopover()},this._listScrollHandler=()=>{const e=this._getActiveItem();this._kbMode&&e&&this._positionOptionRing(e)},"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(),this._syncDensityForSize(),this._onWindowResize=this._onWindowResize.bind(this),window.addEventListener("resize",this._onWindowResize,{passive:!0}),window.addEventListener("scroll",this._onViewportScroll,{passive:!0,capture:!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=e=>{this.reportValidity()||(e.preventDefault(),e.stopPropagation())},this._form.addEventListener("submit",this._formSubmitHandler,!0),this._formResetHandler=()=>{this.value=this._initialValue;const e=this._inputEl();e&&(e.value=this._initialValue),this._lastChangeValue=this._initialValue,this._syncFormValue(),this._filterSuggestions(this.value),this._activeIndex=-1,this._kbMode=!1,this.error=!1,this._hasValidationBeenReported=!1,this._updateComboboxA11y(),this._syncValidity()},this._form.addEventListener("reset",this._formResetHandler,!0)),this._syncFormValue(),this._syncValidity()}disconnectedCallback(){const e=this._inputEl();e&&this._boundNativeKeydown&&e.removeEventListener("keydown",this._boundNativeKeydown,!0),this._detachListScrollListener(),window.removeEventListener("resize",this._onWindowResize),window.removeEventListener("scroll",this._onViewportScroll,!0),_(this._listEl()),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 e=this._inputEl();e&&(this._boundNativeKeydown=s=>this._handleKey(s),e.addEventListener("keydown",this._boundNativeKeydown,!0),e.disabled=this.disabled),this.applySpacing()}updated(e){if(super.updated(e),e.has("size")&&this._syncDensityForSize(),this._ensureListboxA11y(),this._updateComboboxA11y(),this._attachListScrollListener(),this._syncSuggestionPopover(),(e.has("value")||e.has("disabled"))&&this._syncFormValue(),(e.has("value")||e.has("disabled")||e.has("required")||e.has("errorText"))&&this._syncValidity(),e.has("disabled")){this.toggleAttribute("aria-disabled",this.disabled);const s=this._inputEl();s&&(s.disabled=this.disabled)}(e.has("spacing")||e.has("spacingTop")||e.has("spacingBottom")||e.has("spacingLeft")||e.has("spacingRight"))&&this.applySpacing()}render(){const e=(this.value??"").trim().length>0,s=this._inputFocused&&e&&this._hasSuggestions&&this._listDepsLoaded,t=this.error?this._validationMessage||this.errorText||"Ogiltig sökning.":"",i=t?"search-supporting-text":void 0,r=this.inputLabel||this.supportingText||"Sök";return d`
|
|
3
3
|
<div class="ripple-wrapper">
|
|
4
4
|
<md-icon class="leading">${e?"arrow_back":"search"}</md-icon>
|
|
5
5
|
|
|
@@ -50,7 +50,7 @@ import{f as w,g as b,h as k,m as z,p as c,v as d,y as S}from"../../vendor/vendor
|
|
|
50
50
|
<md-focus-ring id="optionRing" class="option-ring"></md-focus-ring>
|
|
51
51
|
`:b}
|
|
52
52
|
${t?d`<span id="search-supporting-text" class="supporting-text">${t}</span>`:b}
|
|
53
|
-
`}formDisabledCallback(e){this.disabled=e,e&&(this._hasValidationBeenReported=!1)}_getValidationMessage(){return this._customValidationMessage?this._customValidationMessage:this.required&&!(this.value??"").trim()?this.errorText||"Fyll i det här fältet.":""}_syncValidity(){const e=this._inputEl(),s=this.disabled?"":this._getValidationMessage(),t=this.error,i=this._validationMessage;if(e&&e.setCustomValidity(s),this._internals)if(s){const r=this._customValidationMessage?{customError:!0}:{valueMissing:!0};this._internals.setValidity(r,s,e??void 0)}else this._internals.setValidity({});this._validationMessage=s,this.error=this.disabled?!1:s?this._hasValidationBeenReported||t:t&&!this._hasValidationBeenReported&&!i,e&&e.setAttribute("aria-invalid",this.error?"true":"false"),this.toggleAttribute("aria-invalid",this.error),(t!==this.error||i!==this._validationMessage)&&this.requestUpdate()}checkValidity(){return this._syncValidity(),this._internals?this._internals.checkValidity():!this.error}reportValidity(){this._hasValidationBeenReported=!0,this._syncValidity();const e=this._inputEl();return e?e.reportValidity():this._internals?this._internals.reportValidity():this.checkValidity()}setCustomValidity(e){this._customValidationMessage=String(e??""),this._syncValidity()}get form(){return this._internals?.form??this._form}get validity(){return this._internals?.validity}get validationMessage(){return this._internals?.validationMessage??this._getValidationMessage()}get willValidate(){return this._internals?.willValidate??!0}get labels(){return this._internals?.labels}submit(){const e=this._getActiveItem(),s={value:this.value};e&&(s.active=this._itemPayload(e)),this._dispatchSubmit(s)}focus(e){const s=this._inputEl();if(s){s.focus(e);return}this.updateComplete.then(()=>this._inputEl()?.focus(e))}blur(){this._inputEl()?.blur()}get _hasSuggestions(){return this._visibleSuggestions>=0?this._visibleSuggestions>0:Array.from(this.getElementsByTagName("scb-list-item")).some(e=>!e.hasAttribute("hidden")&&e.style.display!=="none")}_onSlotChange(){this._filterSuggestions(this.value),this._ensureListDepsWhenNeeded()}_onInput(e){e.stopPropagation();const s=e.target;this.value=s.value,this._syncFormValue(),this._filterSuggestions(this.value),this._ensureListDepsWhenNeeded(),this._activeIndex=-1,this._kbMode=!1,this._updateComboboxA11y();const t={value:this.value};this.dispatchEvent(new CustomEvent("scb-search-input",{detail:t,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("scbsearchinput",{detail:t,bubbles:!0,composed:!0})),this._dispatchStandardInput()}_onNativeChange(e){e.stopPropagation()}_onFocus(){this.disabled||(this._valueOnFocus=this.value??"",this._inputFocused=!0,this._updateInputRingVisibility(),this._filterSuggestions(this.value),this._ensureListDepsWhenNeeded(),this._updateComboboxA11y(),this.requestUpdate())}_onBlur(){setTimeout(()=>{this._inputFocused=!1,this._activeIndex=-1,this._kbMode=!1,this._updateInputRingVisibility(),this._updateComboboxA11y(),this._hideOptionRing(),this._valueOnFocus!==(this.value??"")&&this._dispatchStandardChangeIfNeeded(),this.requestUpdate()},100)}_updateInputRingVisibility(){const e=this.renderRoot?.querySelector(".ripple-wrapper");e&&(this._inputFocused&&this._kbShouldShowRing?e.setAttribute("data-kb-focus","true"):e.removeAttribute("data-kb-focus"))}_handleKey(e){if(this.disabled||!this._inputEl())return;const s=this._getVisibleItems(),t=(this.value??"").trim().length>0,i=this._inputFocused&&t&&s.length>0,r=e.key,l=e.keyCode,h=r==="ArrowDown"||r==="Down"||l===40,g=r==="ArrowUp"||r==="Up"||l===38,o=r==="Home"||l===36,p=r==="End"||l===35,u=r==="Enter"||l===13,y=r==="Escape"||r==="Esc"||l===27;if(h){if(!i)return;e.preventDefault(),this._kbMode=!0,this._moveActive(s,1);return}if(g){if(!i)return;e.preventDefault(),this._kbMode=!0,this._moveActive(s,-1);return}if(o){if(!i)return;e.preventDefault(),this._kbMode=!0,this._activeIndex=s.length?0:-1,this._updateComboboxA11y(),this._scrollActiveIntoView();return}if(p){if(!i)return;e.preventDefault(),this._kbMode=!0,this._activeIndex=s.length?s.length-1:-1,this._updateComboboxA11y(),this._scrollActiveIntoView();return}if(u){if(!i){const v=this._internals?.form??this._form??this.closest("form");v?(e.preventDefault(),this.reportValidity()&&v.requestSubmit()):this.submit();return}e.preventDefault();const x=this._getActiveItem();if(x){const v=x.getAttribute("label")||"";this.value=v,this._syncFormValue(),this._dispatchStandardInput(),this._dispatchSubmit({value:this.value,active:this._itemPayload(x)}),this._visibleSuggestions=0,this._activeIndex=-1,this._kbMode=!1,this._hideOptionRing(),this.requestUpdate()}else this.submit();return}if(y){e.preventDefault(),this._clearInput();return}}_clearInput(){if(this.disabled)return;this.value="",this._activeIndex=-1,this._kbMode=!1;const e=this._inputEl();e&&(e.value="",e.focus()),this._filterSuggestions(""),this._updateComboboxA11y(),this._hideOptionRing(),this._syncFormValue(),this._dispatchStandardInput(),this.dispatchEvent(new CustomEvent("scb-search-clear",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("scbsearchclear",{bubbles:!0,composed:!0})),this._dispatchStandardChangeIfNeeded()}_filterSuggestions(e){const s=(e??"").trim().toLowerCase(),t=Array.from(this.querySelectorAll("scb-list-item"));let i=0;for(const r of t){const l=`${(r.getAttribute("label")||"").toLowerCase()} ${(r.getAttribute("supporting-text")||"").toLowerCase()}`.trim();s!==""&&l.includes(s)?(r.removeAttribute("hidden"),i++):r.setAttribute("hidden",""),this._ensureOptionA11y(r)}this._visibleSuggestions=i,this._activeIndex>=i&&(this._activeIndex=-1),this._updateComboboxA11y(),this.requestUpdate()}_inputEl(){return this.renderRoot?.querySelector("#searchInput")??null}_listEl(){return this.renderRoot?.querySelector("scb-list.suggestion-list")??null}_ringEl(){return this.renderRoot?.querySelector("#optionRing")??null}_getVisibleItems(){return Array.from(this.querySelectorAll("scb-list-item")).filter(e=>!e.hasAttribute("hidden")&&e.style.display!=="none")}_getActiveItem(){const e=this._getVisibleItems();return this._activeIndex<0||this._activeIndex>=e.length?null:e[this._activeIndex]??null}_moveActive(e,s){if(!e.length){this._activeIndex=-1,this._updateComboboxA11y(),this._hideOptionRing();return}let t=this._activeIndex+s;this._activeIndex===-1?t=s>0?0:e.length-1:(t<0&&(t=0),t>=e.length&&(t=e.length-1)),this._activeIndex=t,this._updateComboboxA11y(),this._scrollActiveIntoView()}_scrollActiveIntoView(){const e=this._getActiveItem(),s=this._listEl();if(!e||!s)return;const t=s.getBoundingClientRect(),i=e.getBoundingClientRect();i.top<t.top?s.scrollTop-=t.top-i.top:i.bottom>t.bottom&&(s.scrollTop+=i.bottom-t.bottom)}_itemPayload(e){return{label:e.getAttribute("label")||"",supportingText:e.getAttribute("supporting-text")||"",href:e.getAttribute("href")||"",type:e.getAttribute("type")||"",id:e.id||""}}_ensureListboxA11y(){const e=this._listEl();e&&(e.id||(e.id=this._listboxId),e.setAttribute("role","listbox"),e.setAttribute("aria-label",this.suggestionsLabel)),Array.from(this.querySelectorAll("scb-list-item")).forEach(s=>this._ensureOptionA11y(s))}_ensureOptionA11y(e){e.id||(e.id=`${this._listboxId}-opt-${Math.random().toString(36).slice(2,8)}`),e.setAttribute("role","option"),e.setAttribute("tabindex","-1")}_updateComboboxA11y(){const e=this._inputEl();if(!e)return;const s=this._getVisibleItems(),t=(this.value??"").trim().length>0,i=this._inputFocused&&t&&s.length>0;e.setAttribute("role","combobox"),e.setAttribute("aria-autocomplete","list"),e.setAttribute("aria-controls",this._listboxId),e.setAttribute("aria-expanded",String(i));const r=i?this._getActiveItem():null;r?.id?e.setAttribute("aria-activedescendant",r.id):e.removeAttribute("aria-activedescendant"),this._kbMode&&r&&i?this._positionOptionRing(r):this._hideOptionRing()}_positionOptionRing(e){const s=this._ringEl(),t=this._listEl();if(!s||!t)return;const i=this.getBoundingClientRect(),r=e.getBoundingClientRect(),l=r.top-i.top,h=r.left-i.left,g=r.width,o=r.height;s.style.top=`${l}px`,s.style.left=`${h}px`,s.style.width=`${g}px`,s.style.height=`${o}px`,s.setAttribute("data-show","true")}_hideOptionRing(){const e=this._ringEl();e&&e.removeAttribute("data-show")}_onWindowResize(){const e=this._getActiveItem();this._kbMode&&e&&this._positionOptionRing(e),this._positionSuggestionPopover()}_syncSuggestionPopover(){const e=this._listEl();if(!e||this.fullScreen){_(e);return}R(e)&&requestAnimationFrame(()=>this._positionSuggestionPopover())}_positionSuggestionPopover(){const e=this._listEl(),s=this._inputEl();if(!e||!s||!L(e))return;const t=s.getBoundingClientRect(),i=8,r=Math.max(0,window.innerWidth-i*2),l=Math.min(t.width,r),h=Math.min(Math.max(t.left,i),window.innerWidth-i-l),g=e.getBoundingClientRect().height||e.scrollHeight,o=window.innerHeight-t.bottom-i,p=t.top-i,u=g>o&&p>o,y=Math.max(0,u?p:o);e.style.position="fixed",e.style.left=`${Math.round(h)}px`,e.style.width=`${Math.round(l)}px`,e.style.right="auto",e.style.maxHeight=`${Math.round(y)}px`,u?(e.style.top="auto",e.style.bottom=`${Math.round(window.innerHeight-t.top)}px`):(e.style.top=`${Math.round(t.bottom)}px`,e.style.bottom="auto")}_attachListScrollListener(){const e=this._listEl();!e||this._listWithHandler===e||(this._detachListScrollListener(),e.addEventListener("scroll",this._listScrollHandler,{passive:!0}),this._listWithHandler=e)}_detachListScrollListener(){this._listWithHandler&&(this._listWithHandler.removeEventListener("scroll",this._listScrollHandler),this._listWithHandler=void 0)}_dispatchStandardInput(){this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0}))}_dispatchStandardChangeIfNeeded(){const e=this.value??"";e!==this._lastChangeValue&&(this._lastChangeValue=e,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))}_dispatchSubmit(e){this.dispatchEvent(new CustomEvent("scb-search-submit",{detail:e,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("scbsearchsubmit",{detail:e,bubbles:!0,composed:!0})),this._dispatchStandardChangeIfNeeded()}mapSpacingToken(e){if(!e)return;const s=String(e).trim();if(s)return/^\d+$/.test(s)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(s,10)))})`:s}applySpacing(){const e=this.mapSpacingToken(this.spacing),s=this.mapSpacingToken(this.spacingTop)??e,t=this.mapSpacingToken(this.spacingBottom)??e,i=this.mapSpacingToken(this.spacingLeft),r=this.mapSpacingToken(this.spacingRight);s?this.style.setProperty("--scb-search-spacing-block-start",s):this.style.removeProperty("--scb-search-spacing-block-start"),t?this.style.setProperty("--scb-search-spacing-block-end",t):this.style.removeProperty("--scb-search-spacing-block-end"),i?this.style.setProperty("--scb-search-spacing-inline-start",i):this.style.removeProperty("--scb-search-spacing-inline-start"),r?this.style.setProperty("--scb-search-spacing-inline-end",r):this.style.removeProperty("--scb-search-spacing-inline-end")}_syncFormValue(){if(!this._internals)return;const e=this.disabled?null:this.value;this._internals.setFormValue(e)}},m.formAssociated=!0,m.styles=S`:host{--scb-fields-text-font-weight-current:var(--scb-fields-text-medium-font-weight, var(--scb-fields-text-medium-weight, var(--scb-fields-text-font-weight, var(--scb-fields-text-weight))));--scb-fields-text-letter-spacing-current:var(--scb-fields-text-medium-letter-spacing, var(--scb-fields-text-medium-tracking, var(--scb-fields-text-letter-spacing, var(--scb-fields-text-tracking))));--scb-fields-text-line-height-current:var(--scb-fields-text-medium-line-height, var(--scb-fields-text-line-height));--scb-fields-text-size-current:var(--scb-fields-text-medium-size, var(--scb-fields-text-size));--scb-fields-text-font-current:var(--scb-fields-text-medium-font, var(--scb-fields-text-font));--scb-fields-label-font-weight-current:var(--scb-fields-label-medium-font-weight, var(--scb-fields-label-medium-weight, var(--scb-fields-label-font-weight, var(--scb-fields-label-weight))));--scb-fields-label-letter-spacing-current:var(--scb-fields-label-medium-letter-spacing, var(--scb-fields-label-medium-tracking, var(--scb-fields-label-letter-spacing, var(--scb-fields-label-tracking))));--scb-fields-label-line-height-current:var(--scb-fields-label-medium-line-height, var(--scb-fields-label-line-height));--scb-fields-label-size-current:var(--scb-fields-label-medium-size, var(--scb-fields-label-size));--scb-fields-label-font-current:var(--scb-fields-label-medium-font, var(--scb-fields-label-font));--scb-fields-supporting-font-weight-current:var(--scb-fields-supporting-medium-font-weight, var(--scb-fields-supporting-medium-weight, var(--scb-fields-supporting-font-weight, var(--scb-fields-supporting-weight))));--scb-fields-supporting-letter-spacing-current:var(--scb-fields-supporting-medium-letter-spacing, var(--scb-fields-supporting-medium-tracking, var(--scb-fields-supporting-letter-spacing, var(--scb-fields-supporting-tracking))));--scb-fields-supporting-line-height-current:var(--scb-fields-supporting-medium-line-height, var(--scb-fields-supporting-line-height));--scb-fields-supporting-size-current:var(--scb-fields-supporting-medium-size, var(--scb-fields-supporting-size));--scb-fields-supporting-font-current:var(--scb-fields-supporting-medium-font, var(--scb-fields-supporting-font));--scb-fields-option-text-font-weight-current:var(--scb-fields-option-text-medium-font-weight, var(--scb-fields-option-text-medium-weight, var(--scb-fields-option-text-font-weight, var(--scb-fields-option-text-weight))));--scb-fields-option-text-letter-spacing-current:var(--scb-fields-option-text-medium-letter-spacing, var(--scb-fields-option-text-medium-tracking, var(--scb-fields-option-text-letter-spacing, var(--scb-fields-option-text-tracking))));--scb-fields-option-text-line-height-current:var(--scb-fields-option-text-medium-line-height, var(--scb-fields-option-text-line-height));--scb-fields-option-text-size-current:var(--scb-fields-option-text-medium-size, var(--scb-fields-option-text-size));--scb-fields-option-text-font-current:var(--scb-fields-option-text-medium-font, var(--scb-fields-option-text-font));display:flex;flex-direction:column;position:relative;color:var(--scb-fields-content-color, var(--md-sys-color-on-surface));--md-focus-ring-color:var(--scb-fields-focus-color, var(--md-sys-color-primary));-webkit-tap-highlight-color:transparent;margin-block-start:var(--scb-search-spacing-block-start, 0);margin-block-end:var(--scb-search-spacing-block-end, 0);margin-inline-start:var(--scb-search-spacing-inline-start, 0);margin-inline-end:var(--scb-search-spacing-inline-end, 0);--scb-search-radius:var(--scb-search-design-surface-radius-medium);--scb-search-open-radius:var(--radius-xl, 24px);--scb-search-height:var(--scb-search-design-height-medium);--scb-search-padding-x:var(--scb-search-design-search-padding-inline-medium);--scb-search-padding-y:var(--scb-search-design-padding-block-medium);--scb-search-leading-size:var(--scb-search-design-search-action-size-medium);--scb-search-trailing-size:var(--scb-search-design-search-action-size-medium);--scb-search-gap:var(--scb-search-design-search-icon-gap);--scb-search-leading-gap:calc(
|
|
53
|
+
`}formDisabledCallback(e){this.disabled=e,e&&(this._hasValidationBeenReported=!1)}_getValidationMessage(){return this._customValidationMessage?this._customValidationMessage:this.required&&!(this.value??"").trim()?this.errorText||"Fyll i det här fältet.":""}_syncValidity(){const e=this._inputEl(),s=this.disabled?"":this._getValidationMessage(),t=this.error,i=this._validationMessage;if(e&&e.setCustomValidity(s),this._internals)if(s){const r=this._customValidationMessage?{customError:!0}:{valueMissing:!0};this._internals.setValidity(r,s,e??void 0)}else this._internals.setValidity({});this._validationMessage=s,this.error=this.disabled?!1:s?this._hasValidationBeenReported||t:t&&!this._hasValidationBeenReported&&!i,e&&e.setAttribute("aria-invalid",this.error?"true":"false"),this.toggleAttribute("aria-invalid",this.error),(t!==this.error||i!==this._validationMessage)&&this.requestUpdate()}checkValidity(){return this._syncValidity(),this._internals?this._internals.checkValidity():!this.error}reportValidity(){this._hasValidationBeenReported=!0,this._syncValidity();const e=this._inputEl();return e?e.reportValidity():this._internals?this._internals.reportValidity():this.checkValidity()}setCustomValidity(e){this._customValidationMessage=String(e??""),this._syncValidity()}get form(){return this._internals?.form??this._form}get validity(){return this._internals?.validity}get validationMessage(){return this._internals?.validationMessage??this._getValidationMessage()}get willValidate(){return this._internals?.willValidate??!0}get labels(){return this._internals?.labels}submit(){const e=this._getActiveItem(),s={value:this.value};e&&(s.active=this._itemPayload(e)),this._dispatchSubmit(s)}focus(e){const s=this._inputEl();if(s){s.focus(e);return}this.updateComplete.then(()=>this._inputEl()?.focus(e))}blur(){this._inputEl()?.blur()}get _hasSuggestions(){return this._visibleSuggestions>=0?this._visibleSuggestions>0:Array.from(this.getElementsByTagName("scb-list-item")).some(e=>!e.hasAttribute("hidden")&&e.style.display!=="none")}_onSlotChange(){this._filterSuggestions(this.value),this._ensureListDepsWhenNeeded()}_onInput(e){e.stopPropagation();const s=e.target;this.value=s.value,this._syncFormValue(),this._filterSuggestions(this.value),this._ensureListDepsWhenNeeded(),this._activeIndex=-1,this._kbMode=!1,this._updateComboboxA11y();const t={value:this.value};this.dispatchEvent(new CustomEvent("scb-search-input",{detail:t,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("scbsearchinput",{detail:t,bubbles:!0,composed:!0})),this._dispatchStandardInput()}_onNativeChange(e){e.stopPropagation()}_onFocus(){this.disabled||(this._valueOnFocus=this.value??"",this._inputFocused=!0,this._updateInputRingVisibility(),this._filterSuggestions(this.value),this._ensureListDepsWhenNeeded(),this._updateComboboxA11y(),this.requestUpdate())}_onBlur(){setTimeout(()=>{this._inputFocused=!1,this._activeIndex=-1,this._kbMode=!1,this._updateInputRingVisibility(),this._updateComboboxA11y(),this._hideOptionRing(),this._valueOnFocus!==(this.value??"")&&this._dispatchStandardChangeIfNeeded(),this.requestUpdate()},100)}_updateInputRingVisibility(){const e=this.renderRoot?.querySelector(".ripple-wrapper");e&&(this._inputFocused&&this._kbShouldShowRing?e.setAttribute("data-kb-focus","true"):e.removeAttribute("data-kb-focus"))}_handleKey(e){if(this.disabled||!this._inputEl())return;const s=this._getVisibleItems(),t=(this.value??"").trim().length>0,i=this._inputFocused&&t&&s.length>0,r=e.key,l=e.keyCode,h=r==="ArrowDown"||r==="Down"||l===40,g=r==="ArrowUp"||r==="Up"||l===38,o=r==="Home"||l===36,p=r==="End"||l===35,u=r==="Enter"||l===13,y=r==="Escape"||r==="Esc"||l===27;if(h){if(!i)return;e.preventDefault(),this._kbMode=!0,this._moveActive(s,1);return}if(g){if(!i)return;e.preventDefault(),this._kbMode=!0,this._moveActive(s,-1);return}if(o){if(!i)return;e.preventDefault(),this._kbMode=!0,this._activeIndex=s.length?0:-1,this._updateComboboxA11y(),this._scrollActiveIntoView();return}if(p){if(!i)return;e.preventDefault(),this._kbMode=!0,this._activeIndex=s.length?s.length-1:-1,this._updateComboboxA11y(),this._scrollActiveIntoView();return}if(u){if(!i){const v=this._internals?.form??this._form??this.closest("form");v?(e.preventDefault(),this.reportValidity()&&v.requestSubmit()):this.submit();return}e.preventDefault();const x=this._getActiveItem();if(x){const v=x.getAttribute("label")||"";this.value=v,this._syncFormValue(),this._dispatchStandardInput(),this._dispatchSubmit({value:this.value,active:this._itemPayload(x)}),this._visibleSuggestions=0,this._activeIndex=-1,this._kbMode=!1,this._hideOptionRing(),this.requestUpdate()}else this.submit();return}if(y){e.preventDefault(),this._clearInput();return}}_clearInput(){if(this.disabled)return;this.value="",this._activeIndex=-1,this._kbMode=!1;const e=this._inputEl();e&&(e.value="",e.focus()),this._filterSuggestions(""),this._updateComboboxA11y(),this._hideOptionRing(),this._syncFormValue(),this._dispatchStandardInput(),this.dispatchEvent(new CustomEvent("scb-search-clear",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("scbsearchclear",{bubbles:!0,composed:!0})),this._dispatchStandardChangeIfNeeded()}_filterSuggestions(e){const s=(e??"").trim().toLowerCase(),t=Array.from(this.querySelectorAll("scb-list-item"));let i=0;for(const r of t){const l=`${(r.getAttribute("label")||"").toLowerCase()} ${(r.getAttribute("supporting-text")||"").toLowerCase()}`.trim();s!==""&&l.includes(s)?(r.removeAttribute("hidden"),i++):r.setAttribute("hidden",""),this._ensureOptionA11y(r)}this._visibleSuggestions=i,this._activeIndex>=i&&(this._activeIndex=-1),this._updateComboboxA11y(),this.requestUpdate()}_inputEl(){return this.renderRoot?.querySelector("#searchInput")??null}_listEl(){return this.renderRoot?.querySelector("scb-list.suggestion-list")??null}_ringEl(){return this.renderRoot?.querySelector("#optionRing")??null}_getVisibleItems(){return Array.from(this.querySelectorAll("scb-list-item")).filter(e=>!e.hasAttribute("hidden")&&e.style.display!=="none")}_getActiveItem(){const e=this._getVisibleItems();return this._activeIndex<0||this._activeIndex>=e.length?null:e[this._activeIndex]??null}_moveActive(e,s){if(!e.length){this._activeIndex=-1,this._updateComboboxA11y(),this._hideOptionRing();return}let t=this._activeIndex+s;this._activeIndex===-1?t=s>0?0:e.length-1:(t<0&&(t=0),t>=e.length&&(t=e.length-1)),this._activeIndex=t,this._updateComboboxA11y(),this._scrollActiveIntoView()}_scrollActiveIntoView(){const e=this._getActiveItem(),s=this._listEl();if(!e||!s)return;const t=s.getBoundingClientRect(),i=e.getBoundingClientRect();i.top<t.top?s.scrollTop-=t.top-i.top:i.bottom>t.bottom&&(s.scrollTop+=i.bottom-t.bottom)}_itemPayload(e){return{label:e.getAttribute("label")||"",supportingText:e.getAttribute("supporting-text")||"",href:e.getAttribute("href")||"",type:e.getAttribute("type")||"",id:e.id||""}}_ensureListboxA11y(){const e=this._listEl();e&&(e.id||(e.id=this._listboxId),e.setAttribute("role","listbox"),e.setAttribute("aria-label",this.suggestionsLabel)),Array.from(this.querySelectorAll("scb-list-item")).forEach(s=>this._ensureOptionA11y(s))}_ensureOptionA11y(e){e.id||(e.id=`${this._listboxId}-opt-${Math.random().toString(36).slice(2,8)}`),e.setAttribute("role","option"),e.setAttribute("tabindex","-1")}_updateComboboxA11y(){const e=this._inputEl();if(!e)return;const s=this._getVisibleItems(),t=(this.value??"").trim().length>0,i=this._inputFocused&&t&&s.length>0;e.setAttribute("role","combobox"),e.setAttribute("aria-autocomplete","list"),e.setAttribute("aria-controls",this._listboxId),e.setAttribute("aria-expanded",String(i));const r=i?this._getActiveItem():null;r?.id?e.setAttribute("aria-activedescendant",r.id):e.removeAttribute("aria-activedescendant"),this._kbMode&&r&&i?this._positionOptionRing(r):this._hideOptionRing()}_positionOptionRing(e){const s=this._ringEl(),t=this._listEl();if(!s||!t)return;const i=this.getBoundingClientRect(),r=e.getBoundingClientRect(),l=r.top-i.top,h=r.left-i.left,g=r.width,o=r.height;s.style.top=`${l}px`,s.style.left=`${h}px`,s.style.width=`${g}px`,s.style.height=`${o}px`,s.setAttribute("data-show","true")}_hideOptionRing(){const e=this._ringEl();e&&e.removeAttribute("data-show")}_onWindowResize(){const e=this._getActiveItem();this._kbMode&&e&&this._positionOptionRing(e),this._positionSuggestionPopover()}_syncSuggestionPopover(){const e=this._listEl();if(!e||this.fullScreen){_(e);return}L(e)&&requestAnimationFrame(()=>this._positionSuggestionPopover())}_positionSuggestionPopover(){const e=this._listEl(),s=this._inputEl();if(!e||!s||!R(e))return;const t=s.getBoundingClientRect(),i=8,r=Math.max(0,window.innerWidth-i*2),l=Math.min(t.width,r),h=Math.min(Math.max(t.left,i),window.innerWidth-i-l),g=e.getBoundingClientRect().height||e.scrollHeight,o=window.innerHeight-t.bottom-i,p=t.top-i,u=g>o&&p>o,y=Math.max(0,u?p:o);e.style.position="fixed",e.style.left=`${Math.round(h)}px`,e.style.width=`${Math.round(l)}px`,e.style.right="auto",e.style.maxHeight=`${Math.round(y)}px`,u?(e.style.top="auto",e.style.bottom=`${Math.round(window.innerHeight-t.top)}px`):(e.style.top=`${Math.round(t.bottom)}px`,e.style.bottom="auto")}_attachListScrollListener(){const e=this._listEl();!e||this._listWithHandler===e||(this._detachListScrollListener(),e.addEventListener("scroll",this._listScrollHandler,{passive:!0}),this._listWithHandler=e)}_detachListScrollListener(){this._listWithHandler&&(this._listWithHandler.removeEventListener("scroll",this._listScrollHandler),this._listWithHandler=void 0)}_dispatchStandardInput(){this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0}))}_dispatchStandardChangeIfNeeded(){const e=this.value??"";e!==this._lastChangeValue&&(this._lastChangeValue=e,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))}_dispatchSubmit(e){this.dispatchEvent(new CustomEvent("scb-search-submit",{detail:e,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("scbsearchsubmit",{detail:e,bubbles:!0,composed:!0})),this._dispatchStandardChangeIfNeeded()}mapSpacingToken(e){if(!e)return;const s=String(e).trim();if(s)return/^\d+$/.test(s)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(s,10)))})`:s}applySpacing(){const e=this.mapSpacingToken(this.spacing),s=this.mapSpacingToken(this.spacingTop)??e,t=this.mapSpacingToken(this.spacingBottom)??e,i=this.mapSpacingToken(this.spacingLeft),r=this.mapSpacingToken(this.spacingRight);s?this.style.setProperty("--scb-search-spacing-block-start",s):this.style.removeProperty("--scb-search-spacing-block-start"),t?this.style.setProperty("--scb-search-spacing-block-end",t):this.style.removeProperty("--scb-search-spacing-block-end"),i?this.style.setProperty("--scb-search-spacing-inline-start",i):this.style.removeProperty("--scb-search-spacing-inline-start"),r?this.style.setProperty("--scb-search-spacing-inline-end",r):this.style.removeProperty("--scb-search-spacing-inline-end")}_syncFormValue(){if(!this._internals)return;const e=this.disabled?null:this.value;this._internals.setFormValue(e)}},m.formAssociated=!0,m.styles=S`:host{--scb-fields-text-font-weight-current:var(--scb-fields-text-medium-font-weight, var(--scb-fields-text-medium-weight, var(--scb-fields-text-font-weight, var(--scb-fields-text-weight))));--scb-fields-text-letter-spacing-current:var(--scb-fields-text-medium-letter-spacing, var(--scb-fields-text-medium-tracking, var(--scb-fields-text-letter-spacing, var(--scb-fields-text-tracking))));--scb-fields-text-line-height-current:var(--scb-fields-text-medium-line-height, var(--scb-fields-text-line-height));--scb-fields-text-size-current:var(--scb-fields-text-medium-size, var(--scb-fields-text-size));--scb-fields-text-font-current:var(--scb-fields-text-medium-font, var(--scb-fields-text-font));--scb-fields-label-font-weight-current:var(--scb-fields-label-medium-font-weight, var(--scb-fields-label-medium-weight, var(--scb-fields-label-font-weight, var(--scb-fields-label-weight))));--scb-fields-label-letter-spacing-current:var(--scb-fields-label-medium-letter-spacing, var(--scb-fields-label-medium-tracking, var(--scb-fields-label-letter-spacing, var(--scb-fields-label-tracking))));--scb-fields-label-line-height-current:var(--scb-fields-label-medium-line-height, var(--scb-fields-label-line-height));--scb-fields-label-size-current:var(--scb-fields-label-medium-size, var(--scb-fields-label-size));--scb-fields-label-font-current:var(--scb-fields-label-medium-font, var(--scb-fields-label-font));--scb-fields-supporting-font-weight-current:var(--scb-fields-supporting-medium-font-weight, var(--scb-fields-supporting-medium-weight, var(--scb-fields-supporting-font-weight, var(--scb-fields-supporting-weight))));--scb-fields-supporting-letter-spacing-current:var(--scb-fields-supporting-medium-letter-spacing, var(--scb-fields-supporting-medium-tracking, var(--scb-fields-supporting-letter-spacing, var(--scb-fields-supporting-tracking))));--scb-fields-supporting-line-height-current:var(--scb-fields-supporting-medium-line-height, var(--scb-fields-supporting-line-height));--scb-fields-supporting-size-current:var(--scb-fields-supporting-medium-size, var(--scb-fields-supporting-size));--scb-fields-supporting-font-current:var(--scb-fields-supporting-medium-font, var(--scb-fields-supporting-font));--scb-fields-option-text-font-weight-current:var(--scb-fields-option-text-medium-font-weight, var(--scb-fields-option-text-medium-weight, var(--scb-fields-option-text-font-weight, var(--scb-fields-option-text-weight))));--scb-fields-option-text-letter-spacing-current:var(--scb-fields-option-text-medium-letter-spacing, var(--scb-fields-option-text-medium-tracking, var(--scb-fields-option-text-letter-spacing, var(--scb-fields-option-text-tracking))));--scb-fields-option-text-line-height-current:var(--scb-fields-option-text-medium-line-height, var(--scb-fields-option-text-line-height));--scb-fields-option-text-size-current:var(--scb-fields-option-text-medium-size, var(--scb-fields-option-text-size));--scb-fields-option-text-font-current:var(--scb-fields-option-text-medium-font, var(--scb-fields-option-text-font));display:flex;flex-direction:column;position:relative;color:var(--scb-fields-content-color, var(--md-sys-color-on-surface));--md-focus-ring-color:var(--scb-fields-focus-color, var(--md-sys-color-primary));-webkit-tap-highlight-color:transparent;margin-block-start:var(--scb-search-spacing-block-start, 0);margin-block-end:var(--scb-search-spacing-block-end, 0);margin-inline-start:var(--scb-search-spacing-inline-start, 0);margin-inline-end:var(--scb-search-spacing-inline-end, 0);--scb-search-radius:var(--scb-search-design-surface-radius-medium);--scb-search-open-radius:var(--radius-xl, 24px);--scb-search-height:var(--scb-search-design-height-medium);--scb-search-padding-x:var(--scb-search-design-search-padding-inline-medium);--scb-search-padding-y:var(--scb-search-design-padding-block-medium);--scb-search-leading-size:var(--scb-search-design-search-action-size-medium);--scb-search-trailing-size:var(--scb-search-design-search-action-size-medium);--scb-search-gap:var(--scb-search-design-search-icon-gap);--scb-search-leading-gap:calc(
|
|
54
54
|
var(--scb-search-padding-x) + var(--scb-search-leading-size) + var(--scb-search-gap)
|
|
55
55
|
);--scb-search-trailing-gap:calc(
|
|
56
56
|
var(--scb-search-padding-x) + var(--scb-search-trailing-size) + var(--scb-search-gap)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{h as p,m as v,p as a,v as s,y as g}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import"../../vendor/icon.js";import"../../vendor/ripple.js";import{
|
|
1
|
+
import{h as p,m as v,p as a,v as s,y as g}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import"../../vendor/icon.js";import"../../vendor/ripple.js";import{n as m}from"../../vendor/lazy-focus-ring.js";import{t as n}from"../../vendor/decorate.js";(function(){try{var c=typeof globalThis<"u"?globalThis:window;if(!c.__scb_ce_guard_installed__){c.__scb_ce_guard_installed__=!0;var e=customElements.define.bind(customElements);customElements.define=function(t,i,l){try{customElements.get(t)||e(t,i,l)}catch(o){var d=String(o||"");if(d.indexOf("already been used")===-1&&d.indexOf("NotSupportedError")===-1)throw o}}}}catch{}})();var b,r=(b=class extends p{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",m)}render(){const e=this.isEffectivelyDisabled,t=!!this.icon,i=!!this.label||this.hasDefaultSlotContent,l=this.label?s`${this.label}`:s`<slot></slot>`,d=`segmented-item${t||this.selected?" has-icon":""}${i?"":" no-label"}`,o=s`<md-icon>check</md-icon>`,h=s`<md-icon class="selection-icon-placeholder" aria-hidden="true">check</md-icon>`,u=s`
|
|
2
2
|
<md-ripple ?disabled="${e}"></md-ripple>
|
|
3
3
|
${this.selected?t&&i?o:t?s`${o}<md-icon>${this.icon}</md-icon>`:o:t?s`<md-icon>${this.icon}</md-icon>`:i?h:""}
|
|
4
4
|
${i?s`<span>${l}</span>`:""}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{_ as d,h as m,m as v,p as i,v as s,y as h}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import"../../vendor/ripple.js";import{
|
|
1
|
+
import{_ as d,h as m,m as v,p as i,v as s,y as h}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import"../../vendor/ripple.js";import{n as p}from"../../vendor/lazy-focus-ring.js";import{t}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 r=customElements.define.bind(customElements);customElements.define=function(a,g,b){try{customElements.get(a)||r(a,g,b)}catch(l){var c=String(l||"");if(c.indexOf("already been used")===-1&&c.indexOf("NotSupportedError")===-1)throw l}}}}catch{}})();var n,e=(n=class extends m{constructor(...r){super(...r),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",p)}updated(){this.setAttribute("role","option"),this.setAttribute("aria-selected",this.checked?"true":"false"),this.disabled?this.setAttribute("aria-disabled","true"):this.removeAttribute("aria-disabled")}disconnectedCallback(){this.removeEventListener("focusin",p),super.disconnectedCallback()}render(){return s`
|
|
2
2
|
<div class="item ${this.checked?"checked":""}">
|
|
3
3
|
<md-ripple></md-ripple>
|
|
4
4
|
${this.showCheckbox?s`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as b,f as S,h as I,m as $,p as n,v as u,y as T}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import"../../vendor/icon.js";import{ensureFocusRingOnFocusVisible as q}from"../shared/lazy-focus-ring.js";import{componentSizeToken as F}from"../shared/component-size-token.js";import{t as M}from"../../vendor/component-defaults.js";import{t as r}from"../../vendor/decorate.js";import"../scb-chevron/scb-chevron.js";import"../scb-icon-button/scb-icon-button.js";import{closeManualPopover as k,closeManualPopoverAfterAnimations as P,isManualPopoverOpen as _,openManualPopover as R}from"../shared/manual-popover.js";import"../scb-tooltip/scb-tooltip.js";import"./scb-select-option.js";(function(){try{var x=typeof globalThis<"u"?globalThis:window;if(!x.__scb_ce_guard_installed__){x.__scb_ce_guard_installed__=!0;var e=customElements.define.bind(customElements);customElements.define=function(s,t,i){try{customElements.get(s)||e(s,t,i)}catch(c){var l=String(c||"");if(l.indexOf("already been used")===-1&&l.indexOf("NotSupportedError")===-1)throw c}}}}catch{}})();var y,a=(y=class extends I{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.error=!1,this.open=!1,this.label="",this.name="",this.placeholder="",this.supportingText="",this.errorText="",this.helpText="",this.helpLabel="Visa hjälptext",this.withRadiobuttons=!1,this.noHighlightSelected=!1,this.size=M["scb-select"].size,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._validationMessage="",this._hasValidationBeenReported=!1,this._selectId=`scb-select-${Math.random().toString(36).slice(2,11)}`,this._placementFrame=0,this._optionsPlacement="below",this._activeDescendant="",this._onDocumentClick=e=>{if(!this.open)return;const s=e.composedPath();if(!s.includes(this)){const t=s.find(i=>i instanceof HTMLElement?i.tagName.toLowerCase()==="scb-select":!1);if(t&&t!==this){this._setOpen(!1);return}this._setOpen(!1),requestAnimationFrame(()=>{this.open||this._focusTrigger()})}},this._scheduleOptionsPlacement=()=>{!this.open||!this.isConnected||(this._placementFrame&&cancelAnimationFrame(this._placementFrame),this._placementFrame=requestAnimationFrame(()=>{this._placementFrame=0,this._updateOptionsPlacement()}))},this._onSlotClick=e=>{const s=this._getOptions(),t=e.composedPath(),i=s.find(l=>t.includes(l));i&&(this._selectOption(i),e.stopPropagation())},this._onKeyDown=e=>{if(e.key==="Tab"&&this.open){this._setOpen(!1),this._syncOptionsPopover();return}if(e.key==="Escape"&&this.open){e.preventDefault(),e.stopPropagation(),this._setOpen(!1),this._focusTrigger();return}if(e.key==="ArrowDown"||e.key==="ArrowUp"){e.preventDefault(),e.stopPropagation();const s=e.key==="ArrowDown"?1:-1;if(!this.open){this._setOpen(!0),this.updateComplete.then(()=>{this._setFocusedIndex(this._getInitialFocusedIndex(),{scroll:!1}),this.focusedIndex>=0&&e.key==="ArrowUp"&&this._moveFocusedIndex(-1)});return}this._moveFocusedIndex(s);return}if((e.key==="Home"||e.key==="End")&&this.open){e.preventDefault(),e.stopPropagation();const s=this._getOptions();let t=s.findIndex(i=>!i.disabled);if(e.key==="End"){for(let i=s.length-1;i>=0;i-=1)if(!s[i]?.disabled){t=i;break}}this._setFocusedIndex(t);return}if(e.key==="Enter"||e.key===" "){if(e.preventDefault(),this.open){const s=this._getFocusedOption();s&&this._selectOption(s);return}this._setOpen(!0)}},this._onOptionKeyDown=e=>{if(e.key==="Escape"&&this.open){e.preventDefault(),e.stopPropagation(),this._setOpen(!1),this._focusTrigger();return}if(e.key==="Enter"||e.key===" "){e.preventDefault();const s=this._getOptions(),t=e.composedPath(),i=s.find(l=>t.includes(l));i&&this._selectOption(i)}},"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),document.addEventListener("scroll",this._scheduleOptionsPlacement,!0),window.addEventListener("resize",this._scheduleOptionsPlacement),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.error=!1,this._hasValidationBeenReported=!1,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),document.removeEventListener("scroll",this._scheduleOptionsPlacement,!0),window.removeEventListener("resize",this._scheduleOptionsPlacement),this._placementFrame&&(cancelAnimationFrame(this._placementFrame),this._placementFrame=0),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,k(this.shadowRoot?.querySelector(".options")),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 s=String(e).trim();if(s)return/^\d+$/.test(s)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(s,10)))})`:s}_applySpacing(){const e=this._mapSpacingToken(this.spacing),s=this._mapSpacingToken(this.spacingTop)??e,t=this._mapSpacingToken(this.spacingBottom)??e,i=this._mapSpacingToken(this.spacingLeft),l=this._mapSpacingToken(this.spacingRight);s?this.style.setProperty("--scb-select-spacing-block-start",s):this.style.removeProperty("--scb-select-spacing-block-start"),t?this.style.setProperty("--scb-select-spacing-block-end",t):this.style.removeProperty("--scb-select-spacing-block-end"),i?this.style.setProperty("--scb-select-spacing-inline-start",i):this.style.removeProperty("--scb-select-spacing-inline-start"),l?this.style.setProperty("--scb-select-spacing-inline-end",l):this.style.removeProperty("--scb-select-spacing-inline-end")}_setOpen(e){if(this.open!==e)if(e){const s=this._getInitialFocusedIndex();this._updateOptionsPlacement(),this._prepareOptionsScroll(s),this.focusedIndex=s,this.open=e,this.requestUpdate()}else this.open=e,this.focusedIndex=-1}_toggleOpen(){this.disabled||this._setOpen(!this.open)}_focusTrigger(){this.shadowRoot?.querySelector(".selected-value-container")?.focus({preventScroll:!0})}_getOptions(){const e=this.shadowRoot?.querySelector("slot");return e?e.assignedElements({flatten:!0}).filter(s=>s.tagName.toLowerCase()==="scb-select-option"):[]}_ensureOptionIds(e=this._getOptions()){e.forEach((s,t)=>{s.id||(s.id=`${this._selectId}-option-${t}`)})}_getInitialFocusedIndex(){const e=this._getOptions(),s=this.variant==="multi-select"?this._getMultiValues():[this.value],t=e.findIndex(i=>!i.disabled&&s.includes(i.value));return t>=0?t:e.findIndex(i=>!i.disabled)}_setFocusedIndex(e,s={}){const t=this._getOptions();if(this._ensureOptionIds(t),t.forEach(c=>c.removeAttribute("data-focused")),e<0||t.length===0){this.focusedIndex=-1,this._activeDescendant="";return}let i=Math.max(0,Math.min(e,t.length-1));if(t[i]?.disabled){const c=t.findIndex((o,g)=>g>=i&&!o.disabled);let d=-1;for(let o=t.length-1;o>=0;o-=1)if(!t[o]?.disabled){d=o;break}i=c>=0?c:d}const l=t[i];if(!l||l.disabled){this.focusedIndex=-1,this._activeDescendant="";return}l.setAttribute("data-focused",""),this.focusedIndex=i,this._activeDescendant=l.id,s.scroll!==!1&&this._prepareOptionsScroll(i)}_prepareOptionsScroll(e){const s=this.shadowRoot?.querySelector(".options"),t=this._getOptions()[e];if(!s||!t)return;const i=getComputedStyle(s),l=getComputedStyle(this),c=Number.parseFloat(i.paddingTop)||0,d=Number.parseFloat(i.paddingBottom)||0,o=l.getPropertyValue("--scb-select-options-current-max-height").trim()||l.getPropertyValue("--scb-select-options-max-height").trim()||i.maxHeight,g=Number.parseFloat(o);if(!Number.isFinite(g)||g<=0){s.scrollTop=0;return}const v=s.getBoundingClientRect(),m=t.getBoundingClientRect(),p=m.top-v.top+s.scrollTop,f=p+m.height,h=g,w=Math.max(0,s.scrollHeight-h),O=s.scrollTop+c,V=s.scrollTop+h-d;let z=s.scrollTop;p<O?z=p-c:f>V&&(z=f-h+d),s.scrollTop=Math.max(0,Math.min(w,z))}_moveFocusedIndex(e){const s=this._getOptions();if(s.length===0)return;let t=this.focusedIndex>=0?this.focusedIndex:this._getInitialFocusedIndex();for(let i=0;i<s.length;i+=1)if(t=(t+e+s.length)%s.length,!s[t]?.disabled){this._setFocusedIndex(t);return}}_getFocusedOption(){return this._getOptions()[this.focusedIndex]}_updateOptionsPlacement(){const e=this.shadowRoot?.querySelector(".selected-value-container"),s=this.shadowRoot?.querySelector(".options");if(!e||!s)return;const t=e.getBoundingClientRect(),i=8,l=3,c=Number.parseFloat(getComputedStyle(this).getPropertyValue("--scb-select-options-max-height")),d=Number.isFinite(c)&&c>0?c:240,o=s.scrollHeight,g=Math.min(d,o),v=window.innerHeight-t.bottom-l-i,m=t.top-l-i,p=v<g&&m>v,f=Math.max(0,Math.min(g,p?m:v));if(this._optionsPlacement=p?"above":"below",this.style.setProperty("--scb-select-options-current-max-height",`${f}px`),s.style.overflowY=o>f+.5?"auto":"",_(s)){const h=Math.min(t.width,window.innerWidth-i*2),w=Math.min(Math.max(t.left,i),window.innerWidth-i-h);s.style.position="fixed",s.style.left=`${Math.round(w)}px`,s.style.right="auto",s.style.width=`${Math.round(h)}px`,p?(s.style.top="auto",s.style.bottom=`${Math.round(window.innerHeight-t.top+l)}px`):(s.style.top=`${Math.round(t.bottom+l)}px`,s.style.bottom="auto")}}_syncOptionsPopover(){const e=this.shadowRoot?.querySelector(".options")??null;if(e){if(this.open){R(e)&&this._scheduleOptionsPlacement();return}_(e)?P(e,()=>this._resetOptionsPlacement()):(k(e),this._resetOptionsPlacement())}}_resetOptionsPlacement(){this._optionsPlacement="below",this.style.removeProperty("--scb-select-options-current-max-height");const e=this.shadowRoot?.querySelector(".options");e?.style.removeProperty("position"),e?.style.removeProperty("left"),e?.style.removeProperty("right"),e?.style.removeProperty("top"),e?.style.removeProperty("bottom"),e?.style.removeProperty("width"),e?.style.removeProperty("overflow-y")}_hasMoreThanFourOptions(){const e=this._getOptions();return["extra-small","small","medium"].includes(this.size)?e.length>5:e.length>4}_selectOption(e){if(!e.disabled){if(this.variant==="multi-select"){const s=this._getMultiValues();s.indexOf(e.value)>-1?this.values=s.filter(t=>t!==e.value):this.values=[...s,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.updateComplete.then(()=>this._focusTrigger()));this._updateOptionsChecked(),this.requestUpdate()}}_getOptionLabel(e){return e.label||e.textContent?.trim()||""}_getSelectedLabel(){const e=this._getOptions();if(this.variant==="multi-select"){const s=this._getMultiValues(),t=e.filter(i=>s.includes(i.value));return t&&t.length>0?t.map(i=>this._getOptionLabel(i)).join(", "):""}else{const s=e.find(t=>t.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("errorText")&&this.error&&this._syncValidity(),(e.has("spacing")||e.has("spacingTop")||e.has("spacingBottom")||e.has("spacingLeft")||e.has("spacingRight"))&&this._applySpacing(),e.has("open")&&(this.open?(this._syncOptionsPopover(),this.updateComplete.then(()=>{this._setFocusedIndex(this._getInitialFocusedIndex(),{scroll:!1}),this._scheduleOptionsPlacement()})):(this._syncOptionsPopover(),this._setFocusedIndex(-1)))}_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 s=new FormData;e.forEach(t=>s.append(this.name,t)),this._internals.setFormValue(s);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)?this.errorText||"Välj ett alternativ.":""}_syncValidity(){const e=this.disabled?"":this._getValidationMessage(),s=this.shadowRoot?.querySelector(".selected-value"),t=this.error,i=this._validationMessage;if(this._validationMessage=e,this.error=this.disabled?!1:e?this._hasValidationBeenReported||t:t&&!this._hasValidationBeenReported&&!i,!e)this.removeAttribute("aria-invalid"),s&&s.setCustomValidity(""),this._internals&&this._internals.setValidity({});else if(s&&s.setCustomValidity(e),this._internals){const l=this._customValidationMessage?{customError:!0}:{valueMissing:!0};this._internals.setValidity(l,e,s??void 0)}this.toggleAttribute("aria-invalid",this.error),(t!==this.error||i!==this._validationMessage)&&this.requestUpdate()}checkValidity(){return this._syncValidity(),this._internals?this._internals.checkValidity():!this.error}reportValidity(){return this._hasValidationBeenReported=!0,this._syncValidity(),this._internals?this._internals.reportValidity():this.checkValidity()}setCustomValidity(e){this._customValidationMessage=String(e??""),this._syncValidity()}get form(){return this._internals?.form??this._form}get validity(){return this._internals?.validity}get validationMessage(){return this._internals?.validationMessage??this._getValidationMessage()}get willValidate(){return this._internals?.willValidate??!0}get labels(){return this._internals?.labels}_updateOptionsChecked(){const e=this._getOptions();this._ensureOptionIds(e),e.forEach(s=>{if(this.noHighlightSelected?s.setAttribute("no-highlight-selected",""):s.removeAttribute("no-highlight-selected"),this.variant==="multi-select"){const t=this._getMultiValues();s.showCheckbox=!0,s.checked=t.includes(s.value),s.showRadio=!1}else s.showCheckbox=!1,s.checked=this.value===s.value,this.withRadiobuttons&&(s.showRadio=!0)})}_renderLabel(){if(!this.label)return null;const e=!!this._getVisibleSupportingText(),s=`${this._selectId}-label`,t=u`
|
|
1
|
+
import{a as b,f as S,h as I,m as $,p as n,v as u,y as T}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import"../../vendor/icon.js";import{n as q}from"../../vendor/lazy-focus-ring.js";import{t as F}from"../../vendor/component-size-token.js";import{t as M}from"../../vendor/component-defaults.js";import{t as r}from"../../vendor/decorate.js";import"../../vendor/scb-chevron.js";import"../scb-icon-button/scb-icon-button.js";import{a as P,i as k,n as R,t as _}from"../../vendor/manual-popover.js";import"../scb-tooltip/scb-tooltip.js";import"./scb-select-option.js";(function(){try{var x=typeof globalThis<"u"?globalThis:window;if(!x.__scb_ce_guard_installed__){x.__scb_ce_guard_installed__=!0;var e=customElements.define.bind(customElements);customElements.define=function(s,t,i){try{customElements.get(s)||e(s,t,i)}catch(c){var l=String(c||"");if(l.indexOf("already been used")===-1&&l.indexOf("NotSupportedError")===-1)throw c}}}}catch{}})();var y,a=(y=class extends I{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.error=!1,this.open=!1,this.label="",this.name="",this.placeholder="",this.supportingText="",this.errorText="",this.helpText="",this.helpLabel="Visa hjälptext",this.withRadiobuttons=!1,this.noHighlightSelected=!1,this.size=M["scb-select"].size,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._validationMessage="",this._hasValidationBeenReported=!1,this._selectId=`scb-select-${Math.random().toString(36).slice(2,11)}`,this._placementFrame=0,this._optionsPlacement="below",this._activeDescendant="",this._onDocumentClick=e=>{if(!this.open)return;const s=e.composedPath();if(!s.includes(this)){const t=s.find(i=>i instanceof HTMLElement?i.tagName.toLowerCase()==="scb-select":!1);if(t&&t!==this){this._setOpen(!1);return}this._setOpen(!1),requestAnimationFrame(()=>{this.open||this._focusTrigger()})}},this._scheduleOptionsPlacement=()=>{!this.open||!this.isConnected||(this._placementFrame&&cancelAnimationFrame(this._placementFrame),this._placementFrame=requestAnimationFrame(()=>{this._placementFrame=0,this._updateOptionsPlacement()}))},this._onSlotClick=e=>{const s=this._getOptions(),t=e.composedPath(),i=s.find(l=>t.includes(l));i&&(this._selectOption(i),e.stopPropagation())},this._onKeyDown=e=>{if(e.key==="Tab"&&this.open){this._setOpen(!1),this._syncOptionsPopover();return}if(e.key==="Escape"&&this.open){e.preventDefault(),e.stopPropagation(),this._setOpen(!1),this._focusTrigger();return}if(e.key==="ArrowDown"||e.key==="ArrowUp"){e.preventDefault(),e.stopPropagation();const s=e.key==="ArrowDown"?1:-1;if(!this.open){this._setOpen(!0),this.updateComplete.then(()=>{this._setFocusedIndex(this._getInitialFocusedIndex(),{scroll:!1}),this.focusedIndex>=0&&e.key==="ArrowUp"&&this._moveFocusedIndex(-1)});return}this._moveFocusedIndex(s);return}if((e.key==="Home"||e.key==="End")&&this.open){e.preventDefault(),e.stopPropagation();const s=this._getOptions();let t=s.findIndex(i=>!i.disabled);if(e.key==="End"){for(let i=s.length-1;i>=0;i-=1)if(!s[i]?.disabled){t=i;break}}this._setFocusedIndex(t);return}if(e.key==="Enter"||e.key===" "){if(e.preventDefault(),this.open){const s=this._getFocusedOption();s&&this._selectOption(s);return}this._setOpen(!0)}},this._onOptionKeyDown=e=>{if(e.key==="Escape"&&this.open){e.preventDefault(),e.stopPropagation(),this._setOpen(!1),this._focusTrigger();return}if(e.key==="Enter"||e.key===" "){e.preventDefault();const s=this._getOptions(),t=e.composedPath(),i=s.find(l=>t.includes(l));i&&this._selectOption(i)}},"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),document.addEventListener("scroll",this._scheduleOptionsPlacement,!0),window.addEventListener("resize",this._scheduleOptionsPlacement),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.error=!1,this._hasValidationBeenReported=!1,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),document.removeEventListener("scroll",this._scheduleOptionsPlacement,!0),window.removeEventListener("resize",this._scheduleOptionsPlacement),this._placementFrame&&(cancelAnimationFrame(this._placementFrame),this._placementFrame=0),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,_(this.shadowRoot?.querySelector(".options")),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 s=String(e).trim();if(s)return/^\d+$/.test(s)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(s,10)))})`:s}_applySpacing(){const e=this._mapSpacingToken(this.spacing),s=this._mapSpacingToken(this.spacingTop)??e,t=this._mapSpacingToken(this.spacingBottom)??e,i=this._mapSpacingToken(this.spacingLeft),l=this._mapSpacingToken(this.spacingRight);s?this.style.setProperty("--scb-select-spacing-block-start",s):this.style.removeProperty("--scb-select-spacing-block-start"),t?this.style.setProperty("--scb-select-spacing-block-end",t):this.style.removeProperty("--scb-select-spacing-block-end"),i?this.style.setProperty("--scb-select-spacing-inline-start",i):this.style.removeProperty("--scb-select-spacing-inline-start"),l?this.style.setProperty("--scb-select-spacing-inline-end",l):this.style.removeProperty("--scb-select-spacing-inline-end")}_setOpen(e){if(this.open!==e)if(e){const s=this._getInitialFocusedIndex();this._updateOptionsPlacement(),this._prepareOptionsScroll(s),this.focusedIndex=s,this.open=e,this.requestUpdate()}else this.open=e,this.focusedIndex=-1}_toggleOpen(){this.disabled||this._setOpen(!this.open)}_focusTrigger(){this.shadowRoot?.querySelector(".selected-value-container")?.focus({preventScroll:!0})}_getOptions(){const e=this.shadowRoot?.querySelector("slot");return e?e.assignedElements({flatten:!0}).filter(s=>s.tagName.toLowerCase()==="scb-select-option"):[]}_ensureOptionIds(e=this._getOptions()){e.forEach((s,t)=>{s.id||(s.id=`${this._selectId}-option-${t}`)})}_getInitialFocusedIndex(){const e=this._getOptions(),s=this.variant==="multi-select"?this._getMultiValues():[this.value],t=e.findIndex(i=>!i.disabled&&s.includes(i.value));return t>=0?t:e.findIndex(i=>!i.disabled)}_setFocusedIndex(e,s={}){const t=this._getOptions();if(this._ensureOptionIds(t),t.forEach(c=>c.removeAttribute("data-focused")),e<0||t.length===0){this.focusedIndex=-1,this._activeDescendant="";return}let i=Math.max(0,Math.min(e,t.length-1));if(t[i]?.disabled){const c=t.findIndex((o,g)=>g>=i&&!o.disabled);let d=-1;for(let o=t.length-1;o>=0;o-=1)if(!t[o]?.disabled){d=o;break}i=c>=0?c:d}const l=t[i];if(!l||l.disabled){this.focusedIndex=-1,this._activeDescendant="";return}l.setAttribute("data-focused",""),this.focusedIndex=i,this._activeDescendant=l.id,s.scroll!==!1&&this._prepareOptionsScroll(i)}_prepareOptionsScroll(e){const s=this.shadowRoot?.querySelector(".options"),t=this._getOptions()[e];if(!s||!t)return;const i=getComputedStyle(s),l=getComputedStyle(this),c=Number.parseFloat(i.paddingTop)||0,d=Number.parseFloat(i.paddingBottom)||0,o=l.getPropertyValue("--scb-select-options-current-max-height").trim()||l.getPropertyValue("--scb-select-options-max-height").trim()||i.maxHeight,g=Number.parseFloat(o);if(!Number.isFinite(g)||g<=0){s.scrollTop=0;return}const v=s.getBoundingClientRect(),m=t.getBoundingClientRect(),p=m.top-v.top+s.scrollTop,f=p+m.height,h=g,w=Math.max(0,s.scrollHeight-h),O=s.scrollTop+c,V=s.scrollTop+h-d;let z=s.scrollTop;p<O?z=p-c:f>V&&(z=f-h+d),s.scrollTop=Math.max(0,Math.min(w,z))}_moveFocusedIndex(e){const s=this._getOptions();if(s.length===0)return;let t=this.focusedIndex>=0?this.focusedIndex:this._getInitialFocusedIndex();for(let i=0;i<s.length;i+=1)if(t=(t+e+s.length)%s.length,!s[t]?.disabled){this._setFocusedIndex(t);return}}_getFocusedOption(){return this._getOptions()[this.focusedIndex]}_updateOptionsPlacement(){const e=this.shadowRoot?.querySelector(".selected-value-container"),s=this.shadowRoot?.querySelector(".options");if(!e||!s)return;const t=e.getBoundingClientRect(),i=8,l=3,c=Number.parseFloat(getComputedStyle(this).getPropertyValue("--scb-select-options-max-height")),d=Number.isFinite(c)&&c>0?c:240,o=s.scrollHeight,g=Math.min(d,o),v=window.innerHeight-t.bottom-l-i,m=t.top-l-i,p=v<g&&m>v,f=Math.max(0,Math.min(g,p?m:v));if(this._optionsPlacement=p?"above":"below",this.style.setProperty("--scb-select-options-current-max-height",`${f}px`),s.style.overflowY=o>f+.5?"auto":"",k(s)){const h=Math.min(t.width,window.innerWidth-i*2),w=Math.min(Math.max(t.left,i),window.innerWidth-i-h);s.style.position="fixed",s.style.left=`${Math.round(w)}px`,s.style.right="auto",s.style.width=`${Math.round(h)}px`,p?(s.style.top="auto",s.style.bottom=`${Math.round(window.innerHeight-t.top+l)}px`):(s.style.top=`${Math.round(t.bottom+l)}px`,s.style.bottom="auto")}}_syncOptionsPopover(){const e=this.shadowRoot?.querySelector(".options")??null;if(e){if(this.open){P(e)&&this._scheduleOptionsPlacement();return}k(e)?R(e,()=>this._resetOptionsPlacement()):(_(e),this._resetOptionsPlacement())}}_resetOptionsPlacement(){this._optionsPlacement="below",this.style.removeProperty("--scb-select-options-current-max-height");const e=this.shadowRoot?.querySelector(".options");e?.style.removeProperty("position"),e?.style.removeProperty("left"),e?.style.removeProperty("right"),e?.style.removeProperty("top"),e?.style.removeProperty("bottom"),e?.style.removeProperty("width"),e?.style.removeProperty("overflow-y")}_hasMoreThanFourOptions(){const e=this._getOptions();return["extra-small","small","medium"].includes(this.size)?e.length>5:e.length>4}_selectOption(e){if(!e.disabled){if(this.variant==="multi-select"){const s=this._getMultiValues();s.indexOf(e.value)>-1?this.values=s.filter(t=>t!==e.value):this.values=[...s,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.updateComplete.then(()=>this._focusTrigger()));this._updateOptionsChecked(),this.requestUpdate()}}_getOptionLabel(e){return e.label||e.textContent?.trim()||""}_getSelectedLabel(){const e=this._getOptions();if(this.variant==="multi-select"){const s=this._getMultiValues(),t=e.filter(i=>s.includes(i.value));return t&&t.length>0?t.map(i=>this._getOptionLabel(i)).join(", "):""}else{const s=e.find(t=>t.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("errorText")&&this.error&&this._syncValidity(),(e.has("spacing")||e.has("spacingTop")||e.has("spacingBottom")||e.has("spacingLeft")||e.has("spacingRight"))&&this._applySpacing(),e.has("open")&&(this.open?(this._syncOptionsPopover(),this.updateComplete.then(()=>{this._setFocusedIndex(this._getInitialFocusedIndex(),{scroll:!1}),this._scheduleOptionsPlacement()})):(this._syncOptionsPopover(),this._setFocusedIndex(-1)))}_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 s=new FormData;e.forEach(t=>s.append(this.name,t)),this._internals.setFormValue(s);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)?this.errorText||"Välj ett alternativ.":""}_syncValidity(){const e=this.disabled?"":this._getValidationMessage(),s=this.shadowRoot?.querySelector(".selected-value"),t=this.error,i=this._validationMessage;if(this._validationMessage=e,this.error=this.disabled?!1:e?this._hasValidationBeenReported||t:t&&!this._hasValidationBeenReported&&!i,!e)this.removeAttribute("aria-invalid"),s&&s.setCustomValidity(""),this._internals&&this._internals.setValidity({});else if(s&&s.setCustomValidity(e),this._internals){const l=this._customValidationMessage?{customError:!0}:{valueMissing:!0};this._internals.setValidity(l,e,s??void 0)}this.toggleAttribute("aria-invalid",this.error),(t!==this.error||i!==this._validationMessage)&&this.requestUpdate()}checkValidity(){return this._syncValidity(),this._internals?this._internals.checkValidity():!this.error}reportValidity(){return this._hasValidationBeenReported=!0,this._syncValidity(),this._internals?this._internals.reportValidity():this.checkValidity()}setCustomValidity(e){this._customValidationMessage=String(e??""),this._syncValidity()}get form(){return this._internals?.form??this._form}get validity(){return this._internals?.validity}get validationMessage(){return this._internals?.validationMessage??this._getValidationMessage()}get willValidate(){return this._internals?.willValidate??!0}get labels(){return this._internals?.labels}_updateOptionsChecked(){const e=this._getOptions();this._ensureOptionIds(e),e.forEach(s=>{if(this.noHighlightSelected?s.setAttribute("no-highlight-selected",""):s.removeAttribute("no-highlight-selected"),this.variant==="multi-select"){const t=this._getMultiValues();s.showCheckbox=!0,s.checked=t.includes(s.value),s.showRadio=!1}else s.showCheckbox=!1,s.checked=this.value===s.value,this.withRadiobuttons&&(s.showRadio=!0)})}_renderLabel(){if(!this.label)return null;const e=!!this._getVisibleSupportingText(),s=`${this._selectId}-label`,t=u`
|
|
2
2
|
<label
|
|
3
3
|
class="select-label ${!e&&!this.helpText?"select-label--without-supporting":""}"
|
|
4
4
|
id=${s}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{h as u,m as v,p as i,v as o,y as g}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import{
|
|
1
|
+
import{h as u,m as v,p as i,v as o,y as g}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import{t as b}from"../../vendor/component-size-token.js";import{t}from"../../vendor/decorate.js";import"../scb-button/scb-button.js";import"../scb-icon-button/scb-icon-button.js";import{a as h,i as k,n as f,t as p}from"../../vendor/manual-popover.js";(function(){try{var d=typeof globalThis<"u"?globalThis:window;if(!d.__scb_ce_guard_installed__){d.__scb_ce_guard_installed__=!0;var s=customElements.define.bind(customElements);customElements.define=function(a,n,r){try{customElements.get(a)||s(a,n,r)}catch(m){var c=String(m||"");if(c.indexOf("already been used")===-1&&c.indexOf("NotSupportedError")===-1)throw m}}}}catch{}})();var l,e=(l=class extends u{constructor(...s){super(...s),this.message="",this.open=!1,this.actionText="",this.showClose=!1,this.closeLabel="Stäng meddelande",this.fixed=!1,this.fadeout=!1,this.withLongerAction=!1,this.spacing=void 0,this.spacingTop=void 0,this.spacingBottom=void 0,this.spacingLeft=void 0,this.spacingRight=void 0}mapSpacingToken(s){if(!s)return;const a=String(s).trim();if(a)return/^\d+$/.test(a)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(a,10)))})`:a}applySpacing(){const s=this.mapSpacingToken(this.spacing),a=this.mapSpacingToken(this.spacingTop)??s,n=this.mapSpacingToken(this.spacingBottom)??s,r=this.mapSpacingToken(this.spacingLeft),c=this.mapSpacingToken(this.spacingRight);a?this.style.setProperty("--scb-snackbar-spacing-block-start",a):this.style.removeProperty("--scb-snackbar-spacing-block-start"),n?this.style.setProperty("--scb-snackbar-spacing-block-end",n):this.style.removeProperty("--scb-snackbar-spacing-block-end"),r?this.style.setProperty("--scb-snackbar-spacing-inline-start",r):this.style.removeProperty("--scb-snackbar-spacing-inline-start"),c?this.style.setProperty("--scb-snackbar-spacing-inline-end",c):this.style.removeProperty("--scb-snackbar-spacing-inline-end")}connectedCallback(){super.connectedCallback(),this.applySpacing()}disconnectedCallback(){window.clearTimeout(this._fadeoutTimer),p(this.renderRoot.querySelector(".snackbar")),super.disconnectedCallback()}handleAction(){this.dispatchEvent(new CustomEvent("snackbar-action",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("snackbaraction",{bubbles:!0,composed:!0})),this.open=!1}handleClose(){this.open=!1}updated(s){if(super.updated(s),s.has("open")||s.has("fixed")){const a=this.renderRoot.querySelector(".snackbar");this.open&&this.fixed?h(a):!this.open&&k(a)?f(a):p(a)}s.has("open")&&(this.open?(this.dispatchEvent(new CustomEvent("snackbar-open",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("snackbaropen",{bubbles:!0,composed:!0}))):(this.dispatchEvent(new CustomEvent("snackbar-close",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("snackbarclose",{bubbles:!0,composed:!0})))),(s.has("open")||s.has("fadeout"))&&(this.open&&this.fadeout?(window.clearTimeout(this._fadeoutTimer),this._fadeoutTimer=window.setTimeout(()=>{this.open=!1},5e3)):window.clearTimeout(this._fadeoutTimer)),(s.has("spacing")||s.has("spacingTop")||s.has("spacingBottom")||s.has("spacingLeft")||s.has("spacingRight"))&&this.applySpacing()}render(){const s=!!this.actionText,a=!!this.showClose;let n="snackbar";return!s&&!a&&(n+=" no-actions"),this.withLongerAction&&(n+=" longer-action"),o`
|
|
2
2
|
<div class="${n}" ?hidden=${!this.open}>
|
|
3
3
|
${this.withLongerAction?o`
|
|
4
4
|
<div
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{h as m,m as d,p as r,v as i,y as g}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 d,p as r,v as i,y as g}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import"../../vendor/icon.js";import"../../vendor/ripple.js";import{r as v}from"../../vendor/lazy-focus-ring.js";import{t as a}from"../../vendor/decorate.js";(function(){try{var b=typeof globalThis<"u"?globalThis:window;if(!b.__scb_ce_guard_installed__){b.__scb_ce_guard_installed__=!0;var e=customElements.define.bind(customElements);customElements.define=function(t,l,p){try{customElements.get(t)||e(t,l,p)}catch(o){var n=String(o||"");if(n.indexOf("already been used")===-1&&n.indexOf("NotSupportedError")===-1)throw o}}}}catch{}})();var c,s=(c=class extends m{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="",this.__nativeFocusRingReady=!1,this.__nativeFocusRingPending=!1,this.__onFocusIn=t=>{const l=t.composedPath()[0];l instanceof HTMLElement&&l.matches(":focus-visible")&&this.__ensureNativeFocusRing()},this.__onFocusOut=()=>{this.__syncInteractiveParts()}}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"),this.__syncInteractiveParts()}__getControl(){return this.renderRoot.querySelector(".scb-step-content")}__syncInteractiveParts(){const e=this.__getControl(),t=this.renderRoot.querySelector(".symbol-target"),l=this.renderRoot.querySelector("md-focus-ring"),p=this.renderRoot.querySelector("md-ripple");l&&e&&(l.control=e,l.visible=e.matches(":focus-visible")),p&&t&&(p.control=t)}__ensureNativeFocusRing(){this.__nativeFocusRingReady||this.__nativeFocusRingPending||(this.__nativeFocusRingPending=!0,v(),customElements.whenDefined("md-focus-ring").then(()=>{this.__nativeFocusRingPending=!1,this.__nativeFocusRingReady=!0,this.toggleAttribute("data-native-focus-ring-ready",!0),this.requestUpdate(),this.updateComplete.then(()=>this.__syncInteractiveParts())}))}handleKeyDown(e){e.key==="Enter"||e.key===" "?(e.preventDefault(),this.dispatchEvent(new MouseEvent("click",{bubbles:!0,composed:!0}))):["ArrowRight","ArrowLeft","ArrowDown","ArrowUp","Home","End"].includes(e.key)&&(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,t=this.label?`${this.label}${this.subLabel?": "+this.subLabel:""}`:`Steg ${this.number||""}`.trim();switch(this.symbolVariant){case"icon":return i`
|
|
2
2
|
<div
|
|
3
3
|
class="scb-step-content"
|
|
4
4
|
tabindex="0"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{h as _,m as x,p as f,v as w,y as C}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import{
|
|
1
|
+
import{h as _,m as x,p as f,v as w,y as C}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import{t as y}from"../../vendor/component-size-token.js";import{t as g}from"../../vendor/decorate.js";import"../scb-icon-button/scb-icon-button.js";(function(){try{var m=typeof globalThis<"u"?globalThis:window;if(!m.__scb_ce_guard_installed__){m.__scb_ce_guard_installed__=!0;var e=customElements.define.bind(customElements);customElements.define=function(s,r,t){try{customElements.get(s)||e(s,r,t)}catch(o){var l=String(o||"");if(l.indexOf("already been used")===-1&&l.indexOf("NotSupportedError")===-1)throw o}}}}catch{}})();var p,S=96,A=32,h=(p=class extends _{constructor(...e){super(...e),this.dataSorting=!1,this.columnWidthMode="auto",this._sortedColumn=null,this._sortDirection="asc",this._columnWidthFrame=null,this._onSlotChange=()=>{this._attachThListeners()}}render(){return w`
|
|
2
2
|
<div class="scb-table-scroll-wrapper">
|
|
3
3
|
<slot @slotchange=${this._onSlotChange}></slot>
|
|
4
4
|
</div>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{h as y,m as _,p as g,v as m,y as w}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import{
|
|
1
|
+
import{h as y,m as _,p as g,v as m,y as w}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import{t as v}from"../../vendor/component-size-token.js";import{t as u}from"../../vendor/decorate.js";import"../scb-icon-button/scb-icon-button.js";import"../scb-search/scb-search.js";import"../scb-pagination/scb-pagination.js";(function(){try{var p=typeof globalThis<"u"?globalThis:window;if(!p.__scb_ce_guard_installed__){p.__scb_ce_guard_installed__=!0;var e=customElements.define.bind(customElements);customElements.define=function(a,s,r){try{customElements.get(a)||e(a,s,r)}catch(n){var l=String(n||"");if(l.indexOf("already been used")===-1&&l.indexOf("NotSupportedError")===-1)throw n}}}}catch{}})();var f,h=(f=class extends y{constructor(...e){super(...e),this.searchTerm="",this.pagination=!1,this.filteringSearch=!1,this.noScroll=!1,this.pageSize=10,this.disableSorting=[],this.currentPage=1,this.totalRows=0,this._sortedColumn=null,this._sortDirection="asc",this._filteredRows=null,this._tbodyObserver=null,this._observedTbody=null,this._pendingTableRefresh=!1,this._suppressTbodyObserver=!1,this._initialTableRefreshFrame=0,this._onSlotChange=()=>{this._attachTbodyObserver(),this._refreshFromTableContent()},this._onPaginationChange=a=>{const s=a.detail;s&&typeof s.page=="number"&&this._changePage(s.page)}}disconnectedCallback(){super.disconnectedCallback(),cancelAnimationFrame(this._initialTableRefreshFrame),this._disconnectTbodyObserver()}attributeChangedCallback(e,a,s){if(super.attributeChangedCallback(e,a,s),a!==s){if(e==="searchterm"){queueMicrotask(()=>{this.isConnected&&this._filterTable()});return}if(e==="currentpage"){queueMicrotask(()=>{this.isConnected&&this._paginateTable()});return}(e==="page-size"||e==="with-filtering-search"||e==="with-pagination")&&this._scheduleTableRefresh()}}render(){const e=Math.ceil(this.totalRows/this.pageSize);return m`
|
|
2
2
|
${this.filteringSearch?m`
|
|
3
3
|
<div class="filtering-search">
|
|
4
4
|
<scb-search
|