scb-wc-test 0.1.297 → 0.1.299

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,23 +1,24 @@
1
- import{a as R,n as h,i as I,E as m,x as v,t as A}from"../../vendor/vendor.js";import"../../vendor/vendor-material.js";import"./scb-checkbox-group.js";(function(){try{var e=typeof globalThis<"u"?globalThis:window;if(!e.__scb_ce_guard_installed__){e.__scb_ce_guard_installed__=!0;var s=customElements.define.bind(customElements);customElements.define=function(t,r,i){try{customElements.get(t)||s(t,r,i)}catch(d){var o=String(d||"");if(o.indexOf("already been used")===-1&&o.indexOf("NotSupportedError")===-1)throw d}}}}catch{}})();var z=Object.defineProperty,F=Object.getOwnPropertyDescriptor,S=e=>{throw TypeError(e)},n=(e,s,t,r)=>{for(var i=r>1?void 0:r?F(s,t):s,o=e.length-1,d;o>=0;o--)(d=e[o])&&(i=(r?d(s,t,i):d(i))||i);return r&&i&&z(s,t,i),i},$=(e,s,t)=>s.has(e)||S("Cannot "+t),b=(e,s,t)=>($(e,s,"read from private field"),t?t.call(e):s.get(e)),y=(e,s,t)=>s.has(e)?S("Cannot add the same private member more than once"):s instanceof WeakSet?s.add(e):s.set(e,t),l=(e,s,t)=>($(e,s,"access private method"),t),c,u,w,x,k,_,L,p;let E=!1,f=0;const C=e=>{e.metaKey||e.altKey||e.ctrlKey||(E=!0)},g=()=>{E=!1},P=()=>{f===0&&(window.addEventListener("keydown",C,!0),window.addEventListener("pointerdown",g,!0),window.addEventListener("mousedown",g,!0),window.addEventListener("touchstart",g,!0)),f+=1},T=()=>{f=Math.max(0,f-1),f===0&&(window.removeEventListener("keydown",C,!0),window.removeEventListener("pointerdown",g,!0),window.removeEventListener("mousedown",g,!0),window.removeEventListener("touchstart",g,!0))};let a=class extends I{constructor(){super(),y(this,c),this._internals=null,this.disabled=!1,this.indeterminate=!1,this.checked=!1,this.size="medium",this.label="",this.supportingText="",this.ariaLabel="",this.name="",this.value="on",this.spacing=void 0,this.spacingTop=void 0,this.spacingBottom=void 0,this.spacingLeft=void 0,this.spacingRight=void 0,this._form=null,this._formResetHandler=null,this._initialChecked=!1,this._checkboxId="",this._showOuterFocusRing=!1,y(this,x,()=>{this.disabled||!this.label?.trim()||E&&l(this,c,u).call(this,!0)}),y(this,k,()=>{l(this,c,u).call(this,!1)}),y(this,_,()=>{l(this,c,u).call(this,!1)}),"attachInternals"in this&&(this._internals=this.attachInternals())}connectedCallback(){super.connectedCallback(),P(),this._checkboxId=this.id||`scb-checkbox-${Math.random().toString(36).slice(2,11)}`,this._initialChecked=this.checked,l(this,c,w).call(this),this.addEventListener("focusin",b(this,x)),this.addEventListener("focusout",b(this,k)),this.addEventListener("pointerdown",b(this,_),!0),this._form=this.closest("form"),this._form&&(this._formResetHandler=()=>{this.checked=this._initialChecked,this.indeterminate=!1,this.__syncFormValue()},this._form.addEventListener("reset",this._formResetHandler,!0)),this.__syncFormValue()}disconnectedCallback(){super.disconnectedCallback(),T(),this.removeEventListener("focusin",b(this,x)),this.removeEventListener("focusout",b(this,k)),this.removeEventListener("pointerdown",b(this,_),!0),this._form&&this._formResetHandler&&this._form.removeEventListener("reset",this._formResetHandler,!0)}firstUpdated(){const e=this.shadowRoot?.querySelector("md-checkbox");e&&e.addEventListener("change",()=>{const t=e,r=!!t.checked,i=!!t.indeterminate;this.checked=r,this.indeterminate=i,this.dispatchEvent(new CustomEvent("change",{detail:{checked:r,indeterminate:i},bubbles:!0,composed:!0}))}),this.shadowRoot?.querySelector("label.wrap")?.addEventListener("click",t=>{if(this.disabled)return;if(!t.composedPath().some(o=>{const d=o;return d?.tagName?.toLowerCase?.()==="md-checkbox"||d?.classList?.contains("box-wrap")})){t.preventDefault();const o=this.shadowRoot.querySelector("md-checkbox");o&&(o.checked=!o.checked,o.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))}}),this.__syncInnerAria(),l(this,c,L).call(this)}updated(e){super.updated(e),e.has("disabled")&&(this.toggleAttribute("aria-disabled",this.disabled),this.disabled&&l(this,c,u).call(this,!1)),(e.has("label")||e.has("supportingText")||e.has("ariaLabel"))&&this.__syncInnerAria(),e.has("label")&&l(this,c,w).call(this),(e.has("checked")||e.has("disabled")||e.has("value"))&&this.__syncFormValue(),(e.has("spacing")||e.has("spacingTop")||e.has("spacingBottom")||e.has("spacingLeft")||e.has("spacingRight"))&&l(this,c,L).call(this)}formDisabledCallback(e){this.disabled=e}__syncInnerAria(){const s=this.shadowRoot?.querySelector("md-checkbox")?.shadowRoot;if(!s)return;const t=s.querySelector('[role="checkbox"]')||s.querySelector('input[type="checkbox"]');if(!t)return;const r=!!this.label?.trim(),i=r?`${this._checkboxId}-label`:"",o=this.supportingText?`${this._checkboxId}-supporting-text`:"";r&&i?(t.setAttribute("aria-labelledby",i),t.removeAttribute("aria-label")):(t.removeAttribute("aria-labelledby"),this.ariaLabel?.trim()?t.setAttribute("aria-label",this.ariaLabel.trim()):t.removeAttribute("aria-label")),o?t.setAttribute("aria-describedby",o):t.removeAttribute("aria-describedby")}__syncFormValue(){if(!this._internals)return;const e=this.disabled||!this.checked?null:this.value;this._internals.setFormValue(e)}render(){const e=this.supportingText?`${this._checkboxId}-supporting-text`:void 0,s=!!this.label?.trim(),t=s?m:this.ariaLabel||m;return v`
1
+ import{a as C,n as l,i as M,E as m,x as y,t as R}from"../../vendor/vendor.js";import"../../vendor/vendor-material.js";import"./scb-checkbox-group.js";(function(){try{var e=typeof globalThis<"u"?globalThis:window;if(!e.__scb_ce_guard_installed__){e.__scb_ce_guard_installed__=!0;var t=customElements.define.bind(customElements);customElements.define=function(s,r,i){try{customElements.get(s)||t(s,r,i)}catch(d){var o=String(d||"");if(o.indexOf("already been used")===-1&&o.indexOf("NotSupportedError")===-1)throw d}}}}catch{}})();var I=Object.defineProperty,A=Object.getOwnPropertyDescriptor,E=e=>{throw TypeError(e)},c=(e,t,s,r)=>{for(var i=r>1?void 0:r?A(t,s):t,o=e.length-1,d;o>=0;o--)(d=e[o])&&(i=(r?d(t,s,i):d(i))||i);return r&&i&&I(t,s,i),i},S=(e,t,s)=>t.has(e)||E("Cannot "+s),b=(e,t,s)=>(S(e,t,"read from private field"),s?s.call(e):t.get(e)),v=(e,t,s)=>t.has(e)?E("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,s),h=(e,t,s)=>(S(e,t,"access private method"),s),n,u,w,x,k,_,L,p;let V=!1,f=0;const $=e=>{e.metaKey||e.altKey||e.ctrlKey||(V=!0)},g=()=>{V=!1},z=()=>{f===0&&(window.addEventListener("keydown",$,!0),window.addEventListener("pointerdown",g,!0),window.addEventListener("mousedown",g,!0),window.addEventListener("touchstart",g,!0)),f+=1},F=()=>{f=Math.max(0,f-1),f===0&&(window.removeEventListener("keydown",$,!0),window.removeEventListener("pointerdown",g,!0),window.removeEventListener("mousedown",g,!0),window.removeEventListener("touchstart",g,!0))};let a=class extends M{constructor(){super(),v(this,n),this._internals=null,this.disabled=!1,this.indeterminate=!1,this.checked=!1,this.required=!1,this.size="medium",this.label="",this.supportingText="",this.ariaLabel="",this.name="",this.value="on",this.spacing=void 0,this.spacingTop=void 0,this.spacingBottom=void 0,this.spacingLeft=void 0,this.spacingRight=void 0,this._form=null,this._formResetHandler=null,this._initialChecked=!1,this._customValidationMessage="",this._checkboxId="",this._showOuterFocusRing=!1,v(this,x,()=>{this.disabled||!this.label?.trim()||V&&h(this,n,u).call(this,!0)}),v(this,k,()=>{h(this,n,u).call(this,!1)}),v(this,_,()=>{h(this,n,u).call(this,!1)}),"attachInternals"in this&&(this._internals=this.attachInternals())}connectedCallback(){super.connectedCallback(),z(),this._checkboxId=this.id||`scb-checkbox-${Math.random().toString(36).slice(2,11)}`,this._initialChecked=this.checked,h(this,n,w).call(this),this.addEventListener("focusin",b(this,x)),this.addEventListener("focusout",b(this,k)),this.addEventListener("pointerdown",b(this,_),!0),this._form=this.closest("form"),this._form&&(this._formResetHandler=()=>{this.checked=this._initialChecked,this.indeterminate=!1,this.__syncFormValue()},this._form.addEventListener("reset",this._formResetHandler,!0)),this.__syncFormValue()}disconnectedCallback(){super.disconnectedCallback(),F(),this.removeEventListener("focusin",b(this,x)),this.removeEventListener("focusout",b(this,k)),this.removeEventListener("pointerdown",b(this,_),!0),this._form&&this._formResetHandler&&this._form.removeEventListener("reset",this._formResetHandler,!0)}firstUpdated(){const e=this.shadowRoot?.querySelector("md-checkbox");e&&e.addEventListener("change",()=>{const s=e,r=!!s.checked,i=!!s.indeterminate;this.checked=r,this.indeterminate=i,this.dispatchEvent(new CustomEvent("change",{detail:{checked:r,indeterminate:i},bubbles:!0,composed:!0}))}),this.shadowRoot?.querySelector("label.wrap")?.addEventListener("click",s=>{if(this.disabled)return;if(!s.composedPath().some(o=>{const d=o;return d?.tagName?.toLowerCase?.()==="md-checkbox"||d?.classList?.contains("box-wrap")})){s.preventDefault();const o=this.shadowRoot.querySelector("md-checkbox");o&&(o.checked=!o.checked,o.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))}}),this.__syncInnerAria(),this.__syncValidity(),h(this,n,L).call(this)}updated(e){super.updated(e),e.has("disabled")&&(this.toggleAttribute("aria-disabled",this.disabled),this.disabled&&h(this,n,u).call(this,!1)),(e.has("label")||e.has("supportingText")||e.has("ariaLabel"))&&this.__syncInnerAria(),e.has("label")&&h(this,n,w).call(this),(e.has("checked")||e.has("disabled")||e.has("value"))&&this.__syncFormValue(),(e.has("checked")||e.has("disabled")||e.has("required"))&&this.__syncValidity(),(e.has("spacing")||e.has("spacingTop")||e.has("spacingBottom")||e.has("spacingLeft")||e.has("spacingRight"))&&h(this,n,L).call(this)}formDisabledCallback(e){this.disabled=e}__syncInnerAria(){const t=this.shadowRoot?.querySelector("md-checkbox")?.shadowRoot;if(!t)return;const s=t.querySelector('[role="checkbox"]')||t.querySelector('input[type="checkbox"]');if(!s)return;const r=!!this.label?.trim(),i=r?`${this._checkboxId}-label`:"",o=this.supportingText?`${this._checkboxId}-supporting-text`:"";r&&i?(s.setAttribute("aria-labelledby",i),s.removeAttribute("aria-label")):(s.removeAttribute("aria-labelledby"),this.ariaLabel?.trim()?s.setAttribute("aria-label",this.ariaLabel.trim()):s.removeAttribute("aria-label")),o?s.setAttribute("aria-describedby",o):s.removeAttribute("aria-describedby")}__getValidationMessage(){return this._customValidationMessage?this._customValidationMessage:this.required&&!this.checked?"Markera det här fältet.":""}__syncValidity(){const e=this.shadowRoot?.querySelector("md-checkbox"),t=this.disabled?"":this.__getValidationMessage();this._internals&&(t?this._internals.setValidity({valueMissing:!0},t,e??void 0):this._internals.setValidity({})),this.toggleAttribute("aria-invalid",!!t)}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}__syncFormValue(){if(!this._internals)return;const e=this.disabled||!this.checked?null:this.value;this._internals.setFormValue(e)}render(){const e=this.supportingText?`${this._checkboxId}-supporting-text`:void 0,t=!!this.label?.trim(),s=t?m:this.ariaLabel||m;return y`
2
2
  <label class="wrap">
3
- ${s?v`<md-focus-ring class="outer-focus-ring" ?visible=${this._showOuterFocusRing}></md-focus-ring>`:m}
3
+ ${t?y`<md-focus-ring class="outer-focus-ring" ?visible=${this._showOuterFocusRing}></md-focus-ring>`:m}
4
4
  <div class="box-wrap">
5
5
  <md-checkbox
6
6
  id="${this._checkboxId}"
7
7
  ?disabled=${this.disabled}
8
8
  ?indeterminate=${this.indeterminate}
9
9
  ?checked=${this.checked}
10
- aria-label=${t}
10
+ ?required=${this.required}
11
+ aria-label=${s}
11
12
  ></md-checkbox>
12
13
  </div>
13
- ${s?v`<span class="lbl" id="${this._checkboxId}-label">${this.label}</span>`:m}
14
+ ${t?y`<span class="lbl" id="${this._checkboxId}-label">${this.label}</span>`:m}
14
15
  </label>
15
16
 
16
- ${this.supportingText?v`<div id="${e}" class="supporting-text">
17
+ ${this.supportingText?y`<div id="${e}" class="supporting-text">
17
18
  ${this.supportingText}
18
19
  </div>`:m}
19
20
  <slot></slot>
20
- `}};c=new WeakSet;u=function(e){this._showOuterFocusRing!==e&&(this._showOuterFocusRing=e,this.requestUpdate())};w=function(){const e=!!this.label?.trim();this.toggleAttribute("data-has-label",e),e||l(this,c,u).call(this,!1)};x=new WeakMap;k=new WeakMap;_=new WeakMap;L=function(){const e=l(this,c,p).call(this,this.spacing),s=l(this,c,p).call(this,this.spacingTop)??e,t=l(this,c,p).call(this,this.spacingBottom)??e,r=l(this,c,p).call(this,this.spacingLeft),i=l(this,c,p).call(this,this.spacingRight);s?this.style.setProperty("--scb-checkbox-spacing-block-start",s):this.style.removeProperty("--scb-checkbox-spacing-block-start"),t?this.style.setProperty("--scb-checkbox-spacing-block-end",t):this.style.removeProperty("--scb-checkbox-spacing-block-end"),r?this.style.setProperty("--scb-checkbox-spacing-inline-start",r):this.style.removeProperty("--scb-checkbox-spacing-inline-start"),i?this.style.setProperty("--scb-checkbox-spacing-inline-end",i):this.style.removeProperty("--scb-checkbox-spacing-inline-end")};p=function(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};a.formAssociated=!0;a.styles=R`
21
+ `}};n=new WeakSet;u=function(e){this._showOuterFocusRing!==e&&(this._showOuterFocusRing=e,this.requestUpdate())};w=function(){const e=!!this.label?.trim();this.toggleAttribute("data-has-label",e),e||h(this,n,u).call(this,!1)};x=new WeakMap;k=new WeakMap;_=new WeakMap;L=function(){const e=h(this,n,p).call(this,this.spacing),t=h(this,n,p).call(this,this.spacingTop)??e,s=h(this,n,p).call(this,this.spacingBottom)??e,r=h(this,n,p).call(this,this.spacingLeft),i=h(this,n,p).call(this,this.spacingRight);t?this.style.setProperty("--scb-checkbox-spacing-block-start",t):this.style.removeProperty("--scb-checkbox-spacing-block-start"),s?this.style.setProperty("--scb-checkbox-spacing-block-end",s):this.style.removeProperty("--scb-checkbox-spacing-block-end"),r?this.style.setProperty("--scb-checkbox-spacing-inline-start",r):this.style.removeProperty("--scb-checkbox-spacing-inline-start"),i?this.style.setProperty("--scb-checkbox-spacing-inline-end",i):this.style.removeProperty("--scb-checkbox-spacing-inline-end")};p=function(e){if(!e)return;const t=String(e).trim();if(t)return/^\d+$/.test(t)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(t,10)))})`:t};a.formAssociated=!0;a.styles=C`
21
22
  :host {
22
23
  display: inline-grid;
23
24
  grid-template-columns: auto;
@@ -136,4 +137,4 @@ import{a as R,n as h,i as I,E as m,x as v,t as A}from"../../vendor/vendor.js";im
136
137
  color: var(--md-sys-color-on-surface-variant);
137
138
  }
138
139
  }
139
- `;n([h({type:Boolean,reflect:!0})],a.prototype,"disabled",2);n([h({type:Boolean,reflect:!0})],a.prototype,"indeterminate",2);n([h({type:Boolean,reflect:!0})],a.prototype,"checked",2);n([h({type:String,reflect:!0})],a.prototype,"size",2);n([h({type:String})],a.prototype,"label",2);n([h({type:String,attribute:"supporting-text"})],a.prototype,"supportingText",2);n([h({type:String,reflect:!0,attribute:"aria-label"})],a.prototype,"ariaLabel",2);n([h({type:String})],a.prototype,"name",2);n([h({type:String})],a.prototype,"value",2);n([h({type:String,reflect:!0})],a.prototype,"spacing",2);n([h({type:String,attribute:"spacing-top",reflect:!0})],a.prototype,"spacingTop",2);n([h({type:String,attribute:"spacing-bottom",reflect:!0})],a.prototype,"spacingBottom",2);n([h({type:String,attribute:"spacing-left",reflect:!0})],a.prototype,"spacingLeft",2);n([h({type:String,attribute:"spacing-right",reflect:!0})],a.prototype,"spacingRight",2);a=n([A("scb-checkbox")],a);export{a as ScbCheckbox};
140
+ `;c([l({type:Boolean,reflect:!0})],a.prototype,"disabled",2);c([l({type:Boolean,reflect:!0})],a.prototype,"indeterminate",2);c([l({type:Boolean,reflect:!0})],a.prototype,"checked",2);c([l({type:Boolean,reflect:!0})],a.prototype,"required",2);c([l({type:String,reflect:!0})],a.prototype,"size",2);c([l({type:String})],a.prototype,"label",2);c([l({type:String,attribute:"supporting-text"})],a.prototype,"supportingText",2);c([l({type:String,reflect:!0,attribute:"aria-label"})],a.prototype,"ariaLabel",2);c([l({type:String})],a.prototype,"name",2);c([l({type:String})],a.prototype,"value",2);c([l({type:String,reflect:!0})],a.prototype,"spacing",2);c([l({type:String,attribute:"spacing-top",reflect:!0})],a.prototype,"spacingTop",2);c([l({type:String,attribute:"spacing-bottom",reflect:!0})],a.prototype,"spacingBottom",2);c([l({type:String,attribute:"spacing-left",reflect:!0})],a.prototype,"spacingLeft",2);c([l({type:String,attribute:"spacing-right",reflect:!0})],a.prototype,"spacingRight",2);a=c([R("scb-checkbox")],a);export{a as ScbCheckbox};
@@ -1,105 +1,133 @@
1
- import{a as h,n as c,i as b,x as r,t as u}from"../../vendor/vendor.js";import"../scb-link/scb-link.js";import"../scb-button/scb-button.js";import"../scb-icon-button/scb-icon-button.js";import"../../vendor/vendor-material.js";import"../../vendor/preload-helper.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(n,e,o){try{customElements.get(n)||t(n,e,o)}catch(s){var g=String(s||"");if(g.indexOf("already been used")===-1&&g.indexOf("NotSupportedError")===-1)throw s}}}}catch{}})();var m=Object.defineProperty,v=Object.getOwnPropertyDescriptor,p=(a,t,n,e)=>{for(var o=e>1?void 0:e?v(t,n):t,g=a.length-1,s;g>=0;g--)(s=a[g])&&(o=(e?s(t,n,o):s(o))||o);return e&&o&&m(t,n,o),o};let l=class extends b{constructor(){super(...arguments),this.variant="icon-text",this.page=1,this.totalPages=0,this.pagingHref="",this.paginationAriaLabel="Paginering",this.currentAriaLabel="Nuvarande sida, ",this.pagingNumberAriaLabel="Gå till sida ",this.isNarrow=window.innerWidth<=768,this.spacing=void 0,this.spacingTop=void 0,this.spacingBottom=void 0,this.spacingLeft=void 0,this.spacingRight=void 0,this._onResize=()=>{this.isNarrow=window.innerWidth<=768}}_emitPageChange(a){const t={page:a};this.dispatchEvent(new CustomEvent("page-change",{detail:t,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("pagechange",{detail:t,bubbles:!0,composed:!0}))}_prevPage(){this.page>1&&this.page--,this._emitPageChange(this.page)}_nextPage(){this.page<this.totalPages&&this.page++,this._emitPageChange(this.page)}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this._onResize),this._onResize()}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("resize",this._onResize)}mapSpacingToken(a){if(a==null)return;const t=String(a).trim();if(t)return/^\d+$/.test(t)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(t,10)))})`:t}__applySpacing(){const a=this.mapSpacingToken(this.spacing),t=this.mapSpacingToken(this.spacingTop)??a,n=this.mapSpacingToken(this.spacingBottom)??a,e=this.mapSpacingToken(this.spacingLeft),o=this.mapSpacingToken(this.spacingRight);t?this.style.setProperty("--scb-pagination-spacing-block-start",t):this.style.removeProperty("--scb-pagination-spacing-block-start"),n?this.style.setProperty("--scb-pagination-spacing-block-end",n):this.style.removeProperty("--scb-pagination-spacing-block-end"),e?this.style.setProperty("--scb-pagination-spacing-inline-start",e):this.style.removeProperty("--scb-pagination-spacing-inline-start"),o?this.style.setProperty("--scb-pagination-spacing-inline-end",o):this.style.removeProperty("--scb-pagination-spacing-inline-end")}firstUpdated(){this.__applySpacing()}updated(a){super.updated(a),(a.has("spacing")||a.has("spacingTop")||a.has("spacingBottom")||a.has("spacingLeft")||a.has("spacingRight"))&&this.__applySpacing()}render(){if(this.totalPages===0)return null;const a=this.variant?`${this.variant.toLowerCase()}`:"",t=[],{page:n,totalPages:e}=this,o=window.innerWidth<=768,g=o?1:2,s=i=>i===n?r`
1
+ import{a as m,n as p,i as v,x as r,t as y}from"../../vendor/vendor.js";import"../scb-link/scb-link.js";import"../scb-button/scb-button.js";import"../scb-icon-button/scb-icon-button.js";import"../../vendor/vendor-material.js";import"../../vendor/preload-helper.js";(function(){try{var i=typeof globalThis<"u"?globalThis:window;if(!i.__scb_ce_guard_installed__){i.__scb_ce_guard_installed__=!0;var t=customElements.define.bind(customElements);customElements.define=function(n,a,s){try{customElements.get(n)||t(n,a,s)}catch(d){var c=String(d||"");if(c.indexOf("already been used")===-1&&c.indexOf("NotSupportedError")===-1)throw d}}}}catch{}})();var x=Object.defineProperty,_=Object.getOwnPropertyDescriptor,l=(i,t,n,a)=>{for(var s=a>1?void 0:a?_(t,n):t,c=i.length-1,d;c>=0;c--)(d=i[c])&&(s=(a?d(t,n,s):d(s))||s);return a&&s&&x(t,n,s),s};let o=class extends v{constructor(){super(...arguments),this.variant="icon-text",this.page=1,this.totalPages=0,this.pagingHref="",this.paginationAriaLabel="Paginering",this.currentAriaLabel="Nuvarande sida, ",this.pagingNumberAriaLabel="Gå till sida ",this.isNarrow=window.innerWidth<=768,this.spacing=void 0,this.spacingTop=void 0,this.spacingBottom=void 0,this.spacingLeft=void 0,this.spacingRight=void 0,this._onResize=()=>{this.isNarrow=window.innerWidth<=768}}_emitPageChange(i){const t={page:i};this.dispatchEvent(new CustomEvent("page-change",{detail:t,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("pagechange",{detail:t,bubbles:!0,composed:!0}))}_getPagingHref(i){if(this.pagingHref)return`${this.pagingHref}${i}`}_handlePageSelection(i,t){!this.pagingHref&&t&&t.preventDefault(),this.page=i,this._emitPageChange(i)}_prevPage(i){if(this.page<=1){!this.pagingHref&&i&&i.preventDefault();return}this._handlePageSelection(this.page-1,i)}_nextPage(i){if(this.page>=this.totalPages){!this.pagingHref&&i&&i.preventDefault();return}this._handlePageSelection(this.page+1,i)}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this._onResize),this._onResize()}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("resize",this._onResize)}mapSpacingToken(i){if(i==null)return;const t=String(i).trim();if(t)return/^\d+$/.test(t)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(t,10)))})`:t}__applySpacing(){const i=this.mapSpacingToken(this.spacing),t=this.mapSpacingToken(this.spacingTop)??i,n=this.mapSpacingToken(this.spacingBottom)??i,a=this.mapSpacingToken(this.spacingLeft),s=this.mapSpacingToken(this.spacingRight);t?this.style.setProperty("--scb-pagination-spacing-block-start",t):this.style.removeProperty("--scb-pagination-spacing-block-start"),n?this.style.setProperty("--scb-pagination-spacing-block-end",n):this.style.removeProperty("--scb-pagination-spacing-block-end"),a?this.style.setProperty("--scb-pagination-spacing-inline-start",a):this.style.removeProperty("--scb-pagination-spacing-inline-start"),s?this.style.setProperty("--scb-pagination-spacing-inline-end",s):this.style.removeProperty("--scb-pagination-spacing-inline-end")}firstUpdated(){this.__applySpacing()}updated(i){super.updated(i),(i.has("spacing")||i.has("spacingTop")||i.has("spacingBottom")||i.has("spacingLeft")||i.has("spacingRight"))&&this.__applySpacing()}render(){if(this.totalPages===0)return null;const i=this.variant?`${this.variant.toLowerCase()}`:"",t=[],{page:n,totalPages:a}=this,s=window.innerWidth<=768,c=s?1:2,d=this._getPagingHref(Math.max(1,this.page-1)),h=this._getPagingHref(Math.min(this.totalPages,this.page+1)),b=this.pagingHref?this.variant==="icon"?r`<a
2
+ class="paging-action-link"
3
+ href=${d}
4
+ @click=${this._prevPage}
5
+ aria-label="Föregående sida"
6
+ aria-disabled=${this.page===1?"true":"false"}
7
+ >
8
+ <scb-icon-button
9
+ icon="chevron_left"
10
+ ?disabled=${this.page===1}
11
+ aria-label="Föregående sida"
12
+ ></scb-icon-button>
13
+ </a>`:r`<a
14
+ class="paging-action-link"
15
+ href=${d}
16
+ @click=${this._prevPage}
17
+ aria-label="Föregående sida"
18
+ aria-disabled=${this.page===1?"true":"false"}
19
+ >
20
+ <scb-button
21
+ variant="text"
22
+ label="Föregående"
23
+ icon="chevron_left"
24
+ ?disabled=${this.page===1}
25
+ aria-label="Föregående sida"
26
+ ></scb-button>
27
+ </a>`:this.variant==="icon"?r`<scb-icon-button
28
+ icon="chevron_left"
29
+ @click=${this._prevPage}
30
+ ?disabled=${this.page===1}
31
+ aria-label="Föregående sida"
32
+ ></scb-icon-button>`:r`<scb-button
33
+ variant="text"
34
+ label="Föregående"
35
+ icon="chevron_left"
36
+ @click=${this._prevPage}
37
+ ?disabled=${this.page===1}
38
+ aria-label="Föregående sida"
39
+ ></scb-button>`,u=this.pagingHref?this.variant==="icon"?r`<a
40
+ class="paging-action-link"
41
+ href=${h}
42
+ @click=${this._nextPage}
43
+ aria-label="Nästa sida"
44
+ aria-disabled=${this.page===this.totalPages?"true":"false"}
45
+ >
46
+ <scb-icon-button
47
+ icon="chevron_right"
48
+ ?disabled=${this.page===this.totalPages}
49
+ aria-label="Nästa sida"
50
+ ></scb-icon-button>
51
+ </a>`:r`<a
52
+ class="paging-action-link"
53
+ href=${h}
54
+ @click=${this._nextPage}
55
+ aria-label="Nästa sida"
56
+ aria-disabled=${this.page===this.totalPages?"true":"false"}
57
+ >
58
+ <scb-button
59
+ variant="text"
60
+ label="Nästa"
61
+ icon="chevron_right"
62
+ iconPosition="right"
63
+ ?disabled=${this.page===this.totalPages}
64
+ aria-label="Nästa sida"
65
+ trailing-icon
66
+ ></scb-button>
67
+ </a>`:this.variant==="icon"?r`<scb-icon-button
68
+ icon="chevron_right"
69
+ @click=${this._nextPage}
70
+ ?disabled=${this.page===this.totalPages}
71
+ aria-label="Nästa sida"
72
+ ></scb-icon-button>`:r`<scb-button
73
+ variant="text"
74
+ label="Nästa"
75
+ icon="chevron_right"
76
+ iconPosition="right"
77
+ @click=${this._nextPage}
78
+ ?disabled=${this.page===this.totalPages}
79
+ aria-label="Nästa sida"
80
+ trailing-icon
81
+ ></scb-button>`,g=e=>e===n?r`
2
82
  <li>
3
83
  <span
4
84
  class="page-number active"
5
85
  aria-current="page"
6
- aria-label="${this.currentAriaLabel} ${i}"
7
- >${i}</span
86
+ aria-label="${this.currentAriaLabel} ${e}"
87
+ >${e}</span
8
88
  >
9
89
  </li>
10
90
  `:r`
11
91
  <li>
12
92
  <scb-link
13
- class="page-number${i===n?" active":""}"
14
- @click=${d=>{this.pagingHref||d.preventDefault(),this.page=i,this._emitPageChange(i)}}
15
- aria-current=${i===n?"page":void 0}
16
- aria-label="${this.pagingNumberAriaLabel} ${i}"
17
- href=${this.pagingHref?`${this.pagingHref}${i}`:void 0}
18
- ?disabled=${i===n}
19
- >${i}</scb-link
93
+ class="page-number${e===n?" active":""}"
94
+ @click=${f=>this._handlePageSelection(e,f)}
95
+ aria-current=${e===n?"page":void 0}
96
+ aria-label="${this.pagingNumberAriaLabel} ${e}"
97
+ href=${this._getPagingHref(e)}
98
+ ?disabled=${e===n}
99
+ >${e}</scb-link
20
100
  >
21
101
  </li>
22
- `;if(e<=8)for(let i=1;i<=e;i++)t.push(s(i));else if(t.push(s(1)),n<=4&&!o){for(let i=2;i<=5;i++)t.push(s(i));e>6?(t.push(r`<li><span class="ellipsis" aria-hidden="true">…</span></li>`),t.push(s(e))):e===6&&t.push(s(e))}else if(n<=3&&o){for(let i=2;i<=3;i++)t.push(s(i));e>4?(t.push(r`<li><span class="ellipsis" aria-hidden="true">…</span></li>`),t.push(s(e))):e===4&&t.push(s(e))}else if(n>=e-(g+1)){t.push(r`<li><span class="ellipsis" aria-hidden="true">…</span></li>`);for(let i=e-g*2;i<=e;i++)i>1&&t.push(s(i))}else{t.push(r`<li><span class="ellipsis" aria-hidden="true">…</span></li>`);for(let i=n-g;i<=n+g;i++)i>1&&i<e&&t.push(s(i));t.push(r`<li><span class="ellipsis" aria-hidden="true">…</span></li>`),t.push(s(e))}return o?r`
23
- <nav aria-label="${this.paginationAriaLabel}" class="pagination ${a}">
102
+ `;if(a<=8)for(let e=1;e<=a;e++)t.push(g(e));else if(t.push(g(1)),n<=4&&!s){for(let e=2;e<=5;e++)t.push(g(e));a>6?(t.push(r`<li><span class="ellipsis" aria-hidden="true">…</span></li>`),t.push(g(a))):a===6&&t.push(g(a))}else if(n<=3&&s){for(let e=2;e<=3;e++)t.push(g(e));a>4?(t.push(r`<li><span class="ellipsis" aria-hidden="true">…</span></li>`),t.push(g(a))):a===4&&t.push(g(a))}else if(n>=a-(c+1)){t.push(r`<li><span class="ellipsis" aria-hidden="true">…</span></li>`);for(let e=a-c*2;e<=a;e++)e>1&&t.push(g(e))}else{t.push(r`<li><span class="ellipsis" aria-hidden="true">…</span></li>`);for(let e=n-c;e<=n+c;e++)e>1&&e<a&&t.push(g(e));t.push(r`<li><span class="ellipsis" aria-hidden="true">…</span></li>`),t.push(g(a))}return s?r`
103
+ <nav aria-label="${this.paginationAriaLabel}" class="pagination ${i}">
24
104
  <div class="pagination-row">
25
105
  <div class="prev">
26
- ${this.variant==="icon"?r`<scb-icon-button
27
- icon="chevron_left"
28
- @click=${this._prevPage}
29
- ?disabled=${this.page===1}
30
- aria-label="Föregående sida"
31
- ></scb-icon-button>`:r`<scb-button
32
- variant="text"
33
- label="Föregående"
34
- icon="chevron_left"
35
- @click=${this._prevPage}
36
- ?disabled=${this.page===1}
37
- aria-label="Föregående sida"
38
- ></scb-button>`}
106
+ ${b}
39
107
  </div>
40
108
  <ol>
41
109
  ${t}
42
110
  </ol>
43
111
  </div>
44
112
  <div class="next">
45
- ${this.variant==="icon"?r`<scb-icon-button
46
- icon="chevron_right"
47
- @click=${this._nextPage}
48
- ?disabled=${this.page===this.totalPages}
49
- aria-label="Nästa sida"
50
- ></scb-icon-button>`:r`<scb-button
51
- variant="text"
52
- label="Nästa"
53
- icon="chevron_right"
54
- iconPosition="right"
55
- @click=${this._nextPage}
56
- ?disabled=${this.page===this.totalPages}
57
- aria-label="Nästa sida"
58
- trailing-icon
59
- ></scb-button>`}
113
+ ${u}
60
114
  </div>
61
115
  </nav>
62
116
  `:r`
63
- <nav aria-label="${this.paginationAriaLabel}" class="pagination ${a}">
117
+ <nav aria-label="${this.paginationAriaLabel}" class="pagination ${i}">
64
118
  <div class="pagination-row">
65
119
  <div class="prev">
66
- ${this.variant==="icon"?r`<scb-icon-button
67
- icon="chevron_left"
68
- @click=${this._prevPage}
69
- ?disabled=${this.page===1}
70
- aria-label="Föregående sida"
71
- ></scb-icon-button>`:r`<scb-button
72
- variant="text"
73
- label="Föregående"
74
- icon="chevron_left"
75
- @click=${this._prevPage}
76
- ?disabled=${this.page===1}
77
- aria-label="Föregående sida"
78
- ></scb-button>`}
120
+ ${b}
79
121
  </div>
80
122
  <ol>
81
123
  ${t}
82
124
  </ol>
83
125
  <div class="next">
84
- ${this.variant==="icon"?r`<scb-icon-button
85
- icon="chevron_right"
86
- @click=${this._nextPage}
87
- ?disabled=${this.page===this.totalPages}
88
- aria-label="Nästa sida"
89
- ></scb-icon-button>`:r`<scb-button
90
- variant="text"
91
- label="Nästa"
92
- icon="chevron_right"
93
- iconPosition="right"
94
- @click=${this._nextPage}
95
- ?disabled=${this.page===this.totalPages}
96
- aria-label="Nästa sida"
97
- trailing-icon
98
- ></scb-button>`}
126
+ ${u}
99
127
  </div>
100
128
  </div>
101
129
  </nav>
102
- `}};l.styles=[h`
130
+ `}};o.styles=[m`
103
131
  :host {
104
132
  display: block;
105
133
  width: 100%;
@@ -204,6 +232,14 @@ import{a as h,n as c,i as b,x as r,t as u}from"../../vendor/vendor.js";import"..
204
232
  opacity: 0.5;
205
233
  pointer-events: none;
206
234
  }
235
+ .paging-action-link {
236
+ display: inline-flex;
237
+ text-decoration: none;
238
+ }
239
+ .paging-action-link[aria-disabled='true'] {
240
+ opacity: 0.5;
241
+ pointer-events: none;
242
+ }
207
243
 
208
244
  @media (max-width: 768px) {
209
245
  .pagination .prev {
@@ -235,4 +271,4 @@ import{a as h,n as c,i as b,x as r,t as u}from"../../vendor/vendor.js";import"..
235
271
  margin-top: 8px;
236
272
  }
237
273
  }
238
- `];p([c({type:String})],l.prototype,"variant",2);p([c({type:Number})],l.prototype,"page",2);p([c({type:Number,attribute:"total-pages"})],l.prototype,"totalPages",2);p([c({type:String,attribute:"paging-href"})],l.prototype,"pagingHref",2);p([c({type:String,attribute:"pagination-aria-label"})],l.prototype,"paginationAriaLabel",2);p([c({type:String,attribute:"current-aria-label"})],l.prototype,"currentAriaLabel",2);p([c({type:String,attribute:"paging-number-aria-label"})],l.prototype,"pagingNumberAriaLabel",2);p([c({type:Boolean})],l.prototype,"isNarrow",2);p([c({type:String})],l.prototype,"spacing",2);p([c({type:String,attribute:"spacing-top"})],l.prototype,"spacingTop",2);p([c({type:String,attribute:"spacing-bottom"})],l.prototype,"spacingBottom",2);p([c({type:String,attribute:"spacing-left"})],l.prototype,"spacingLeft",2);p([c({type:String,attribute:"spacing-right"})],l.prototype,"spacingRight",2);l=p([u("scb-pagination")],l);
274
+ `];l([p({type:String})],o.prototype,"variant",2);l([p({type:Number})],o.prototype,"page",2);l([p({type:Number,attribute:"total-pages"})],o.prototype,"totalPages",2);l([p({type:String,attribute:"paging-href"})],o.prototype,"pagingHref",2);l([p({type:String,attribute:"pagination-aria-label"})],o.prototype,"paginationAriaLabel",2);l([p({type:String,attribute:"current-aria-label"})],o.prototype,"currentAriaLabel",2);l([p({type:String,attribute:"paging-number-aria-label"})],o.prototype,"pagingNumberAriaLabel",2);l([p({type:Boolean})],o.prototype,"isNarrow",2);l([p({type:String})],o.prototype,"spacing",2);l([p({type:String,attribute:"spacing-top"})],o.prototype,"spacingTop",2);l([p({type:String,attribute:"spacing-bottom"})],o.prototype,"spacingBottom",2);l([p({type:String,attribute:"spacing-left"})],o.prototype,"spacingLeft",2);l([p({type:String,attribute:"spacing-right"})],o.prototype,"spacingRight",2);o=l([y("scb-pagination")],o);
@@ -1,6 +1,6 @@
1
- import{a as S,n as d,i as z,E as p,x as m,t as C}from"../../vendor/vendor.js";import"../../vendor/vendor-material.js";import"./scb-radio-group.js";(function(){try{var e=typeof globalThis<"u"?globalThis:window;if(!e.__scb_ce_guard_installed__){e.__scb_ce_guard_installed__=!0;var t=customElements.define.bind(customElements);customElements.define=function(i,r,a){try{customElements.get(i)||t(i,r,a)}catch(h){var o=String(h||"");if(o.indexOf("already been used")===-1&&o.indexOf("NotSupportedError")===-1)throw h}}}}catch{}})();var I=Object.defineProperty,R=Object.getOwnPropertyDescriptor,L=e=>{throw TypeError(e)},l=(e,t,i,r)=>{for(var a=r>1?void 0:r?R(t,i):t,o=e.length-1,h;o>=0;o--)(h=e[o])&&(a=(r?h(t,i,a):h(a))||a);return r&&a&&I(t,i,a),a},k=(e,t,i)=>t.has(e)||L("Cannot "+i),u=(e,t,i)=>(k(e,t,"read from private field"),i?i.call(e):t.get(e)),f=(e,t,i)=>t.has(e)?L("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,i),c=(e,t,i)=>(k(e,t,"access private method"),i),n,b,_,y,w,x;let E=!1,g=0;const $=e=>{e.metaKey||e.altKey||e.ctrlKey||(E=!0)},v=()=>{E=!1},A=()=>{g===0&&(window.addEventListener("keydown",$,!0),window.addEventListener("pointerdown",v,!0),window.addEventListener("mousedown",v,!0),window.addEventListener("touchstart",v,!0)),g+=1},O=()=>{g=Math.max(0,g-1),g===0&&(window.removeEventListener("keydown",$,!0),window.removeEventListener("pointerdown",v,!0),window.removeEventListener("mousedown",v,!0),window.removeEventListener("touchstart",v,!0))};let s=class extends z{constructor(){super(...arguments),f(this,n),this.disabled=!1,this.checked=!1,this.name="",this.value="",this.size="medium",this.label="",this.supportingText="",this.ariaLabel="",this._radioId="",this._showOuterFocusRing=!1,f(this,y,()=>{this.disabled||!this.label?.trim()||E&&c(this,n,b).call(this,!0)}),f(this,w,()=>{c(this,n,b).call(this,!1)}),f(this,x,()=>{c(this,n,b).call(this,!1)}),this._onMdRadioChange=e=>{if(this.disabled)return;const t=e.target;t&&t.checked&&(this.checked=!0,this.dispatchEvent(new CustomEvent("scb-radio-change",{detail:{name:this.name,source:this},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("change",{detail:{checked:this.checked,value:this.value},bubbles:!0,composed:!0})))},this._onRadioChange=e=>{e.detail.name===this.name&&e.detail.source!==this&&(this.checked=!1)}}connectedCallback(){super.connectedCallback(),A(),this._radioId=this.id||`scb-radio-${Math.random().toString(36).substr(2,9)}`,c(this,n,_).call(this),this.addEventListener("focusin",u(this,y)),this.addEventListener("focusout",u(this,w)),this.addEventListener("pointerdown",u(this,x),!0),document.addEventListener("scb-radio-change",this._onRadioChange)}disconnectedCallback(){super.disconnectedCallback(),O(),this.removeEventListener("focusin",u(this,y)),this.removeEventListener("focusout",u(this,w)),this.removeEventListener("pointerdown",u(this,x),!0),document.removeEventListener("scb-radio-change",this._onRadioChange)}firstUpdated(){const e=this.shadowRoot?.querySelector("md-radio");e&&e.addEventListener("input",()=>{this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0}))}),this.__syncInnerAria()}updated(e){super.updated(e),e.has("disabled")&&(this.toggleAttribute("aria-disabled",this.disabled),this.disabled&&c(this,n,b).call(this,!1)),(e.has("label")||e.has("supportingText")||e.has("ariaLabel"))&&this.__syncInnerAria(),e.has("label")&&c(this,n,_).call(this)}__syncInnerAria(){const t=this.shadowRoot?.querySelector("md-radio")?.shadowRoot;if(!t)return;const i=t.querySelector('[role="radio"]')||t.querySelector('input[type="radio"]');if(!i)return;const r=!!this.label?.trim(),a=r?`${this._radioId}-label`:"",o=this.supportingText?`${this._radioId}-supporting-text`:"";r&&a?(i.setAttribute("aria-labelledby",a),i.removeAttribute("aria-label")):(i.removeAttribute("aria-labelledby"),this.ariaLabel?.trim()?i.setAttribute("aria-label",this.ariaLabel.trim()):i.removeAttribute("aria-label")),o?i.setAttribute("aria-describedby",o):i.removeAttribute("aria-describedby")}render(){const e=this.supportingText?`${this._radioId}-supporting-text`:void 0,t=!!this.label?.trim(),i=t?p:this.ariaLabel||p;return m`
1
+ import{a as C,n as c,i as A,E as p,x as g,t as I}from"../../vendor/vendor.js";import"../../vendor/vendor-material.js";import"./scb-radio-group.js";(function(){try{var e=typeof globalThis<"u"?globalThis:window;if(!e.__scb_ce_guard_installed__){e.__scb_ce_guard_installed__=!0;var t=customElements.define.bind(customElements);customElements.define=function(i,l,s){try{customElements.get(i)||t(i,l,s)}catch(h){var d=String(h||"");if(d.indexOf("already been used")===-1&&d.indexOf("NotSupportedError")===-1)throw h}}}}catch{}})();var z=Object.defineProperty,R=Object.getOwnPropertyDescriptor,L=e=>{throw TypeError(e)},n=(e,t,i,l)=>{for(var s=l>1?void 0:l?R(t,i):t,d=e.length-1,h;d>=0;d--)(h=e[d])&&(s=(l?h(t,i,s):h(s))||s);return l&&s&&z(t,i,s),s},$=(e,t,i)=>t.has(e)||L("Cannot "+i),u=(e,t,i)=>($(e,t,"read from private field"),i?i.call(e):t.get(e)),f=(e,t,i)=>t.has(e)?L("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,i),o=(e,t,i)=>($(e,t,"access private method"),i),a,b,k,y,w,x,_;let E=!1,m=0;const S=e=>{e.metaKey||e.altKey||e.ctrlKey||(E=!0)},v=()=>{E=!1},O=()=>{m===0&&(window.addEventListener("keydown",S,!0),window.addEventListener("pointerdown",v,!0),window.addEventListener("mousedown",v,!0),window.addEventListener("touchstart",v,!0)),m+=1},F=()=>{m=Math.max(0,m-1),m===0&&(window.removeEventListener("keydown",S,!0),window.removeEventListener("pointerdown",v,!0),window.removeEventListener("mousedown",v,!0),window.removeEventListener("touchstart",v,!0))};let r=class extends A{constructor(){super(...arguments),f(this,a),this.disabled=!1,this.checked=!1,this.name="",this.value="",this.size="medium",this.deselectable=!1,this.label="",this.supportingText="",this.ariaLabel="",this._radioId="",this._showOuterFocusRing=!1,f(this,y,()=>{this.disabled||!this.label?.trim()||E&&o(this,a,b).call(this,!0)}),f(this,w,()=>{o(this,a,b).call(this,!1)}),f(this,x,()=>{o(this,a,b).call(this,!1)}),this._onClick=e=>{if(this.disabled)return;e.preventDefault(),e.stopPropagation();const t=this.deselectable?!this.checked:!0;t!==this.checked&&(this.checked=t,o(this,a,_).call(this),this.checked&&this.dispatchEvent(new CustomEvent("scb-radio-change",{detail:{name:this.name,source:this},bubbles:!0,composed:!0})),this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("change",{detail:{checked:this.checked,value:this.checked?this.value:""},bubbles:!0,composed:!0})))},this._onRadioChange=e=>{e.detail.name===this.name&&e.detail.source!==this&&(this.checked=!1)}}connectedCallback(){super.connectedCallback(),O(),this._radioId=this.id||`scb-radio-${Math.random().toString(36).substr(2,9)}`,o(this,a,k).call(this),this.addEventListener("focusin",u(this,y)),this.addEventListener("focusout",u(this,w)),this.addEventListener("pointerdown",u(this,x),!0),document.addEventListener("scb-radio-change",this._onRadioChange)}disconnectedCallback(){super.disconnectedCallback(),F(),this.removeEventListener("focusin",u(this,y)),this.removeEventListener("focusout",u(this,w)),this.removeEventListener("pointerdown",u(this,x),!0),document.removeEventListener("scb-radio-change",this._onRadioChange)}firstUpdated(){this.__syncInnerAria(),o(this,a,_).call(this)}updated(e){super.updated(e),e.has("disabled")&&(this.toggleAttribute("aria-disabled",this.disabled),this.disabled&&o(this,a,b).call(this,!1)),(e.has("label")||e.has("supportingText")||e.has("ariaLabel"))&&this.__syncInnerAria(),e.has("label")&&o(this,a,k).call(this),e.has("checked")&&o(this,a,_).call(this)}__syncInnerAria(){const t=this.shadowRoot?.querySelector("md-radio")?.shadowRoot;if(!t)return;const i=t.querySelector('[role="radio"]')||t.querySelector('input[type="radio"]');if(!i)return;const l=!!this.label?.trim(),s=l?`${this._radioId}-label`:"",d=this.supportingText?`${this._radioId}-supporting-text`:"";l&&s?(i.setAttribute("aria-labelledby",s),i.removeAttribute("aria-label")):(i.removeAttribute("aria-labelledby"),this.ariaLabel?.trim()?i.setAttribute("aria-label",this.ariaLabel.trim()):i.removeAttribute("aria-label")),d?i.setAttribute("aria-describedby",d):i.removeAttribute("aria-describedby")}render(){const e=this.supportingText?`${this._radioId}-supporting-text`:void 0,t=!!this.label?.trim(),i=t?p:this.ariaLabel||p;return g`
2
2
  <label class="wrap">
3
- ${t?m`<md-focus-ring class="outer-focus-ring" ?visible=${this._showOuterFocusRing}></md-focus-ring>`:p}
3
+ ${t?g`<md-focus-ring class="outer-focus-ring" ?visible=${this._showOuterFocusRing}></md-focus-ring>`:p}
4
4
  <div class="radio-wrap">
5
5
  <md-radio
6
6
  id="${this._radioId}"
@@ -10,17 +10,17 @@ import{a as S,n as d,i as z,E as p,x as m,t as C}from"../../vendor/vendor.js";im
10
10
  value="${this.value}"
11
11
  aria-label=${i}
12
12
  aria-describedby=${e??p}
13
- @change=${this._onMdRadioChange}
13
+ @click=${this._onClick}
14
14
  ></md-radio>
15
15
  </div>
16
- ${t?m`<span class="lbl" id="${this._radioId}-label">${this.label}</span>`:p}
16
+ ${t?g`<span class="lbl" id="${this._radioId}-label">${this.label}</span>`:p}
17
17
  </label>
18
18
 
19
- ${this.supportingText?m`<div id="${e}" class="supporting-text">
19
+ ${this.supportingText?g`<div id="${e}" class="supporting-text">
20
20
  ${this.supportingText}
21
21
  </div>`:p}
22
22
  <slot></slot>
23
- `}};n=new WeakSet;b=function(e){this._showOuterFocusRing!==e&&(this._showOuterFocusRing=e,this.requestUpdate())};_=function(){const e=!!this.label?.trim();this.toggleAttribute("data-has-label",e),e||c(this,n,b).call(this,!1)};y=new WeakMap;w=new WeakMap;x=new WeakMap;s.styles=S`
23
+ `}};a=new WeakSet;b=function(e){this._showOuterFocusRing!==e&&(this._showOuterFocusRing=e,this.requestUpdate())};k=function(){const e=!!this.label?.trim();this.toggleAttribute("data-has-label",e),e||o(this,a,b).call(this,!1)};y=new WeakMap;w=new WeakMap;x=new WeakMap;_=function(){const e=this.shadowRoot?.querySelector("md-radio");e&&(e.checked=this.checked,this.checked?e.setAttribute("checked",""):e.removeAttribute("checked"))};r.styles=C`
24
24
  /* layout med inline-grid */
25
25
  :host {
26
26
  display: inline-grid;
@@ -129,4 +129,4 @@ import{a as S,n as d,i as z,E as p,x as m,t as C}from"../../vendor/vendor.js";im
129
129
  .lbl { color: var(--md-sys-color-on-surface); }
130
130
  .supporting-text { color: var(--md-sys-color-on-surface-variant); }
131
131
  }
132
- `;l([d({type:Boolean,reflect:!0})],s.prototype,"disabled",2);l([d({type:Boolean,reflect:!0})],s.prototype,"checked",2);l([d({type:String,reflect:!0})],s.prototype,"name",2);l([d({type:String,reflect:!0})],s.prototype,"value",2);l([d({type:String,reflect:!0})],s.prototype,"size",2);l([d({type:String})],s.prototype,"label",2);l([d({type:String,attribute:"supporting-text"})],s.prototype,"supportingText",2);l([d({type:String,attribute:"aria-label"})],s.prototype,"ariaLabel",2);s=l([C("scb-radio-button")],s);
132
+ `;n([c({type:Boolean,reflect:!0})],r.prototype,"disabled",2);n([c({type:Boolean,reflect:!0})],r.prototype,"checked",2);n([c({type:String,reflect:!0})],r.prototype,"name",2);n([c({type:String,reflect:!0})],r.prototype,"value",2);n([c({type:String,reflect:!0})],r.prototype,"size",2);n([c({type:Boolean,reflect:!0})],r.prototype,"deselectable",2);n([c({type:String})],r.prototype,"label",2);n([c({type:String,attribute:"supporting-text"})],r.prototype,"supportingText",2);n([c({type:String,attribute:"aria-label"})],r.prototype,"ariaLabel",2);r=n([I("scb-radio-button")],r);
@@ -1,14 +1,16 @@
1
- import{a as E,n as o,i as w,x as C,t as A}from"../../vendor/vendor.js";(function(){try{var t=typeof globalThis<"u"?globalThis:window;if(!t.__scb_ce_guard_installed__){t.__scb_ce_guard_installed__=!0;var i=customElements.define.bind(customElements);customElements.define=function(e,s,a){try{customElements.get(e)||i(e,s,a)}catch(l){var c=String(l||"");if(c.indexOf("already been used")===-1&&c.indexOf("NotSupportedError")===-1)throw l}}}}catch{}})();var L=Object.defineProperty,P=Object.getOwnPropertyDescriptor,k=t=>{throw TypeError(t)},n=(t,i,e,s)=>{for(var a=s>1?void 0:s?P(i,e):i,c=t.length-1,l;c>=0;c--)(l=t[c])&&(a=(s?l(i,e,a):l(a))||a);return s&&a&&L(i,e,a),a},S=(t,i,e)=>i.has(t)||k("Cannot "+e),p=(t,i,e)=>(S(t,i,"read from private field"),e?e.call(t):i.get(t)),f=(t,i,e)=>i.has(t)?k("Cannot add the same private member more than once"):i instanceof WeakSet?i.add(t):i.set(t,e),u=(t,i,e)=>(S(t,i,"access private method"),e),v,d,b,m,h,_,g;let r=class extends w{constructor(){super(),f(this,h),this.name="",this.orientation="vertical",this.disabled=!1,this.size="medium",this.ariaLabel=null,this.spacing=void 0,this.spacingTop=void 0,this.spacingBottom=void 0,this.spacingLeft=void 0,this.spacingRight=void 0,this.value="",this._internals=null,this._form=null,this._formResetHandler=null,this._initialValue="",f(this,v,()=>{const t=this.shadowRoot?.querySelector("slot");return t?t.assignedElements({flatten:!0}).filter(i=>i.tagName.toLowerCase()==="scb-radio-button"):[]}),f(this,d,()=>{const t=p(this,v).call(this);if(!t.length)return;let i=null;for(const e of t){const s=e;this.name&&e.setAttribute("name",this.name),this.disabled?e.setAttribute("disabled",""):e.removeAttribute("disabled"),this.orientation==="horizontal"?e.setAttribute("orientation","horizontal"):e.removeAttribute("orientation");const a=e.hasAttribute("data-size-from-group");this.size==="medium"?a&&(e.removeAttribute("size"),e.removeAttribute("data-size-from-group")):(!e.hasAttribute("size")||a)&&(e.setAttribute("size",this.size),e.setAttribute("data-size-from-group",""));const c=s.value??e.getAttribute("value")??"",l=typeof s.checked=="boolean"?s.checked:e.hasAttribute("checked");if(this.value){const y=String(c)===this.value;y&&!l?s.checked=!0:!y&&l&&(s.checked=!1)}else l&&i===null&&(i=String(c))}!this.value&&i!==null&&(this.value=i)}),f(this,b,t=>{t.target===this||!t.composedPath().find(e=>e?.tagName?.toLowerCase()==="scb-radio-button")||(t.stopImmediatePropagation(),this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})))}),f(this,m,t=>{if(t.target===this)return;const i=t.composedPath().find(a=>a?.tagName?.toLowerCase()==="scb-radio-button");if(!i)return;t.stopImmediatePropagation();const e=i?.value??i?.getAttribute?.("value")??t.target?.value??"";this.value=String(e??"");const s={value:String(e??""),originalIsTrusted:t?.isTrusted===!0};this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("scb-change",{detail:s,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("scbchange",{detail:s,bubbles:!0,composed:!0}))}),"attachInternals"in this&&(this._internals=this.attachInternals())}render(){const t=this.orientation==="horizontal"?"row":"column";return C`
1
+ import{a as E,n as h,i as C,x as A,t as L}from"../../vendor/vendor.js";(function(){try{var t=typeof globalThis<"u"?globalThis:window;if(!t.__scb_ce_guard_installed__){t.__scb_ce_guard_installed__=!0;var i=customElements.define.bind(customElements);customElements.define=function(e,s,a){try{customElements.get(e)||i(e,s,a)}catch(u){var c=String(u||"");if(c.indexOf("already been used")===-1&&c.indexOf("NotSupportedError")===-1)throw u}}}}catch{}})();var M=Object.defineProperty,P=Object.getOwnPropertyDescriptor,V=t=>{throw TypeError(t)},l=(t,i,e,s)=>{for(var a=s>1?void 0:s?P(i,e):i,c=t.length-1,u;c>=0;c--)(u=t[c])&&(a=(s?u(i,e,a):u(a))||a);return s&&a&&M(i,e,a),a},w=(t,i,e)=>i.has(t)||V("Cannot "+e),d=(t,i,e)=>(w(t,i,"read from private field"),e?e.call(t):i.get(t)),b=(t,i,e)=>i.has(t)?V("Cannot add the same private member more than once"):i instanceof WeakSet?i.add(t):i.set(t,e),o=(t,i,e)=>(w(t,i,"access private method"),e),y,p,m,v,r,_,g,k,f;let n=class extends C{constructor(){super(),b(this,r),this.name="",this.orientation="vertical",this.disabled=!1,this.required=!1,this.deselectable=!1,this.size="medium",this.ariaLabel=null,this.spacing=void 0,this.spacingTop=void 0,this.spacingBottom=void 0,this.spacingLeft=void 0,this.spacingRight=void 0,this.value="",this._internals=null,this._form=null,this._formResetHandler=null,this._initialValue="",this._customValidationMessage="",b(this,y,()=>{const t=this.shadowRoot?.querySelector("slot");return t?t.assignedElements({flatten:!0}).filter(i=>i.tagName.toLowerCase()==="scb-radio-button"):[]}),b(this,p,()=>{const t=d(this,y).call(this);if(!t.length)return;let i=null;for(const e of t){const s=e;this.name&&e.setAttribute("name",this.name),this.disabled?e.setAttribute("disabled",""):e.removeAttribute("disabled"),this.orientation==="horizontal"?e.setAttribute("orientation","horizontal"):e.removeAttribute("orientation");const a=e.hasAttribute("data-size-from-group");this.deselectable?e.setAttribute("deselectable",""):e.removeAttribute("deselectable"),this.size==="medium"?a&&(e.removeAttribute("size"),e.removeAttribute("data-size-from-group")):(!e.hasAttribute("size")||a)&&(e.setAttribute("size",this.size),e.setAttribute("data-size-from-group",""));const c=s.value??e.getAttribute("value")??"",u=typeof s.checked=="boolean"?s.checked:e.hasAttribute("checked");if(this.value){const S=String(c)===this.value;S&&!u?s.checked=!0:!S&&u&&(s.checked=!1)}else u&&i===null&&(i=String(c))}!this.value&&i!==null&&(this.value=i)}),b(this,m,t=>{t.target===this||!t.composedPath().find(e=>e?.tagName?.toLowerCase()==="scb-radio-button")||(t.stopImmediatePropagation(),this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})))}),b(this,v,t=>{if(t.target===this)return;const i=t.composedPath().find(c=>c?.tagName?.toLowerCase()==="scb-radio-button");if(!i)return;t.stopImmediatePropagation();const e=i?.checked===!0,s=e?i?.value??i?.getAttribute?.("value")??t.target?.value??"":"";this.value=String(s??"");const a={value:String(s??""),checked:e,originalIsTrusted:t?.isTrusted===!0};this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("scb-change",{detail:a,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("scbchange",{detail:a,bubbles:!0,composed:!0}))}),"attachInternals"in this&&(this._internals=this.attachInternals())}render(){const t=this.orientation==="horizontal"?"row":"column";return A`
2
2
  <div
3
3
  class="g"
4
4
  role="radiogroup"
5
5
  aria-disabled=${String(this.disabled)}
6
+ aria-required=${String(this.required)}
7
+ aria-invalid=${o(this,r,_).call(this)?"true":"false"}
6
8
  aria-label=${this.ariaLabel??""}
7
9
  style=${`--_dir:${t}`}
8
10
  >
9
- <slot @slotchange=${p(this,d)}></slot>
11
+ <slot @slotchange=${d(this,p)}></slot>
10
12
  </div>
11
- `}firstUpdated(){u(this,h,_).call(this),p(this,d).call(this),this.addEventListener("input",p(this,b)),this.addEventListener("change",p(this,m)),this._initialValue=this.value,this._form=this.closest("form"),this._form&&(this._formResetHandler=()=>{this.value=this._initialValue,this.requestUpdate(),p(this,d).call(this),this.__syncFormValue()},this._form.addEventListener("reset",this._formResetHandler,!0)),this.__syncFormValue()}disconnectedCallback(){this.removeEventListener("input",p(this,b)),this.removeEventListener("change",p(this,m)),this._form&&this._formResetHandler&&this._form.removeEventListener("reset",this._formResetHandler,!0),super.disconnectedCallback()}updated(t){(t.has("spacing")||t.has("spacingTop")||t.has("spacingBottom")||t.has("spacingLeft")||t.has("spacingRight"))&&u(this,h,_).call(this),(t.has("name")||t.has("disabled")||t.has("orientation")||t.has("size")||t.has("value"))&&p(this,d).call(this),(t.has("value")||t.has("disabled")||t.has("name"))&&this.__syncFormValue()}formDisabledCallback(t){this.disabled=t}__syncFormValue(){if(!this._internals)return;const t=typeof this.name=="string"&&this.name.trim()!=="",i=typeof this.value=="string"&&this.value.trim()!=="",e=this.disabled||!t||!i?null:this.value;this._internals.setFormValue(e)}};v=new WeakMap;d=new WeakMap;b=new WeakMap;m=new WeakMap;h=new WeakSet;_=function(){const t=u(this,h,g).call(this,this.spacing),i=u(this,h,g).call(this,this.spacingTop)??t,e=u(this,h,g).call(this,this.spacingBottom)??t,s=u(this,h,g).call(this,this.spacingLeft),a=u(this,h,g).call(this,this.spacingRight);i?this.style.setProperty("--scb-radio-group-spacing-block-start",i):this.style.removeProperty("--scb-radio-group-spacing-block-start"),e?this.style.setProperty("--scb-radio-group-spacing-block-end",e):this.style.removeProperty("--scb-radio-group-spacing-block-end"),s?this.style.setProperty("--scb-radio-group-spacing-inline-start",s):this.style.removeProperty("--scb-radio-group-spacing-inline-start"),a?this.style.setProperty("--scb-radio-group-spacing-inline-end",a):this.style.removeProperty("--scb-radio-group-spacing-inline-end")};g=function(t){if(!t)return;const i=String(t).trim();if(i)return/^\d+$/.test(i)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(i,10)))})`:i};r.formAssociated=!0;r.styles=E`
13
+ `}firstUpdated(){o(this,r,k).call(this),d(this,p).call(this),this.addEventListener("input",d(this,m)),this.addEventListener("change",d(this,v)),this._initialValue=this.value,this._form=this.closest("form"),this._form&&(this._formResetHandler=()=>{this.value=this._initialValue,this.requestUpdate(),d(this,p).call(this),this.__syncFormValue(),o(this,r,g).call(this)},this._form.addEventListener("reset",this._formResetHandler,!0)),this.__syncFormValue(),o(this,r,g).call(this)}disconnectedCallback(){this.removeEventListener("input",d(this,m)),this.removeEventListener("change",d(this,v)),this._form&&this._formResetHandler&&this._form.removeEventListener("reset",this._formResetHandler,!0),super.disconnectedCallback()}updated(t){(t.has("spacing")||t.has("spacingTop")||t.has("spacingBottom")||t.has("spacingLeft")||t.has("spacingRight"))&&o(this,r,k).call(this),(t.has("name")||t.has("disabled")||t.has("orientation")||t.has("size")||t.has("deselectable")||t.has("required")||t.has("value"))&&d(this,p).call(this),(t.has("value")||t.has("disabled")||t.has("name"))&&this.__syncFormValue(),(t.has("value")||t.has("disabled")||t.has("required"))&&o(this,r,g).call(this)}get form(){return this._internals?.form??this._form}get validity(){return this._internals?.validity}get validationMessage(){return this._internals?.validationMessage??""}get willValidate(){return this._internals?.willValidate??!this.disabled}get labels(){return this._internals?.labels}checkValidity(){return this._internals?.checkValidity()??!o(this,r,_).call(this)}reportValidity(){return this._internals?.reportValidity()??!o(this,r,_).call(this)}setCustomValidity(t){this._customValidationMessage=String(t??""),o(this,r,g).call(this)}formDisabledCallback(t){this.disabled=t,o(this,r,g).call(this)}__syncFormValue(){if(!this._internals)return;const t=typeof this.name=="string"&&this.name.trim()!=="",i=typeof this.value=="string"&&this.value.trim()!=="",e=this.disabled||!t||!i?null:this.value;this._internals.setFormValue(e)}};y=new WeakMap;p=new WeakMap;m=new WeakMap;v=new WeakMap;r=new WeakSet;_=function(){return this.disabled?!1:this._customValidationMessage?!0:this.required&&!this.value.trim()};g=function(){if(!this._internals)return;const t=!this.disabled&&this.required&&!this.value.trim(),i=this._customValidationMessage||(t?"Välj ett alternativ.":"");this._internals.setValidity(t?{valueMissing:!0}:{},i,this.shadowRoot?.querySelector(".g")??void 0)};k=function(){const t=o(this,r,f).call(this,this.spacing),i=o(this,r,f).call(this,this.spacingTop)??t,e=o(this,r,f).call(this,this.spacingBottom)??t,s=o(this,r,f).call(this,this.spacingLeft),a=o(this,r,f).call(this,this.spacingRight);i?this.style.setProperty("--scb-radio-group-spacing-block-start",i):this.style.removeProperty("--scb-radio-group-spacing-block-start"),e?this.style.setProperty("--scb-radio-group-spacing-block-end",e):this.style.removeProperty("--scb-radio-group-spacing-block-end"),s?this.style.setProperty("--scb-radio-group-spacing-inline-start",s):this.style.removeProperty("--scb-radio-group-spacing-inline-start"),a?this.style.setProperty("--scb-radio-group-spacing-inline-end",a):this.style.removeProperty("--scb-radio-group-spacing-inline-end")};f=function(t){if(!t)return;const i=String(t).trim();if(i)return/^\d+$/.test(i)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(i,10)))})`:i};n.formAssociated=!0;n.styles=E`
12
14
  :host {
13
15
  display: block;
14
16
 
@@ -38,4 +40,4 @@ import{a as E,n as o,i as w,x as C,t as A}from"../../vendor/vendor.js";(function
38
40
  ::slotted(scb-radio-button) {
39
41
  --scb-radio-gap: 0;
40
42
  }
41
- `;n([o({type:String})],r.prototype,"name",2);n([o({type:String,reflect:!0})],r.prototype,"orientation",2);n([o({type:Boolean,reflect:!0})],r.prototype,"disabled",2);n([o({type:String,reflect:!0})],r.prototype,"size",2);n([o({type:String,attribute:"aria-label"})],r.prototype,"ariaLabel",2);n([o({type:String,reflect:!0})],r.prototype,"spacing",2);n([o({type:String,attribute:"spacing-top",reflect:!0})],r.prototype,"spacingTop",2);n([o({type:String,attribute:"spacing-bottom",reflect:!0})],r.prototype,"spacingBottom",2);n([o({type:String,attribute:"spacing-left",reflect:!0})],r.prototype,"spacingLeft",2);n([o({type:String,attribute:"spacing-right",reflect:!0})],r.prototype,"spacingRight",2);n([o({type:String,reflect:!0})],r.prototype,"value",2);r=n([A("scb-radio-group")],r);
43
+ `;l([h({type:String})],n.prototype,"name",2);l([h({type:String,reflect:!0})],n.prototype,"orientation",2);l([h({type:Boolean,reflect:!0})],n.prototype,"disabled",2);l([h({type:Boolean,reflect:!0})],n.prototype,"required",2);l([h({type:Boolean,reflect:!0})],n.prototype,"deselectable",2);l([h({type:String,reflect:!0})],n.prototype,"size",2);l([h({type:String,attribute:"aria-label"})],n.prototype,"ariaLabel",2);l([h({type:String,reflect:!0})],n.prototype,"spacing",2);l([h({type:String,attribute:"spacing-top",reflect:!0})],n.prototype,"spacingTop",2);l([h({type:String,attribute:"spacing-bottom",reflect:!0})],n.prototype,"spacingBottom",2);l([h({type:String,attribute:"spacing-left",reflect:!0})],n.prototype,"spacingLeft",2);l([h({type:String,attribute:"spacing-right",reflect:!0})],n.prototype,"spacingRight",2);l([h({type:String,reflect:!0})],n.prototype,"value",2);n=l([L("scb-radio-group")],n);
@@ -1,16 +1,16 @@
1
- import{a as y,n as c,i as x,E as b,x as p,t as w}from"../../vendor/vendor.js";import"../scb-list/scb-list.js";import"../../vendor/vendor-material.js";import"../../vendor/preload-helper.js";import"../scb-list/scb-list-item.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,s){try{customElements.get(i)||e(i,n,s)}catch(a){var r=String(a||"");if(r.indexOf("already been used")===-1&&r.indexOf("NotSupportedError")===-1)throw a}}}}catch{}})();var S=Object.defineProperty,A=Object.getOwnPropertyDescriptor,l=(t,e,i,n)=>{for(var s=n>1?void 0:n?A(e,i):e,r=t.length-1,a;r>=0;r--)(a=t[r])&&(s=(n?a(e,i,s):a(s))||s);return n&&s&&S(e,i,s),s};let k=0,o=class extends x{constructor(){super(),this._internals=null,this.supportingText="",this.value="",this.name="",this.disabled=!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._activeIndex=-1,this._listboxId=`scb-search-listbox-${++k}`,this._kbMode=!1,this._valueOnFocus="",this._lastChangeValue="",this._kbShouldShowRing=!1,this._onGlobalKeydown=t=>{t.key==="Tab"&&(this._kbShouldShowRing=!0,this._inputFocused&&this._updateInputRingVisibility())},this._onGlobalPointerDown=()=>{this._kbShouldShowRing=!1,this._inputFocused&&this._updateInputRingVisibility()},this._form=null,this._formResetHandler=null,this._initialValue="",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._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()}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),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("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;return p`
1
+ import{a as y,n as c,i as x,E as g,x as p,t as w}from"../../vendor/vendor.js";import"../scb-list/scb-list.js";import"../../vendor/vendor-material.js";import"../../vendor/preload-helper.js";import"../scb-list/scb-list-item.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,r,s){try{customElements.get(i)||e(i,r,s)}catch(o){var n=String(o||"");if(n.indexOf("already been used")===-1&&n.indexOf("NotSupportedError")===-1)throw o}}}}catch{}})();var S=Object.defineProperty,A=Object.getOwnPropertyDescriptor,l=(t,e,i,r)=>{for(var s=r>1?void 0:r?A(e,i):e,n=t.length-1,o;n>=0;n--)(o=t[n])&&(s=(r?o(e,i,s):o(s))||s);return r&&s&&S(e,i,s),s};let k=0,a=class extends x{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._activeIndex=-1,this._listboxId=`scb-search-listbox-${++k}`,this._kbMode=!1,this._valueOnFocus="",this._lastChangeValue="",this._kbShouldShowRing=!1,this._onGlobalKeydown=t=>{t.key==="Tab"&&(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;return p`
2
2
  <div class="ripple-wrapper">
3
3
  <md-icon class="leading">${t?"arrow_back":"search"}</md-icon>
4
4
 
5
5
  <input
6
6
  id="searchInput"
7
7
  type="search"
8
- name=${this.name||"textfield"}
9
8
  class=${e?"with-list":""}
10
9
  .value=${this.value}
11
10
  placeholder=${this.supportingText}
12
11
  autocomplete=${this.autocomplete?"on":"off"}
13
12
  ?disabled=${this.disabled}
13
+ ?required=${this.required}
14
14
  @input=${this._onInput}
15
15
  @change=${this._onNativeChange}
16
16
  @focus=${this._onFocus}
@@ -27,7 +27,7 @@ import{a as y,n as c,i as x,E as b,x as p,t as w}from"../../vendor/vendor.js";im
27
27
  aria-label="Rensa sökfält"
28
28
  >
29
29
  <md-icon>close</md-icon>
30
- </button>`:this.trailingIcon?p`<span class="trailing"><md-icon>${this.trailingIcon}</md-icon></span>`:b}
30
+ </button>`:this.trailingIcon?p`<span class="trailing"><md-icon>${this.trailingIcon}</md-icon></span>`:g}
31
31
 
32
32
  <md-ripple></md-ripple>
33
33
  <md-focus-ring class="input-ring"></md-focus-ring>
@@ -40,8 +40,8 @@ import{a as y,n as c,i as x,E as b,x as p,t as w}from"../../vendor/vendor.js";im
40
40
  <slot @slotchange=${this._onSlotChange}></slot>
41
41
  </scb-list>
42
42
  <md-focus-ring id="optionRing" class="option-ring"></md-focus-ring>
43
- `:b}
44
- `}formDisabledCallback(t){this.disabled=t}submit(){const t=this._getActiveItem(),e={value:this.value};t&&(e.active=this._itemPayload(t)),this._dispatchSubmit(e)}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)}_onInput(t){t.stopPropagation();const e=t.target;this.value=e.value,this._syncFormValue(),this._filterSuggestions(this.value),this._activeIndex=-1,this._kbMode=!1,this._updateComboboxA11y();const i={value:this.value};this.dispatchEvent(new CustomEvent("scb-search-input",{detail:i,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("scbsearchinput",{detail:i,bubbles:!0,composed:!0})),this._dispatchStandardInput()}_onNativeChange(t){t.stopPropagation()}_onFocus(){this.disabled||(this._valueOnFocus=this.value??"",this._inputFocused=!0,this._updateInputRingVisibility(),this._filterSuggestions(this.value),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 t=this.renderRoot?.querySelector(".ripple-wrapper");t&&(this._inputFocused&&this._kbShouldShowRing?t.setAttribute("data-kb-focus","true"):t.removeAttribute("data-kb-focus"))}_handleKey(t){if(this.disabled||!this._inputEl())return;const i=this._getVisibleItems(),n=(this.value??"").trim().length>0,s=this._inputFocused&&n&&i.length>0,r=t.key,a=t.keyCode,h=r==="ArrowDown"||r==="Down"||a===40,d=r==="ArrowUp"||r==="Up"||a===38,g=r==="Home"||a===36,v=r==="End"||a===35,_=r==="Enter"||a===13,m=r==="Escape"||r==="Esc"||a===27;if(h){if(!s)return;t.preventDefault(),this._kbMode=!0,this._moveActive(i,1);return}if(d){if(!s)return;t.preventDefault(),this._kbMode=!0,this._moveActive(i,-1);return}if(g){if(!s)return;t.preventDefault(),this._kbMode=!0,this._activeIndex=i.length?0:-1,this._updateComboboxA11y(),this._scrollActiveIntoView();return}if(v){if(!s)return;t.preventDefault(),this._kbMode=!0,this._activeIndex=i.length?i.length-1:-1,this._updateComboboxA11y(),this._scrollActiveIntoView();return}if(_){if(!s){this.submit();return}t.preventDefault();const u=this._getActiveItem();if(u){const f=u.getAttribute("label")||"";this.value=f,this._syncFormValue(),this._dispatchStandardInput(),this._dispatchSubmit({value:this.value,active:this._itemPayload(u)}),this._visibleSuggestions=0,this._activeIndex=-1,this._kbMode=!1,this._hideOptionRing(),this.requestUpdate()}else this.submit();return}if(m){t.preventDefault(),this._clearInput();return}}_clearInput(){if(this.disabled)return;this.value="",this._activeIndex=-1,this._kbMode=!1;const t=this._inputEl();t&&(t.value="",t.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(t){const e=(t??"").trim().toLowerCase(),i=Array.from(this.querySelectorAll("scb-list-item"));let n=0;for(const s of i){const r=(s.getAttribute("label")||"").toLowerCase(),a=(s.getAttribute("supporting-text")||"").toLowerCase(),h=`${r} ${a}`.trim();e!==""&&h.includes(e)?(s.removeAttribute("hidden"),n++):s.setAttribute("hidden",""),this._ensureOptionA11y(s)}this._visibleSuggestions=n,this._activeIndex>=n&&(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 t=this._getVisibleItems();return this._activeIndex<0||this._activeIndex>=t.length?null:t[this._activeIndex]??null}_moveActive(t,e){if(!t.length){this._activeIndex=-1,this._updateComboboxA11y(),this._hideOptionRing();return}let i=this._activeIndex+e;this._activeIndex===-1?i=e>0?0:t.length-1:(i<0&&(i=0),i>=t.length&&(i=t.length-1)),this._activeIndex=i,this._updateComboboxA11y(),this._scrollActiveIntoView()}_scrollActiveIntoView(){const t=this._getActiveItem();t&&t.scrollIntoView({block:"nearest"})}_itemPayload(t){return{label:t.getAttribute("label")||"",supportingText:t.getAttribute("supporting-text")||"",href:t.getAttribute("href")||"",type:t.getAttribute("type")||"",id:t.id||""}}_ensureListboxA11y(){const t=this._listEl();t&&(t.id||(t.id=this._listboxId),t.setAttribute("role","listbox"),t.setAttribute("aria-label","Sökförslag")),Array.from(this.querySelectorAll("scb-list-item")).forEach(i=>this._ensureOptionA11y(i))}_ensureOptionA11y(t){t.id||(t.id=`${this._listboxId}-opt-${Math.random().toString(36).slice(2,8)}`),t.setAttribute("role","option"),t.setAttribute("tabindex","-1")}_updateComboboxA11y(){const t=this._inputEl();if(!t)return;const e=this._getVisibleItems(),i=(this.value??"").trim().length>0,n=this._inputFocused&&i&&e.length>0;t.setAttribute("role","combobox"),t.setAttribute("aria-autocomplete","list"),t.setAttribute("aria-controls",this._listboxId),t.setAttribute("aria-expanded",String(n));const s=n?this._getActiveItem():null;s?.id?t.setAttribute("aria-activedescendant",s.id):t.removeAttribute("aria-activedescendant"),this._kbMode&&s&&n?this._positionOptionRing(s):this._hideOptionRing()}_positionOptionRing(t){const e=this._ringEl(),i=this._listEl();if(!e||!i)return;const n=this.getBoundingClientRect(),s=t.getBoundingClientRect(),r=s.top-n.top,a=s.left-n.left,h=s.width,d=s.height;e.style.top=`${r}px`,e.style.left=`${a}px`,e.style.width=`${h}px`,e.style.height=`${d}px`,e.setAttribute("data-show","true")}_hideOptionRing(){const t=this._ringEl();t&&t.removeAttribute("data-show")}_onWindowResize(){const t=this._getActiveItem();this._kbMode&&t&&this._positionOptionRing(t)}_attachListScrollListener(){const t=this._listEl();!t||this._listWithHandler===t||(this._detachListScrollListener(),t.addEventListener("scroll",this._listScrollHandler,{passive:!0}),this._listWithHandler=t)}_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 t=this.value??"";t!==this._lastChangeValue&&(this._lastChangeValue=t,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))}_dispatchSubmit(t){this.dispatchEvent(new CustomEvent("scb-search-submit",{detail:t,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("scbsearchsubmit",{detail:t,bubbles:!0,composed:!0})),this._dispatchStandardChangeIfNeeded()}mapSpacingToken(t){if(!t)return;const e=String(t).trim();if(e)return/^\d+$/.test(e)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(e,10)))})`:e}applySpacing(){const t=this.mapSpacingToken(this.spacing),e=this.mapSpacingToken(this.spacingTop)??t,i=this.mapSpacingToken(this.spacingBottom)??t,n=this.mapSpacingToken(this.spacingLeft),s=this.mapSpacingToken(this.spacingRight);e?this.style.setProperty("--scb-search-spacing-block-start",e):this.style.removeProperty("--scb-search-spacing-block-start"),i?this.style.setProperty("--scb-search-spacing-block-end",i):this.style.removeProperty("--scb-search-spacing-block-end"),n?this.style.setProperty("--scb-search-spacing-inline-start",n):this.style.removeProperty("--scb-search-spacing-inline-start"),s?this.style.setProperty("--scb-search-spacing-inline-end",s):this.style.removeProperty("--scb-search-spacing-inline-end")}_syncFormValue(){if(!this._internals)return;const t=this.disabled?null:this.value;this._internals.setFormValue(t)}};o.formAssociated=!0;o.styles=y`
43
+ `:g}
44
+ `}formDisabledCallback(t){this.disabled=t}_getValidationMessage(){return this._customValidationMessage?this._customValidationMessage:this.required&&!(this.value??"").trim()?"Fyll i det här fältet.":""}_syncValidity(){const t=this._inputEl(),e=this.disabled?"":this._getValidationMessage();t&&(t.setCustomValidity(e),t.setAttribute("aria-invalid",e?"true":"false")),this._internals&&(e?this._internals.setValidity({valueMissing:!0},e,t??void 0):this._internals.setValidity({})),this.toggleAttribute("aria-invalid",!!e)}checkValidity(){return!this._getValidationMessage()}reportValidity(){this._syncValidity();const t=this._inputEl();return t?t.reportValidity():this._internals?this._internals.reportValidity():this.checkValidity()}setCustomValidity(t){this._customValidationMessage=t,this._syncValidity()}get validity(){return this._internals?.validity}get validationMessage(){return this._internals?.validationMessage??this._getValidationMessage()}get willValidate(){return this._internals?.willValidate??!0}submit(){const t=this._getActiveItem(),e={value:this.value};t&&(e.active=this._itemPayload(t)),this._dispatchSubmit(e)}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)}_onInput(t){t.stopPropagation();const e=t.target;this.value=e.value,this._syncFormValue(),this._filterSuggestions(this.value),this._activeIndex=-1,this._kbMode=!1,this._updateComboboxA11y();const i={value:this.value};this.dispatchEvent(new CustomEvent("scb-search-input",{detail:i,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("scbsearchinput",{detail:i,bubbles:!0,composed:!0})),this._dispatchStandardInput()}_onNativeChange(t){t.stopPropagation()}_onFocus(){this.disabled||(this._valueOnFocus=this.value??"",this._inputFocused=!0,this._updateInputRingVisibility(),this._filterSuggestions(this.value),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 t=this.renderRoot?.querySelector(".ripple-wrapper");t&&(this._inputFocused&&this._kbShouldShowRing?t.setAttribute("data-kb-focus","true"):t.removeAttribute("data-kb-focus"))}_handleKey(t){if(this.disabled||!this._inputEl())return;const i=this._getVisibleItems(),r=(this.value??"").trim().length>0,s=this._inputFocused&&r&&i.length>0,n=t.key,o=t.keyCode,h=n==="ArrowDown"||n==="Down"||o===40,d=n==="ArrowUp"||n==="Up"||o===38,v=n==="Home"||o===36,_=n==="End"||o===35,m=n==="Enter"||o===13,f=n==="Escape"||n==="Esc"||o===27;if(h){if(!s)return;t.preventDefault(),this._kbMode=!0,this._moveActive(i,1);return}if(d){if(!s)return;t.preventDefault(),this._kbMode=!0,this._moveActive(i,-1);return}if(v){if(!s)return;t.preventDefault(),this._kbMode=!0,this._activeIndex=i.length?0:-1,this._updateComboboxA11y(),this._scrollActiveIntoView();return}if(_){if(!s)return;t.preventDefault(),this._kbMode=!0,this._activeIndex=i.length?i.length-1:-1,this._updateComboboxA11y(),this._scrollActiveIntoView();return}if(m){if(!s){const u=this._internals?.form??this._form??this.closest("form");u?(t.preventDefault(),this.reportValidity()&&u.requestSubmit()):this.submit();return}t.preventDefault();const b=this._getActiveItem();if(b){const u=b.getAttribute("label")||"";this.value=u,this._syncFormValue(),this._dispatchStandardInput(),this._dispatchSubmit({value:this.value,active:this._itemPayload(b)}),this._visibleSuggestions=0,this._activeIndex=-1,this._kbMode=!1,this._hideOptionRing(),this.requestUpdate()}else this.submit();return}if(f){t.preventDefault(),this._clearInput();return}}_clearInput(){if(this.disabled)return;this.value="",this._activeIndex=-1,this._kbMode=!1;const t=this._inputEl();t&&(t.value="",t.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(t){const e=(t??"").trim().toLowerCase(),i=Array.from(this.querySelectorAll("scb-list-item"));let r=0;for(const s of i){const n=(s.getAttribute("label")||"").toLowerCase(),o=(s.getAttribute("supporting-text")||"").toLowerCase(),h=`${n} ${o}`.trim();e!==""&&h.includes(e)?(s.removeAttribute("hidden"),r++):s.setAttribute("hidden",""),this._ensureOptionA11y(s)}this._visibleSuggestions=r,this._activeIndex>=r&&(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 t=this._getVisibleItems();return this._activeIndex<0||this._activeIndex>=t.length?null:t[this._activeIndex]??null}_moveActive(t,e){if(!t.length){this._activeIndex=-1,this._updateComboboxA11y(),this._hideOptionRing();return}let i=this._activeIndex+e;this._activeIndex===-1?i=e>0?0:t.length-1:(i<0&&(i=0),i>=t.length&&(i=t.length-1)),this._activeIndex=i,this._updateComboboxA11y(),this._scrollActiveIntoView()}_scrollActiveIntoView(){const t=this._getActiveItem();t&&t.scrollIntoView({block:"nearest"})}_itemPayload(t){return{label:t.getAttribute("label")||"",supportingText:t.getAttribute("supporting-text")||"",href:t.getAttribute("href")||"",type:t.getAttribute("type")||"",id:t.id||""}}_ensureListboxA11y(){const t=this._listEl();t&&(t.id||(t.id=this._listboxId),t.setAttribute("role","listbox"),t.setAttribute("aria-label","Sökförslag")),Array.from(this.querySelectorAll("scb-list-item")).forEach(i=>this._ensureOptionA11y(i))}_ensureOptionA11y(t){t.id||(t.id=`${this._listboxId}-opt-${Math.random().toString(36).slice(2,8)}`),t.setAttribute("role","option"),t.setAttribute("tabindex","-1")}_updateComboboxA11y(){const t=this._inputEl();if(!t)return;const e=this._getVisibleItems(),i=(this.value??"").trim().length>0,r=this._inputFocused&&i&&e.length>0;t.setAttribute("role","combobox"),t.setAttribute("aria-autocomplete","list"),t.setAttribute("aria-controls",this._listboxId),t.setAttribute("aria-expanded",String(r));const s=r?this._getActiveItem():null;s?.id?t.setAttribute("aria-activedescendant",s.id):t.removeAttribute("aria-activedescendant"),this._kbMode&&s&&r?this._positionOptionRing(s):this._hideOptionRing()}_positionOptionRing(t){const e=this._ringEl(),i=this._listEl();if(!e||!i)return;const r=this.getBoundingClientRect(),s=t.getBoundingClientRect(),n=s.top-r.top,o=s.left-r.left,h=s.width,d=s.height;e.style.top=`${n}px`,e.style.left=`${o}px`,e.style.width=`${h}px`,e.style.height=`${d}px`,e.setAttribute("data-show","true")}_hideOptionRing(){const t=this._ringEl();t&&t.removeAttribute("data-show")}_onWindowResize(){const t=this._getActiveItem();this._kbMode&&t&&this._positionOptionRing(t)}_attachListScrollListener(){const t=this._listEl();!t||this._listWithHandler===t||(this._detachListScrollListener(),t.addEventListener("scroll",this._listScrollHandler,{passive:!0}),this._listWithHandler=t)}_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 t=this.value??"";t!==this._lastChangeValue&&(this._lastChangeValue=t,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))}_dispatchSubmit(t){this.dispatchEvent(new CustomEvent("scb-search-submit",{detail:t,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("scbsearchsubmit",{detail:t,bubbles:!0,composed:!0})),this._dispatchStandardChangeIfNeeded()}mapSpacingToken(t){if(!t)return;const e=String(t).trim();if(e)return/^\d+$/.test(e)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(e,10)))})`:e}applySpacing(){const t=this.mapSpacingToken(this.spacing),e=this.mapSpacingToken(this.spacingTop)??t,i=this.mapSpacingToken(this.spacingBottom)??t,r=this.mapSpacingToken(this.spacingLeft),s=this.mapSpacingToken(this.spacingRight);e?this.style.setProperty("--scb-search-spacing-block-start",e):this.style.removeProperty("--scb-search-spacing-block-start"),i?this.style.setProperty("--scb-search-spacing-block-end",i):this.style.removeProperty("--scb-search-spacing-block-end"),r?this.style.setProperty("--scb-search-spacing-inline-start",r):this.style.removeProperty("--scb-search-spacing-inline-start"),s?this.style.setProperty("--scb-search-spacing-inline-end",s):this.style.removeProperty("--scb-search-spacing-inline-end")}_syncFormValue(){if(!this._internals)return;const t=this.disabled?null:this.value;this._internals.setFormValue(t)}};a.formAssociated=!0;a.styles=y`
45
45
  :host {
46
46
  display: flex;
47
47
  flex-direction: column;
@@ -289,4 +289,4 @@ import{a as y,n as c,i as x,E as b,x as p,t as w}from"../../vendor/vendor.js";im
289
289
  color: var(--md-sys-color-on-surface);
290
290
  }
291
291
  }
292
- `;l([c({type:String,attribute:"trailing-icon"})],o.prototype,"trailingIcon",2);l([c({type:String,attribute:"supporting-text"})],o.prototype,"supportingText",2);l([c({type:String})],o.prototype,"value",2);l([c({type:String,reflect:!0})],o.prototype,"name",2);l([c({type:Boolean,reflect:!0})],o.prototype,"disabled",2);l([c({type:Boolean,reflect:!0})],o.prototype,"autocomplete",2);l([c({type:String,reflect:!0})],o.prototype,"spacing",2);l([c({type:String,attribute:"spacing-top",reflect:!0})],o.prototype,"spacingTop",2);l([c({type:String,attribute:"spacing-bottom",reflect:!0})],o.prototype,"spacingBottom",2);l([c({type:String,attribute:"spacing-left",reflect:!0})],o.prototype,"spacingLeft",2);l([c({type:String,attribute:"spacing-right",reflect:!0})],o.prototype,"spacingRight",2);l([c({type:String,reflect:!0})],o.prototype,"size",2);l([c({type:Boolean,attribute:"full-screen",reflect:!0})],o.prototype,"fullScreen",2);o=l([w("scb-search")],o);
292
+ `;l([c({type:String,attribute:"trailing-icon"})],a.prototype,"trailingIcon",2);l([c({type:String,attribute:"supporting-text"})],a.prototype,"supportingText",2);l([c({type:String})],a.prototype,"value",2);l([c({type:String,reflect:!0})],a.prototype,"name",2);l([c({type:Boolean,reflect:!0})],a.prototype,"disabled",2);l([c({type:Boolean,reflect:!0})],a.prototype,"required",2);l([c({type:Boolean,reflect:!0})],a.prototype,"autocomplete",2);l([c({type:String,reflect:!0})],a.prototype,"spacing",2);l([c({type:String,attribute:"spacing-top",reflect:!0})],a.prototype,"spacingTop",2);l([c({type:String,attribute:"spacing-bottom",reflect:!0})],a.prototype,"spacingBottom",2);l([c({type:String,attribute:"spacing-left",reflect:!0})],a.prototype,"spacingLeft",2);l([c({type:String,attribute:"spacing-right",reflect:!0})],a.prototype,"spacingRight",2);l([c({type:String,reflect:!0})],a.prototype,"size",2);l([c({type:Boolean,attribute:"full-screen",reflect:!0})],a.prototype,"fullScreen",2);a=l([w("scb-search")],a);