scb-wc 0.1.108 → 0.1.110

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,4 +1,4 @@
1
- import{f as l,h as D,m as k,p as m,v as c,y as x}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import"../../vendor/icon.js";import"../../vendor/ripple.js";import{addLazyFocusRingListeners as $}from"../shared/lazy-focus-ring.js";import{t as h}from"../../vendor/decorate.js";import"../scb-button/scb-button.js";import"../scb-icon-button/scb-icon-button.js";import"../scb-divider/scb-divider.js";(function(){try{var g=typeof globalThis<"u"?globalThis:window;if(!g.__scb_ce_guard_installed__){g.__scb_ce_guard_installed__=!0;var t=customElements.define.bind(customElements);customElements.define=function(e,o,d){try{customElements.get(e)||t(e,o,d)}catch(r){var a=String(r||"");if(a.indexOf("already been used")===-1&&a.indexOf("NotSupportedError")===-1)throw r}}}}catch{}})();var w,p=(w=class extends D{constructor(...t){super(...t),this._currentDate=new Date,this._selectedDate=null,this._showMonthDropdown=!1,this._showYearDropdown=!1,this.variant="date",this.lang="sv",this.selectedValue="",this.open=!0,this._selectedHour=0,this._selectedMinute=0,this._viewportMargin=8,this._popupOffset=4,this._onWindowReposition=()=>{this._positionPopupWithinViewport()},this._monthNames=[this.lang=="sv"?"Januari":"January",this.lang=="sv"?"Februari":"February",this.lang=="sv"?"Mars":"March",(this.lang=="sv","April"),this.lang=="sv"?"Maj":"May",this.lang=="sv"?"Juni":"June",this.lang=="sv"?"Juli":"July",this.lang=="sv"?"Augusti":"August",(this.lang=="sv","September"),this.lang=="sv"?"Oktober":"October",(this.lang=="sv","November"),(this.lang=="sv","December")],this._outsideClickHandler=e=>{this.open&&(e.composedPath().includes(this)||this._close())},this._prevMonth=()=>{const e=this._currentDate.getFullYear(),o=this._currentDate.getMonth();o===0?this._currentDate=new Date(e-1,11,1):this._currentDate=new Date(e,o-1,1)},this._prevYear=()=>{const e=this._currentDate.getFullYear(),o=this._currentDate.getMonth();this._currentDate=new Date(e-1,o,1)},this._nextMonth=()=>{const e=this._currentDate.getFullYear(),o=this._currentDate.getMonth();o===11?this._currentDate=new Date(e+1,0,1):this._currentDate=new Date(e,o+1,1)},this._nextYear=()=>{const e=this._currentDate.getFullYear(),o=this._currentDate.getMonth();this._currentDate=new Date(e+1,o,1)},this._onTimeChange=e=>{const[o,d]=e.target.value.split(":"),a=parseInt(o,10),r=parseInt(d,10);this._selectedHour=isNaN(a)?0:Math.max(0,Math.min(23,a)),this._selectedMinute=isNaN(r)?0:Math.max(0,Math.min(59,r)),this._fireDateTimeChange()},this._close=()=>{this.open=!1,this.dispatchEvent(new CustomEvent("datepicker-closed",{bubbles:!0,composed:!0}))}}_isRenderedInsideDialog(){const t=this.getRootNode(),e=t instanceof ShadowRoot?t.host:null;return e instanceof HTMLElement&&e.closest("scb-dialog")?!0:!!this.closest("scb-dialog")}connectedCallback(){super.connectedCallback(),this._removeLazyFocusRingListeners=$(this,this.renderRoot)}_positionPopupWithinViewport(){if(!this.open)return;const t=this.renderRoot.querySelector(".datepicker-popup");if(!t)return;const e=this.parentElement?.getBoundingClientRect();if(!e)return;const o=window.innerWidth,d=window.innerHeight,a=Math.max(220,o-this._viewportMargin*2);if(this._isRenderedInsideDialog()){const v=Math.min(t.offsetWidth||380,a),b=t.offsetHeight||420,f=(o-v)/2,y=(d-b)/2;this.style.setProperty("--scb-datepicker-position","fixed"),this.style.setProperty("--scb-datepicker-top",`${y}px`),this.style.setProperty("--scb-datepicker-bottom","auto"),this.style.setProperty("--scb-datepicker-left",`${f}px`),this.style.setProperty("--scb-datepicker-transform","none"),this.style.setProperty("--scb-datepicker-computed-width",`${v}px`),this.style.setProperty("--scb-datepicker-max-height",`${Math.max(220,d-this._viewportMargin*2)}px`);return}const r=Math.min(t.offsetWidth||380,a),s=t.offsetHeight||420,i=Math.min(Math.max(e.left,this._viewportMargin),o-this._viewportMargin-r),n=d-e.bottom-this._viewportMargin,u=e.top-this._viewportMargin,_=n<s+this._popupOffset&&u>n;this.style.setProperty("--scb-datepicker-position","fixed"),this.style.setProperty("--scb-datepicker-computed-width",`${r}px`),this.style.setProperty("--scb-datepicker-left",`${i}px`),this.style.setProperty("--scb-datepicker-transform","none"),_?(this.style.setProperty("--scb-datepicker-top",`${Math.max(this._viewportMargin,e.top-s-this._popupOffset)}px`),this.style.setProperty("--scb-datepicker-bottom","auto"),this.style.setProperty("--scb-datepicker-max-height",`${Math.max(0,u-this._popupOffset)}px`)):(this.style.setProperty("--scb-datepicker-top",`${e.bottom+this._popupOffset}px`),this.style.setProperty("--scb-datepicker-bottom","auto"),this.style.setProperty("--scb-datepicker-max-height",`${Math.max(0,n-this._popupOffset)}px`))}updated(t){if(super.updated(t),this.open?(window.addEventListener("mousedown",this._outsideClickHandler),window.addEventListener("resize",this._onWindowReposition,{passive:!0}),window.addEventListener("scroll",this._onWindowReposition,{passive:!0,capture:!0}),requestAnimationFrame(()=>this._positionPopupWithinViewport())):(window.removeEventListener("mousedown",this._outsideClickHandler),window.removeEventListener("resize",this._onWindowReposition),window.removeEventListener("scroll",this._onWindowReposition,!0)),t.has("selectedValue")&&this.selectedValue){const e=new Date(this.selectedValue);isNaN(e.getTime())||(this._selectedDate=e,this._currentDate=new Date(e.getFullYear(),e.getMonth(),1),this.variant==="datetime-local"&&(this._selectedHour=e.getHours(),this._selectedMinute=e.getMinutes()))}this.open&&requestAnimationFrame(()=>this._positionPopupWithinViewport())}disconnectedCallback(){this._removeLazyFocusRingListeners?.(),this._removeLazyFocusRingListeners=void 0,window.removeEventListener("mousedown",this._outsideClickHandler),window.removeEventListener("resize",this._onWindowReposition),window.removeEventListener("scroll",this._onWindowReposition,!0),super.disconnectedCallback()}render(){if(!this.open)return c``;const t=this._currentDate.getFullYear(),e=this._currentDate.getMonth(),o=new Date,d=this._getMonthDays(t,e),a=Array.from({length:101},(s,i)=>o.getFullYear()-50+i),r=this.variant==="datetime-local"&&!this._showMonthDropdown&&!this._showYearDropdown;return c`
1
+ import{f as l,h as M,m as $,p as m,v as d,y as Y}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import"../../vendor/icon.js";import"../../vendor/ripple.js";import{addLazyFocusRingListeners as C}from"../shared/lazy-focus-ring.js";import{t as h}from"../../vendor/decorate.js";import"../scb-button/scb-button.js";import"../scb-icon-button/scb-icon-button.js";import"../scb-divider/scb-divider.js";(function(){try{var g=typeof globalThis<"u"?globalThis:window;if(!g.__scb_ce_guard_installed__){g.__scb_ce_guard_installed__=!0;var e=customElements.define.bind(customElements);customElements.define=function(t,s,c){try{customElements.get(t)||e(t,s,c)}catch(r){var a=String(r||"");if(a.indexOf("already been used")===-1&&a.indexOf("NotSupportedError")===-1)throw r}}}}catch{}})();var v,p=(v=class extends M{constructor(...e){super(...e),this._currentDate=new Date,this._selectedDate=null,this._showMonthDropdown=!1,this._showYearDropdown=!1,this.variant="date",this.lang="sv",this.selectedValue="",this.open=!0,this._selectedHour=0,this._selectedMinute=0,this._viewportMargin=8,this._popupOffset=4,this._onWindowReposition=()=>{this._positionPopupWithinViewport()},this._monthNames=[this.lang=="sv"?"Januari":"January",this.lang=="sv"?"Februari":"February",this.lang=="sv"?"Mars":"March",(this.lang=="sv","April"),this.lang=="sv"?"Maj":"May",this.lang=="sv"?"Juni":"June",this.lang=="sv"?"Juli":"July",this.lang=="sv"?"Augusti":"August",(this.lang=="sv","September"),this.lang=="sv"?"Oktober":"October",(this.lang=="sv","November"),(this.lang=="sv","December")],this._outsideClickHandler=t=>{this.open&&(t.composedPath().includes(this)||this._close())},this._prevMonth=()=>{const t=this._currentDate.getFullYear(),s=this._currentDate.getMonth();s===0?this._currentDate=new Date(t-1,11,1):this._currentDate=new Date(t,s-1,1)},this._prevYear=()=>{const t=this._currentDate.getFullYear(),s=this._currentDate.getMonth();this._currentDate=new Date(t-1,s,1)},this._nextMonth=()=>{const t=this._currentDate.getFullYear(),s=this._currentDate.getMonth();s===11?this._currentDate=new Date(t+1,0,1):this._currentDate=new Date(t,s+1,1)},this._nextYear=()=>{const t=this._currentDate.getFullYear(),s=this._currentDate.getMonth();this._currentDate=new Date(t+1,s,1)},this._onTimeChange=t=>{const[s,c]=t.target.value.split(":"),a=parseInt(s,10),r=parseInt(c,10);this._selectedHour=isNaN(a)?0:Math.max(0,Math.min(23,a)),this._selectedMinute=isNaN(r)?0:Math.max(0,Math.min(59,r)),this._fireDateTimeChange()},this._close=()=>{this.open=!1,this.dispatchEvent(new CustomEvent("datepicker-closed",{bubbles:!0,composed:!0}))}}_isRenderedInsideDialog(){const e=this.getRootNode(),t=e instanceof ShadowRoot?e.host:null;return t instanceof HTMLElement&&t.closest("scb-dialog")?!0:!!this.closest("scb-dialog")}connectedCallback(){super.connectedCallback(),this._removeLazyFocusRingListeners=C(this,this.renderRoot)}_positionPopupWithinViewport(){if(!this.open)return;const e=this.renderRoot.querySelector(".datepicker-popup");if(!e)return;const t=this.parentElement?.getBoundingClientRect();if(!t)return;const s=window.innerWidth,c=window.innerHeight,a=Math.max(220,s-this._viewportMargin*2);if(this._isRenderedInsideDialog()){const _=Math.min(e.offsetWidth||380,a),b=e.offsetHeight||420,D=Math.min(Math.max(t.left,this._viewportMargin),s-this._viewportMargin-_),w=c-t.bottom-this._viewportMargin,f=t.top-this._viewportMargin,k=w<b+this._popupOffset&&f>w;if(this.style.setProperty("--scb-datepicker-position","absolute"),this.style.setProperty("--scb-datepicker-computed-width",`${_}px`),this.style.setProperty("--scb-datepicker-left",`${D-t.left}px`),this.style.setProperty("--scb-datepicker-transform","none"),this.style.setProperty("--scb-datepicker-bottom","auto"),k){const x=Math.max(this._viewportMargin,t.top-b-this._popupOffset)-t.top;this.style.setProperty("--scb-datepicker-top",`${x}px`),this.style.setProperty("--scb-datepicker-max-height",`${Math.max(0,f-this._popupOffset)}px`)}else this.style.setProperty("--scb-datepicker-top",`${t.height+this._popupOffset}px`),this.style.setProperty("--scb-datepicker-max-height",`${Math.max(0,w-this._popupOffset)}px`);return}const r=Math.min(e.offsetWidth||380,a),o=e.offsetHeight||420,i=Math.min(Math.max(t.left,this._viewportMargin),s-this._viewportMargin-r),n=c-t.bottom-this._viewportMargin,u=t.top-this._viewportMargin,y=n<o+this._popupOffset&&u>n;this.style.setProperty("--scb-datepicker-position","fixed"),this.style.setProperty("--scb-datepicker-computed-width",`${r}px`),this.style.setProperty("--scb-datepicker-left",`${i}px`),this.style.setProperty("--scb-datepicker-transform","none"),y?(this.style.setProperty("--scb-datepicker-top",`${Math.max(this._viewportMargin,t.top-o-this._popupOffset)}px`),this.style.setProperty("--scb-datepicker-bottom","auto"),this.style.setProperty("--scb-datepicker-max-height",`${Math.max(0,u-this._popupOffset)}px`)):(this.style.setProperty("--scb-datepicker-top",`${t.bottom+this._popupOffset}px`),this.style.setProperty("--scb-datepicker-bottom","auto"),this.style.setProperty("--scb-datepicker-max-height",`${Math.max(0,n-this._popupOffset)}px`))}updated(e){if(super.updated(e),this.open?(window.addEventListener("mousedown",this._outsideClickHandler),window.addEventListener("resize",this._onWindowReposition,{passive:!0}),window.addEventListener("scroll",this._onWindowReposition,{passive:!0,capture:!0}),requestAnimationFrame(()=>this._positionPopupWithinViewport())):(window.removeEventListener("mousedown",this._outsideClickHandler),window.removeEventListener("resize",this._onWindowReposition),window.removeEventListener("scroll",this._onWindowReposition,!0)),e.has("selectedValue")&&this.selectedValue){const t=new Date(this.selectedValue);isNaN(t.getTime())||(this._selectedDate=t,this._currentDate=new Date(t.getFullYear(),t.getMonth(),1),this.variant==="datetime-local"&&(this._selectedHour=t.getHours(),this._selectedMinute=t.getMinutes()))}this.open&&requestAnimationFrame(()=>this._positionPopupWithinViewport())}disconnectedCallback(){this._removeLazyFocusRingListeners?.(),this._removeLazyFocusRingListeners=void 0,window.removeEventListener("mousedown",this._outsideClickHandler),window.removeEventListener("resize",this._onWindowReposition),window.removeEventListener("scroll",this._onWindowReposition,!0),super.disconnectedCallback()}render(){if(!this.open)return d``;const e=this._currentDate.getFullYear(),t=this._currentDate.getMonth(),s=new Date,c=this._getMonthDays(e,t),a=Array.from({length:101},(o,i)=>s.getFullYear()-50+i),r=this.variant==="datetime-local"&&!this._showMonthDropdown&&!this._showYearDropdown;return d`
2
2
  <div class="datepicker-popup popup">
3
3
  <div class="header">
4
4
  <div class="month-selector ${this._showMonthDropdown?"open":""} ${this._showYearDropdown?"disable":""}">
@@ -8,9 +8,9 @@ import{f as l,h as D,m as k,p as m,v as c,y as x}from"../../vendor/vendor.js";im
8
8
  tabindex=${this._showYearDropdown?-1:0}
9
9
  class="dropdown-selected"
10
10
  @click=${()=>this._toggleMonthDropdown()}
11
- @keydown=${s=>{(s.key==="Enter"||s.key===" ")&&(s.preventDefault(),this._toggleMonthDropdown())}}
11
+ @keydown=${o=>{(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),this._toggleMonthDropdown())}}
12
12
  >
13
- ${this._monthNames[e].slice(0,3)}
13
+ ${this._monthNames[t].slice(0,3)}
14
14
  <md-icon>arrow_drop_down</md-icon>
15
15
  <md-focus-ring></md-focus-ring>
16
16
  <md-ripple></md-ripple>
@@ -25,9 +25,9 @@ import{f as l,h as D,m as k,p as m,v as c,y as x}from"../../vendor/vendor.js";im
25
25
  tabindex=${this._showMonthDropdown?-1:0}
26
26
  class="dropdown-selected"
27
27
  @click=${()=>this._toggleYearDropdown()}
28
- @keydown=${s=>{(s.key==="Enter"||s.key===" ")&&(s.preventDefault(),this._toggleYearDropdown())}}
28
+ @keydown=${o=>{(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),this._toggleYearDropdown())}}
29
29
  >
30
- ${t}
30
+ ${e}
31
31
  <md-icon>arrow_drop_down</md-icon>
32
32
  <md-focus-ring></md-focus-ring>
33
33
  <md-ripple></md-ripple>
@@ -36,43 +36,43 @@ import{f as l,h as D,m as k,p as m,v as c,y as x}from"../../vendor/vendor.js";im
36
36
  <scb-icon-button icon="chevron_right" @click=${this._nextYear} aria-label=${this.lang=="sv"?"Nästa år":"Next year"}></scb-icon-button>
37
37
  </div>
38
38
  </div>
39
- ${this._showMonthDropdown||this._showYearDropdown?c`<scb-divider></scb-divider>`:""}
39
+ ${this._showMonthDropdown||this._showYearDropdown?d`<scb-divider></scb-divider>`:""}
40
40
  <div class="datepicker-content" style="position:relative;">
41
- ${this._showMonthDropdown?c`
41
+ ${this._showMonthDropdown?d`
42
42
  <div class="dropdown-list">
43
- ${this._monthNames.map((s,i)=>c`
43
+ ${this._monthNames.map((o,i)=>d`
44
44
  <div
45
45
  @keydown=${n=>{(n.key==="Enter"||n.key===" ")&&(n.preventDefault(),this._onMonthChangeCustom(i))}}
46
46
  tabindex="0"
47
- class="dropdown-item${i===e?" selected":""}"
47
+ class="dropdown-item${i===t?" selected":""}"
48
48
  @click=${()=>this._onMonthChangeCustom(i)}
49
- id=${i===e?"selected-month":""}
49
+ id=${i===t?"selected-month":""}
50
50
  >
51
- ${i===e?c`<md-icon>check</md-icon>`:""}
52
- ${s}
51
+ ${i===t?d`<md-icon>check</md-icon>`:""}
52
+ ${o}
53
53
  <md-ripple></md-ripple><md-focus-ring inward></md-focus-ring>
54
54
  </div>
55
55
  `)}
56
56
  </div>
57
57
  `:""}
58
- ${this._showYearDropdown?c`
58
+ ${this._showYearDropdown?d`
59
59
  <div class="dropdown-list">
60
- ${a.map(s=>c`
60
+ ${a.map(o=>d`
61
61
  <div
62
- @keydown=${i=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),this._onYearChangeCustom(s))}}
62
+ @keydown=${i=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),this._onYearChangeCustom(o))}}
63
63
  tabindex="0"
64
- class="dropdown-item${s===t?" selected":""}"
65
- @click=${()=>this._onYearChangeCustom(s)}
66
- id=${s===t?"selected-year":""}
64
+ class="dropdown-item${o===e?" selected":""}"
65
+ @click=${()=>this._onYearChangeCustom(o)}
66
+ id=${o===e?"selected-year":""}
67
67
  >
68
- ${s===t?c`<md-icon>check</md-icon>`:""}
69
- ${s}
68
+ ${o===e?d`<md-icon>check</md-icon>`:""}
69
+ ${o}
70
70
  <md-ripple></md-ripple><md-focus-ring inward></md-focus-ring>
71
71
  </div>
72
72
  `)}
73
73
  </div>
74
74
  `:""}
75
- ${!this._showMonthDropdown&&!this._showYearDropdown?c`
75
+ ${!this._showMonthDropdown&&!this._showYearDropdown?d`
76
76
  <div class="datepicker-calendar">
77
77
  <table>
78
78
  <thead>
@@ -81,19 +81,19 @@ import{f as l,h as D,m as k,p as m,v as c,y as x}from"../../vendor/vendor.js";im
81
81
  </tr>
82
82
  </thead>
83
83
  <tbody>
84
- ${d.map(s=>c`
84
+ ${c.map(o=>d`
85
85
  <tr>
86
- ${s.map(i=>i?c`
86
+ ${o.map(i=>i?d`
87
87
  <td>
88
88
  <div
89
89
  @keydown=${n=>{(n.key==="Enter"||n.key===" ")&&(n.preventDefault(),this._selectDate(i))}}
90
90
  role="button"
91
91
  tabindex="0"
92
- class="day${this._isToday(i,o)?" today":""}${this._isSelected(i)?" selected":""}"
92
+ class="day${this._isToday(i,s)?" today":""}${this._isSelected(i)?" selected":""}"
93
93
  @click=${()=>this._selectDate(i)}
94
94
  >${i.getDate()}<md-ripple></md-ripple><md-focus-ring></md-focus-ring></div>
95
95
  </td>
96
- `:c`<td></td>`)}
96
+ `:d`<td></td>`)}
97
97
  </tr>
98
98
  `)}
99
99
  </tbody>
@@ -101,7 +101,7 @@ import{f as l,h as D,m as k,p as m,v as c,y as x}from"../../vendor/vendor.js";im
101
101
  </div>
102
102
  `:""}
103
103
  </div>
104
- ${r?c`
104
+ ${r?d`
105
105
  <div style="padding: 0 24px;">
106
106
  <label style="display:flex;align-items:center;gap:8px;">
107
107
  <span>${this.lang=="sv"?"Tid:":"Time:"}</span>
@@ -110,9 +110,9 @@ import{f as l,h as D,m as k,p as m,v as c,y as x}from"../../vendor/vendor.js";im
110
110
  </div>
111
111
  `:""}
112
112
  <div class="datepicker-footer">
113
- ${!this._showMonthDropdown&&!this._showYearDropdown?c`
113
+ ${!this._showMonthDropdown&&!this._showYearDropdown?d`
114
114
  <scb-button variant="text" label=${this.lang=="sv"?"Stäng":"Close"} @click=${this._close}></scb-button>
115
115
  `:""}
116
116
  </div>
117
117
  </div>
118
- `}_getMonthDays(t,e){const o=new Date(Date.UTC(t,e,1)),d=new Date(Date.UTC(t,e+1,0)),a=[];let r=[],s=o.getUTCDay(),i=s===0?6:s-1;for(let n=0;n<i;n++)r.push(null);for(let n=1;n<=d.getUTCDate();n++){const u=new Date(Date.UTC(t,e,n));r.push(u),r.length===7&&(a.push(r),r=[])}if(r.length){for(;r.length<7;)r.push(null);a.push(r)}return a}_toggleMonthDropdown(){this._showMonthDropdown=!this._showMonthDropdown,this._showMonthDropdown&&(this._showYearDropdown=!1,setTimeout(()=>{const t=this.renderRoot.querySelector("#selected-month");t&&t.scrollIntoView({block:"center"})},0))}_toggleYearDropdown(){this._showYearDropdown=!this._showYearDropdown,this._showYearDropdown&&(this._showMonthDropdown=!1,setTimeout(()=>{const t=this.renderRoot.querySelector("#selected-year");t&&t.scrollIntoView({block:"center"})},0))}_onMonthChangeCustom(t){const e=this._currentDate.getFullYear();this._currentDate=new Date(e,t,1),this._showMonthDropdown=!1}_onYearChangeCustom(t){const e=this._currentDate.getMonth();this._currentDate=new Date(t,e,1),this._showYearDropdown=!1}_isToday(t,e){return t.getDate()===e.getDate()&&t.getMonth()===e.getMonth()&&t.getFullYear()===e.getFullYear()}_isSelected(t){return this._selectedDate&&t.getDate()===this._selectedDate.getDate()&&t.getMonth()===this._selectedDate.getMonth()&&t.getFullYear()===this._selectedDate.getFullYear()}_selectDate(t){if(this._selectedDate=t,this.variant==="datetime-local"){const e=new Date(t);e.setHours(this._selectedHour??0,this._selectedMinute??0,0,0),this._selectedHour=e.getHours(),this._selectedMinute=e.getMinutes();const o=a=>a.toString().padStart(2,"0"),d=`${e.getFullYear()}-${o(e.getMonth()+1)}-${o(e.getDate())} ${o(e.getHours())}:${o(e.getMinutes())}`;this.dispatchEvent(new CustomEvent("date-selected",{detail:{value:d},bubbles:!0,composed:!0}))}else{const e=t.toISOString().slice(0,10);this.dispatchEvent(new CustomEvent("date-selected",{detail:{value:e},bubbles:!0,composed:!0}))}}_fireDateTimeChange(){if(this.variant==="datetime-local"&&this._selectedDate){const t=new Date(this._selectedDate);t.setHours(this._selectedHour??0,this._selectedMinute??0,0,0);const e=d=>d.toString().padStart(2,"0"),o=`${t.getFullYear()}-${e(t.getMonth()+1)}-${e(t.getDate())} ${e(t.getHours())}:${e(t.getMinutes())}`;this.dispatchEvent(new CustomEvent("date-selected",{detail:{value:o},bubbles:!0,composed:!0}))}}},w.styles=[x`:host{--scb-datepicker-width:380px;--scb-datepicker-z-index:1100;--scb-datepicker-viewport-margin:8px;--scb-datepicker-offset:var(--spacing-2, 4px);max-width:var(--scb-datepicker-computed-width, min(var(--scb-datepicker-width), calc(100vw - (var(--scb-datepicker-viewport-margin) * 2))));font-family:var(--brand-font);color:var(--md-sys-color-on-surface);display:block;position:var(--scb-datepicker-position, fixed);top:var(--scb-datepicker-top, calc(100% + var(--scb-datepicker-offset)));bottom:var(--scb-datepicker-bottom, auto);left:var(--scb-datepicker-left, 0);width:var(--scb-datepicker-computed-width, min(var(--scb-datepicker-width), calc(100vw - (var(--scb-datepicker-viewport-margin) * 2))));transform:var(--scb-datepicker-transform, translateX(0px));z-index:var(--scb-datepicker-z-index)}.dropdown-selected,.month-selector,.year-selector{display:flex;align-items:center}.dropdown-selected{position:relative;border-radius:8px;font-size:16px;cursor:pointer;text-align:left;gap:8px;padding:4px 8px}.dropdown-selected:focus{outline:0}.dropdown-selected md-focus-ring{border-radius:8px}.dropdown-list{position:relative;background:var(--md-sys-color-surface);padding:4px 0}.dropdown-item{display:flex;position:relative;cursor:pointer;padding:var(--spacing-3) 56px;min-height:40px;align-items:center}.dropdown-item:focus-within{outline:0}.datepicker-popup,.dropdown-item md-focus-ring{border-radius:var(--md-sys-shape-corner-small)}.dropdown-item.selected{background:var(--md-sys-color-secondary-container, #e3f2fd);font-weight:500;padding-left:16px;gap:16px}.datepicker-popup{background:var(--md-sys-color-surface);box-shadow:0 1px 2px 0 rgba(0,0,0,.3),0 2px 6px 2px rgba(0,0,0,.15);max-width:100%;width:100%;max-height:var(--scb-datepicker-max-height, 80vh);overflow:auto;font-family:var(--brand-font)}.datepicker-content{overflow-y:auto;max-height:290px}.datepicker-content::-webkit-scrollbar{width:12px;background:var(--md-sys-color-surface);border-radius:var(--md-sys-shape-corner-small)}.datepicker-content::-webkit-scrollbar-thumb{background:var(--md-sys-color-outline);border-radius:var(--md-sys-shape-corner-small);border:4px solid var(--md-sys-color-surface)}.datepicker-content::-webkit-scrollbar-track{background:var(--md-sys-color-surface);border-radius:var(--md-sys-shape-corner-small)}.popup{position:absolute;top:0;left:0;z-index:1}.header{display:flex;align-items:center;justify-content:space-between;margin-bottom:30px;padding:20px 16px 0;flex-wrap:wrap}.datepicker-footer{padding:8px 16px 24px}.month-label{font-size:18px;font-weight:500}.datepicker-calendar{padding:0 16px}table{width:100%;border-collapse:collapse;margin-bottom:8px}th{color:var(--md-sys-color-on-surface-variant, #757575);font-size:16px;font-weight:600;padding-bottom:20px}td{text-align:center}.day:focus-within{outline:0}.close-datepicker,.day{background:0 0;font-size:16px;cursor:pointer}.day{position:relative;width:40px;height:40px;border-radius:50%;border:0;font-family:"Inter";align-content:center}.day.selected{background:var(--md-sys-color-secondary-container)}.close-datepicker{margin-top:8px;border-color:none;color:var(--md-sys-color-primary, #0057b8);padding:4px 12px;border-radius:8px}.close-datepicker:hover{background:var(--md-sys-color-primary-container, #e3f2fd)}`],w);h([l()],p.prototype,"_currentDate",void 0);h([l()],p.prototype,"_selectedDate",void 0);h([l()],p.prototype,"_showMonthDropdown",void 0);h([l()],p.prototype,"_showYearDropdown",void 0);h([m({type:String})],p.prototype,"variant",void 0);h([m({type:String})],p.prototype,"lang",void 0);h([m({type:String})],p.prototype,"selectedValue",void 0);h([m({type:Boolean})],p.prototype,"open",void 0);h([l()],p.prototype,"_selectedHour",void 0);h([l()],p.prototype,"_selectedMinute",void 0);p=h([k("scb-datepicker")],p);
118
+ `}_getMonthDays(e,t){const s=new Date(Date.UTC(e,t,1)),c=new Date(Date.UTC(e,t+1,0)),a=[];let r=[],o=s.getUTCDay(),i=o===0?6:o-1;for(let n=0;n<i;n++)r.push(null);for(let n=1;n<=c.getUTCDate();n++){const u=new Date(Date.UTC(e,t,n));r.push(u),r.length===7&&(a.push(r),r=[])}if(r.length){for(;r.length<7;)r.push(null);a.push(r)}return a}_toggleMonthDropdown(){this._showMonthDropdown=!this._showMonthDropdown,this._showMonthDropdown&&(this._showYearDropdown=!1,setTimeout(()=>{const e=this.renderRoot.querySelector("#selected-month");e&&e.scrollIntoView({block:"center"})},0))}_toggleYearDropdown(){this._showYearDropdown=!this._showYearDropdown,this._showYearDropdown&&(this._showMonthDropdown=!1,setTimeout(()=>{const e=this.renderRoot.querySelector("#selected-year");e&&e.scrollIntoView({block:"center"})},0))}_onMonthChangeCustom(e){const t=this._currentDate.getFullYear();this._currentDate=new Date(t,e,1),this._showMonthDropdown=!1}_onYearChangeCustom(e){const t=this._currentDate.getMonth();this._currentDate=new Date(e,t,1),this._showYearDropdown=!1}_isToday(e,t){return e.getDate()===t.getDate()&&e.getMonth()===t.getMonth()&&e.getFullYear()===t.getFullYear()}_isSelected(e){return this._selectedDate&&e.getDate()===this._selectedDate.getDate()&&e.getMonth()===this._selectedDate.getMonth()&&e.getFullYear()===this._selectedDate.getFullYear()}_selectDate(e){if(this._selectedDate=e,this.variant==="datetime-local"){const t=new Date(e);t.setHours(this._selectedHour??0,this._selectedMinute??0,0,0),this._selectedHour=t.getHours(),this._selectedMinute=t.getMinutes();const s=a=>a.toString().padStart(2,"0"),c=`${t.getFullYear()}-${s(t.getMonth()+1)}-${s(t.getDate())} ${s(t.getHours())}:${s(t.getMinutes())}`;this.dispatchEvent(new CustomEvent("date-selected",{detail:{value:c},bubbles:!0,composed:!0}))}else{const t=e.toISOString().slice(0,10);this.dispatchEvent(new CustomEvent("date-selected",{detail:{value:t},bubbles:!0,composed:!0}))}}_fireDateTimeChange(){if(this.variant==="datetime-local"&&this._selectedDate){const e=new Date(this._selectedDate);e.setHours(this._selectedHour??0,this._selectedMinute??0,0,0);const t=c=>c.toString().padStart(2,"0"),s=`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())} ${t(e.getHours())}:${t(e.getMinutes())}`;this.dispatchEvent(new CustomEvent("date-selected",{detail:{value:s},bubbles:!0,composed:!0}))}}},v.styles=[Y`:host{--scb-datepicker-width:380px;--scb-datepicker-z-index:1100;--scb-datepicker-viewport-margin:8px;--scb-datepicker-offset:var(--spacing-2, 4px);max-width:var(--scb-datepicker-computed-width, min(var(--scb-datepicker-width), calc(100vw - (var(--scb-datepicker-viewport-margin) * 2))));font-family:var(--brand-font);color:var(--md-sys-color-on-surface);display:block;position:var(--scb-datepicker-position, fixed);top:var(--scb-datepicker-top, calc(100% + var(--scb-datepicker-offset)));bottom:var(--scb-datepicker-bottom, auto);left:var(--scb-datepicker-left, 0);width:var(--scb-datepicker-computed-width, min(var(--scb-datepicker-width), calc(100vw - (var(--scb-datepicker-viewport-margin) * 2))));transform:var(--scb-datepicker-transform, translateX(0px));z-index:var(--scb-datepicker-z-index)}.dropdown-selected,.month-selector,.year-selector{display:flex;align-items:center}.dropdown-selected{position:relative;border-radius:8px;font-size:16px;cursor:pointer;text-align:left;gap:8px;padding:4px 8px}.dropdown-selected:focus{outline:0}.dropdown-selected md-focus-ring{border-radius:8px}.dropdown-list{position:relative;background:var(--md-sys-color-surface);padding:4px 0}.dropdown-item{display:flex;position:relative;cursor:pointer;padding:var(--spacing-3) 56px;min-height:40px;align-items:center}.dropdown-item:focus-within{outline:0}.datepicker-popup,.dropdown-item md-focus-ring{border-radius:var(--md-sys-shape-corner-small)}.dropdown-item.selected{background:var(--md-sys-color-secondary-container, #e3f2fd);font-weight:500;padding-left:16px;gap:16px}.datepicker-popup{background:var(--md-sys-color-surface);box-shadow:0 1px 2px 0 rgba(0,0,0,.3),0 2px 6px 2px rgba(0,0,0,.15);max-width:100%;width:100%;max-height:var(--scb-datepicker-max-height, 80vh);overflow:auto;font-family:var(--brand-font)}.datepicker-content{overflow-y:auto;max-height:290px}.datepicker-content::-webkit-scrollbar{width:12px;background:var(--md-sys-color-surface);border-radius:var(--md-sys-shape-corner-small)}.datepicker-content::-webkit-scrollbar-thumb{background:var(--md-sys-color-outline);border-radius:var(--md-sys-shape-corner-small);border:4px solid var(--md-sys-color-surface)}.datepicker-content::-webkit-scrollbar-track{background:var(--md-sys-color-surface);border-radius:var(--md-sys-shape-corner-small)}.popup{position:absolute;top:0;left:0;z-index:1}.header{display:flex;align-items:center;justify-content:space-between;margin-bottom:30px;padding:20px 16px 0;flex-wrap:wrap}.datepicker-footer{padding:8px 16px 24px}.month-label{font-size:18px;font-weight:500}.datepicker-calendar{padding:0 16px}table{width:100%;border-collapse:collapse;margin-bottom:8px}th{color:var(--md-sys-color-on-surface-variant, #757575);font-size:16px;font-weight:600;padding-bottom:20px}td{text-align:center}.day:focus-within{outline:0}.close-datepicker,.day{background:0 0;font-size:16px;cursor:pointer}.day{position:relative;width:40px;height:40px;border-radius:50%;border:0;font-family:var(--brand-font, Inter, Arial, sans-serif);align-content:center}.day.selected{background:var(--md-sys-color-secondary-container)}.close-datepicker{margin-top:8px;border-color:none;color:var(--md-sys-color-primary, #0057b8);padding:4px 12px;border-radius:8px}.close-datepicker:hover{background:var(--md-sys-color-primary-container, #e3f2fd)}`],v);h([l()],p.prototype,"_currentDate",void 0);h([l()],p.prototype,"_selectedDate",void 0);h([l()],p.prototype,"_showMonthDropdown",void 0);h([l()],p.prototype,"_showYearDropdown",void 0);h([m({type:String})],p.prototype,"variant",void 0);h([m({type:String})],p.prototype,"lang",void 0);h([m({type:String})],p.prototype,"selectedValue",void 0);h([m({type:Boolean})],p.prototype,"open",void 0);h([l()],p.prototype,"_selectedHour",void 0);h([l()],p.prototype,"_selectedMinute",void 0);p=h([$("scb-datepicker")],p);
@@ -1,4 +1,4 @@
1
- import{g as p,h as f,m as b,p as s,v as r,y as v}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import"../../vendor/icon.js";import{t as n}from"../../vendor/decorate.js";import"../scb-button/scb-button.js";import"../scb-icon-button/scb-icon-button.js";import"../scb-textfield/scb-textfield.js";import"../scb-checkbox/scb-checkbox.js";import"../scb-radio-button/scb-radio-button.js";import"../scb-switch/scb-switch.js";import"../scb-chip/scb-chip.js";(function(){try{var d=typeof globalThis<"u"?globalThis:window;if(!d.__scb_ce_guard_installed__){d.__scb_ce_guard_installed__=!0;var e=customElements.define.bind(customElements);customElements.define=function(t,i,o){try{customElements.get(t)||e(t,i,o)}catch(c){var l=String(c||"");if(l.indexOf("already been used")===-1&&l.indexOf("NotSupportedError")===-1)throw c}}}}catch{}})();var h,g={fromAttribute(d){if(d===null)return!1;const e=d.trim().toLowerCase();return e!=="false"&&e!=="0"&&e!=="no"}},a=(h=class extends f{constructor(...e){super(...e),this.open=!1,this.inSb=!1,this.scrimClose=!0,this.spacing=void 0,this.spacingTop=void 0,this.spacingBottom=void 0,this.spacingLeft=void 0,this.spacingRight=void 0,this.variant="basic",this.label="",this.icon="",this.supportingText="",this.okButton="OK",this.cancelButton="Avbryt",this.deleteButton="Delete",this.confirmButton="Ta bort",this.denyButton="Avbryt",this.resetButton="Återställ",this.submitButton="Spara",this.formId="",this.formAction="",this.formMethod="",this.__lastTriggerEl=null,this.__scrollLocked=!1,this.__onDocumentClick=t=>{this.__getActionFromEvent(t)==="toggle"&&(this.__setOpen(!this.open),t.stopPropagation())},this.__onDocumentKeydown=t=>{this.open&&t.key==="Escape"&&(this.__fire("esc"),this.__setOpen(!1))},this.__onScrimClick=()=>{this.scrimClose&&(this.__fire("scrim"),this.__setOpen(!1))},this.__onOk=()=>{this.__fire("ok"),this.__setOpen(!1)},this.__onCancel=()=>{this.__fire("cancel"),this.__setOpen(!1)},this.__onConfirm=()=>{this.__fire("confirm"),this.__setOpen(!1)},this.__onDeny=()=>{this.__fire("deny"),this.__setOpen(!1)},this.__onReset=()=>{const t=this.shadowRoot?.querySelector("form");t instanceof HTMLFormElement&&(this.__clearGeneratedFormValues(t),t.reset()),(this.shadowRoot?.querySelector("slot")?.assignedElements({flatten:!0})??[]).forEach(i=>{const o=i.tagName;o==="SCB-TEXTFIELD"&&(i.value=""),o==="SCB-CHECKBOX"&&(i.checked=!1),o==="SCB-RADIO-BUTTON"&&(i.checked=!1),o==="SCB-SWITCH"&&(i.selected=!1),o==="SCB-CHIP"&&(i.selected=!1)}),this.__fire("reset")},this.__onSubmit=()=>{const t=this.shadowRoot?.querySelector("form");if(t instanceof HTMLFormElement){if(this.__syncSlottedFormValues(t),!this.__validateFormAndSlottedFields(t))return;t.requestSubmit()}this.__fire("submit"),this.__setOpen(!1)},this.__onKeydownTrap=t=>{if(!this.open||t.key!=="Tab")return;const i=Array.from(this.shadowRoot.querySelectorAll('button,[href],input,select,textarea,[tabindex]:not([tabindex="-1"])')).filter(c=>!c.hasAttribute("disabled"));if(!i.length)return;const o=i[0],l=i[i.length-1];t.shiftKey&&document.activeElement===o?(l.focus(),t.preventDefault()):!t.shiftKey&&document.activeElement===l&&(o.focus(),t.preventDefault())}}__getActionFromEvent(e){if(!this.id)return null;for(const t of e.composedPath())if(t instanceof Element){if(t.getAttribute("data-dialog-toggle")===this.id)return this.__lastTriggerEl=t,"toggle";if(t.getAttribute("aria-controls")===this.id)return this.__lastTriggerEl=t,"toggle"}return null}connectedCallback(){super.connectedCallback(),this.__applyZIndex(),this.__applyMaxSize(),document.addEventListener("click",this.__onDocumentClick,!1),document.addEventListener("keydown",this.__onDocumentKeydown,!0),this.addEventListener("keydown",this.__onKeydownTrap)}disconnectedCallback(){document.removeEventListener("click",this.__onDocumentClick,!1),document.removeEventListener("keydown",this.__onDocumentKeydown,!0),this.removeEventListener("keydown",this.__onKeydownTrap),this.__toggleScrollLock(!1),super.disconnectedCallback()}__applyZIndex(){const e=typeof this.zIndex=="number"&&Number.isFinite(this.zIndex)?this.zIndex:void 0;if(e===void 0){this.style.removeProperty("--z-dialog-scrim"),this.style.removeProperty("--z-dialog");return}this.style.setProperty("--z-dialog-scrim",String(e)),this.style.setProperty("--z-dialog",String(e+1))}__applyMaxSize(){const e=(this.maxW??"").trim(),t=(this.maxH??"").trim();e?(this.style.setProperty("--scb-dialog-max-w",e),this.style.setProperty("--scb-dialog-width",`min(${e}, 90vw)`)):(this.style.removeProperty("--scb-dialog-max-w"),this.style.removeProperty("--scb-dialog-width")),t?this.style.setProperty("--scb-dialog-max-h",t):this.style.removeProperty("--scb-dialog-max-h")}updated(e){if(e.has("zIndex")&&this.__applyZIndex(),(e.has("maxW")||e.has("maxH"))&&this.__applyMaxSize(),e.has("open")){const t=e.get("open");this.__updateTriggersExpanded(),this.open&&!t?!this.inSb&&!this.__usesInPlaceLayout()&&this.updateComplete.then(()=>{const i=this.shadowRoot?.querySelector('button,[href],input,select,textarea,[tabindex]:not([tabindex="-1"])');i?i.focus():this.shadowRoot?.querySelector(".container")?.focus()}):!this.open&&t&&this.__lastTriggerEl?.focus?.(),this.__toggleScrollLock(this.open)}(e.has("spacing")||e.has("spacingTop")||e.has("spacingBottom")||e.has("spacingLeft")||e.has("spacingRight"))&&this.__applySpacing()}__updateTriggersExpanded(){this.id&&document.querySelectorAll(`[aria-controls="${this.id}"], [data-dialog-toggle="${this.id}"]`).forEach(e=>{e.hasAttribute("aria-controls")&&e.setAttribute("aria-expanded",String(this.open))})}__usesInPlaceLayout(){const e=getComputedStyle(this);return e.getPropertyValue("--scb-dialog-scrim-position").trim()==="relative"||e.getPropertyValue("--scb-dialog-container-position").trim()==="absolute"}__toggleScrollLock(e){const t=document.documentElement,i=document.body;if(e){if(this.__scrollLocked||this.inSb||this.__usesInPlaceLayout())return;const o=window.innerWidth-t.clientWidth;t.style.overflow="hidden",i.style.paddingRight=o>0?`${o}px`:"",this.__scrollLocked=!0;return}this.__scrollLocked&&(t.style.overflow="",i.style.paddingRight="",this.__scrollLocked=!1)}mapSpacingToken(e){if(!e)return;const t=String(e).trim();if(t)return/^\d+$/.test(t)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(t,10)))})`:t}__applySpacing(){const e=this.mapSpacingToken(this.spacing),t=this.mapSpacingToken(this.spacingTop)??e,i=this.mapSpacingToken(this.spacingBottom)??e,o=this.mapSpacingToken(this.spacingLeft),l=this.mapSpacingToken(this.spacingRight);t?this.style.setProperty("--scb-dialog-spacing-block-start",t):this.style.removeProperty("--scb-dialog-spacing-block-start"),i?this.style.setProperty("--scb-dialog-spacing-block-end",i):this.style.removeProperty("--scb-dialog-spacing-block-end"),o?this.style.setProperty("--scb-dialog-spacing-inline-start",o):this.style.removeProperty("--scb-dialog-spacing-inline-start"),l?this.style.setProperty("--scb-dialog-spacing-inline-end",l):this.style.removeProperty("--scb-dialog-spacing-inline-end")}__setOpen(e){this.open=e,this.__fire(e?"open":"close")}__fire(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0}))}__getSlottedElements(){const e=this.shadowRoot?.querySelector("slot");if(!(e instanceof HTMLSlotElement))return[];const t=e.assignedElements({flatten:!0}),i=[];for(const o of t)i.push(o,...Array.from(o.querySelectorAll("*")));return i}__appendHiddenFormValue(e,t,i){const o=document.createElement("input");o.type="hidden",o.name=t,o.value=i,o.setAttribute("data-scb-dialog-generated","true"),e.append(o)}__clearGeneratedFormValues(e){e.querySelectorAll('input[data-scb-dialog-generated="true"]').forEach(t=>t.remove())}__syncSlottedFormValues(e){this.__clearGeneratedFormValues(e),this.__getSlottedElements().forEach(t=>{if(!(t instanceof HTMLElement))return;const i=(t.getAttribute("name")??"").trim();if(i&&!(t.disabled===!0||t.hasAttribute("disabled"))){if(t instanceof HTMLInputElement){if(t.form===e)return;const o=(t.type||"").toLowerCase();if(o==="checkbox"||o==="radio"){t.checked&&this.__appendHiddenFormValue(e,i,t.value||"on");return}this.__appendHiddenFormValue(e,i,t.value??"");return}if(t instanceof HTMLTextAreaElement){if(t.form===e)return;this.__appendHiddenFormValue(e,i,t.value??"");return}if(t instanceof HTMLSelectElement){if(t.form===e)return;if(t.multiple){Array.from(t.selectedOptions).forEach(o=>{this.__appendHiddenFormValue(e,i,o.value)});return}this.__appendHiddenFormValue(e,i,t.value??"");return}switch(t.tagName){case"SCB-TEXTFIELD":this.__appendHiddenFormValue(e,i,String(t.value??""));return;case"SCB-CHECKBOX":t.checked&&this.__appendHiddenFormValue(e,i,String(t.value??t.getAttribute("value")??"on"));return;case"SCB-RADIO-BUTTON":t.checked&&this.__appendHiddenFormValue(e,i,String(t.value??t.getAttribute("value")??"on"));return;case"SCB-SWITCH":(t.selected||t.checked)&&this.__appendHiddenFormValue(e,i,String(t.value??t.getAttribute("value")??"on"));return;case"SCB-CHIP":t.selected&&this.__appendHiddenFormValue(e,i,String(t.value??t.getAttribute("value")??"on"));return;default:"value"in t&&this.__appendHiddenFormValue(e,i,String(t.value??""))}}})}__validateFormAndSlottedFields(e){const t=c=>c.disabled===!0||c.hasAttribute("disabled");let i=e.reportValidity(),o=null;const l=new Set;return this.__getSlottedElements().forEach(c=>{if(!(c instanceof HTMLElement)||l.has(c)||t(c))return;l.add(c);const u=c;if(c.tagName==="SCB-TEXTFIELD"&&u.error===!0){o||(o=c),i=!1;return}if(typeof u.reportValidity=="function"){const m=!!u.reportValidity();!m&&!o&&(o=c),i=i&&m}}),!i&&o&&o.focus(),i}__slotIsEmpty(){const e=this.shadowRoot?.querySelector("slot");return e?e.assignedElements({flatten:!0}).length===0:!0}renderHeader(e){const t=this.variant==="form"||this.variant==="floating"||this.variant==="iframe";return r`
1
+ import{g as p,h as f,m as b,p as s,v as r,y as v}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import"../../vendor/icon.js";import{t as a}from"../../vendor/decorate.js";import"../scb-button/scb-button.js";import"../scb-icon-button/scb-icon-button.js";import"../scb-textfield/scb-textfield.js";import"../scb-checkbox/scb-checkbox.js";import"../scb-radio-button/scb-radio-button.js";import"../scb-switch/scb-switch.js";import"../scb-chip/scb-chip.js";(function(){try{var d=typeof globalThis<"u"?globalThis:window;if(!d.__scb_ce_guard_installed__){d.__scb_ce_guard_installed__=!0;var e=customElements.define.bind(customElements);customElements.define=function(t,i,o){try{customElements.get(t)||e(t,i,o)}catch(c){var l=String(c||"");if(l.indexOf("already been used")===-1&&l.indexOf("NotSupportedError")===-1)throw c}}}}catch{}})();var h,g={fromAttribute(d){if(d===null)return!1;const e=d.trim().toLowerCase();return e!=="false"&&e!=="0"&&e!=="no"}},n=(h=class extends f{constructor(...e){super(...e),this.open=!1,this.inSb=!1,this.scrimClose=!0,this.spacing=void 0,this.spacingTop=void 0,this.spacingBottom=void 0,this.spacingLeft=void 0,this.spacingRight=void 0,this.variant="basic",this.label="",this.icon="",this.supportingText="",this.okButton="OK",this.cancelButton="Avbryt",this.deleteButton="Delete",this.confirmButton="Ta bort",this.denyButton="Avbryt",this.resetButton="Återställ",this.submitButton="Spara",this.formId="",this.formAction="",this.formMethod="",this.__lastTriggerEl=null,this.__scrollLocked=!1,this.__onDocumentClick=t=>{this.__getActionFromEvent(t)==="toggle"&&(this.__setOpen(!this.open),t.stopPropagation())},this.__onDocumentKeydown=t=>{this.open&&t.key==="Escape"&&(this.__fire("esc"),this.__setOpen(!1))},this.__onScrimClick=()=>{this.scrimClose&&(this.__fire("scrim"),this.__setOpen(!1))},this.__onOk=()=>{this.__fire("ok"),this.__setOpen(!1)},this.__onCancel=()=>{this.__fire("cancel"),this.__setOpen(!1)},this.__onConfirm=()=>{this.__fire("confirm"),this.__setOpen(!1)},this.__onDeny=()=>{this.__fire("deny"),this.__setOpen(!1)},this.__onReset=()=>{const t=this.shadowRoot?.querySelector("form");t instanceof HTMLFormElement&&(this.__clearGeneratedFormValues(t),t.reset()),(this.shadowRoot?.querySelector("slot")?.assignedElements({flatten:!0})??[]).forEach(i=>{const o=i.tagName;o==="SCB-TEXTFIELD"&&(i.value=""),o==="SCB-CHECKBOX"&&(i.checked=!1),o==="SCB-RADIO-BUTTON"&&(i.checked=!1),o==="SCB-SWITCH"&&(i.selected=!1),o==="SCB-CHIP"&&(i.selected=!1)}),this.__fire("reset")},this.__onSubmit=()=>{const t=this.shadowRoot?.querySelector("form");if(t instanceof HTMLFormElement){if(this.__syncSlottedFormValues(t),!this.__validateFormAndSlottedFields(t))return;t.requestSubmit()}},this.__onFormSubmit=t=>{const i=t.currentTarget;if(!(i instanceof HTMLFormElement))return;if(this.__syncSlottedFormValues(i),!this.__validateFormAndSlottedFields(i)){t.preventDefault();return}const o=new FormData(i);if(!this.__fireCancelable("submit",{form:i,formData:o})){t.preventDefault();return}this.__setOpen(!1)},this.__onKeydownTrap=t=>{if(!this.open||t.key!=="Tab")return;const i=Array.from(this.shadowRoot.querySelectorAll('button,[href],input,select,textarea,[tabindex]:not([tabindex="-1"])')).filter(c=>!c.hasAttribute("disabled"));if(!i.length)return;const o=i[0],l=i[i.length-1];t.shiftKey&&document.activeElement===o?(l.focus(),t.preventDefault()):!t.shiftKey&&document.activeElement===l&&(o.focus(),t.preventDefault())}}__getActionFromEvent(e){if(!this.id)return null;for(const t of e.composedPath())if(t instanceof Element){if(t.getAttribute("data-dialog-toggle")===this.id)return this.__lastTriggerEl=t,"toggle";if(t.getAttribute("aria-controls")===this.id)return this.__lastTriggerEl=t,"toggle"}return null}connectedCallback(){super.connectedCallback(),this.__applyZIndex(),this.__applyMaxSize(),document.addEventListener("click",this.__onDocumentClick,!1),document.addEventListener("keydown",this.__onDocumentKeydown,!0),this.addEventListener("keydown",this.__onKeydownTrap)}disconnectedCallback(){document.removeEventListener("click",this.__onDocumentClick,!1),document.removeEventListener("keydown",this.__onDocumentKeydown,!0),this.removeEventListener("keydown",this.__onKeydownTrap),this.__toggleScrollLock(!1),super.disconnectedCallback()}__applyZIndex(){const e=typeof this.zIndex=="number"&&Number.isFinite(this.zIndex)?this.zIndex:void 0;if(e===void 0){this.style.removeProperty("--z-dialog-scrim"),this.style.removeProperty("--z-dialog");return}this.style.setProperty("--z-dialog-scrim",String(e)),this.style.setProperty("--z-dialog",String(e+1))}__applyMaxSize(){const e=(this.maxW??"").trim(),t=(this.maxH??"").trim();e?(this.style.setProperty("--scb-dialog-max-w",e),this.style.setProperty("--scb-dialog-width",`min(${e}, 90vw)`)):(this.style.removeProperty("--scb-dialog-max-w"),this.style.removeProperty("--scb-dialog-width")),t?this.style.setProperty("--scb-dialog-max-h",t):this.style.removeProperty("--scb-dialog-max-h")}updated(e){if(e.has("zIndex")&&this.__applyZIndex(),(e.has("maxW")||e.has("maxH"))&&this.__applyMaxSize(),e.has("open")){const t=e.get("open");this.__updateTriggersExpanded(),this.open&&!t?!this.inSb&&!this.__usesInPlaceLayout()&&this.updateComplete.then(()=>{const i=this.shadowRoot?.querySelector('button,[href],input,select,textarea,[tabindex]:not([tabindex="-1"])');i?i.focus():this.shadowRoot?.querySelector(".container")?.focus()}):!this.open&&t&&this.__lastTriggerEl?.focus?.(),this.__toggleScrollLock(this.open)}(e.has("spacing")||e.has("spacingTop")||e.has("spacingBottom")||e.has("spacingLeft")||e.has("spacingRight"))&&this.__applySpacing()}__updateTriggersExpanded(){this.id&&document.querySelectorAll(`[aria-controls="${this.id}"], [data-dialog-toggle="${this.id}"]`).forEach(e=>{e.hasAttribute("aria-controls")&&e.setAttribute("aria-expanded",String(this.open))})}__usesInPlaceLayout(){const e=getComputedStyle(this);return e.getPropertyValue("--scb-dialog-scrim-position").trim()==="relative"||e.getPropertyValue("--scb-dialog-container-position").trim()==="absolute"}__toggleScrollLock(e){const t=document.documentElement,i=document.body;if(e){if(this.__scrollLocked||this.inSb||this.__usesInPlaceLayout())return;const o=window.innerWidth-t.clientWidth;t.style.overflow="hidden",i.style.paddingRight=o>0?`${o}px`:"",this.__scrollLocked=!0;return}this.__scrollLocked&&(t.style.overflow="",i.style.paddingRight="",this.__scrollLocked=!1)}mapSpacingToken(e){if(!e)return;const t=String(e).trim();if(t)return/^\d+$/.test(t)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(t,10)))})`:t}__applySpacing(){const e=this.mapSpacingToken(this.spacing),t=this.mapSpacingToken(this.spacingTop)??e,i=this.mapSpacingToken(this.spacingBottom)??e,o=this.mapSpacingToken(this.spacingLeft),l=this.mapSpacingToken(this.spacingRight);t?this.style.setProperty("--scb-dialog-spacing-block-start",t):this.style.removeProperty("--scb-dialog-spacing-block-start"),i?this.style.setProperty("--scb-dialog-spacing-block-end",i):this.style.removeProperty("--scb-dialog-spacing-block-end"),o?this.style.setProperty("--scb-dialog-spacing-inline-start",o):this.style.removeProperty("--scb-dialog-spacing-inline-start"),l?this.style.setProperty("--scb-dialog-spacing-inline-end",l):this.style.removeProperty("--scb-dialog-spacing-inline-end")}__setOpen(e){this.open=e,this.__fire(e?"open":"close")}__fire(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0}))}__fireCancelable(e,t){return this.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0,cancelable:!0}))}__getSlottedElements(){const e=this.shadowRoot?.querySelector("slot");if(!(e instanceof HTMLSlotElement))return[];const t=e.assignedElements({flatten:!0}),i=[];for(const o of t)i.push(o,...Array.from(o.querySelectorAll("*")));return i}__appendHiddenFormValue(e,t,i){const o=document.createElement("input");o.type="hidden",o.name=t,o.value=i,o.setAttribute("data-scb-dialog-generated","true"),e.append(o)}__clearGeneratedFormValues(e){e.querySelectorAll('input[data-scb-dialog-generated="true"]').forEach(t=>t.remove())}__syncSlottedFormValues(e){this.__clearGeneratedFormValues(e),this.__getSlottedElements().forEach(t=>{if(!(t instanceof HTMLElement))return;const i=(t.getAttribute("name")??"").trim();if(i&&!(t.disabled===!0||t.hasAttribute("disabled"))){if(t instanceof HTMLInputElement){if(t.form===e)return;const o=(t.type||"").toLowerCase();if(o==="checkbox"||o==="radio"){t.checked&&this.__appendHiddenFormValue(e,i,t.value||"on");return}this.__appendHiddenFormValue(e,i,t.value??"");return}if(t instanceof HTMLTextAreaElement){if(t.form===e)return;this.__appendHiddenFormValue(e,i,t.value??"");return}if(t instanceof HTMLSelectElement){if(t.form===e)return;if(t.multiple){Array.from(t.selectedOptions).forEach(o=>{this.__appendHiddenFormValue(e,i,o.value)});return}this.__appendHiddenFormValue(e,i,t.value??"");return}switch(t.tagName){case"SCB-TEXTFIELD":this.__appendHiddenFormValue(e,i,String(t.value??""));return;case"SCB-CHECKBOX":t.checked&&this.__appendHiddenFormValue(e,i,String(t.value??t.getAttribute("value")??"on"));return;case"SCB-RADIO-BUTTON":t.checked&&this.__appendHiddenFormValue(e,i,String(t.value??t.getAttribute("value")??"on"));return;case"SCB-SWITCH":(t.selected||t.checked)&&this.__appendHiddenFormValue(e,i,String(t.value??t.getAttribute("value")??"on"));return;case"SCB-CHIP":t.selected&&this.__appendHiddenFormValue(e,i,String(t.value??t.getAttribute("value")??"on"));return;default:"value"in t&&this.__appendHiddenFormValue(e,i,String(t.value??""))}}})}__validateFormAndSlottedFields(e){const t=c=>c.disabled===!0||c.hasAttribute("disabled");let i=e.reportValidity(),o=null;const l=new Set;return this.__getSlottedElements().forEach(c=>{if(!(c instanceof HTMLElement)||l.has(c)||t(c))return;l.add(c);const u=c;if(c.tagName==="SCB-TEXTFIELD"&&u.error===!0){o||(o=c),i=!1;return}if(typeof u.reportValidity=="function"){const m=!!u.reportValidity();!m&&!o&&(o=c),i=i&&m}}),!i&&o&&o.focus(),i}__slotIsEmpty(){const e=this.shadowRoot?.querySelector("slot");return e?e.assignedElements({flatten:!0}).length===0:!0}renderHeader(e){const t=this.variant==="form"||this.variant==="floating"||this.variant==="iframe";return r`
2
2
  <div class="header">
3
3
  <div class="title">
4
4
  ${this.icon?r`<md-icon class="dialog-icon">${this.icon}</md-icon>`:p}
@@ -34,7 +34,7 @@ import{g as p,h as f,m as b,p as s,v as r,y as v}from"../../vendor/vendor.js";im
34
34
  </div>`}}renderBody(e,t){return this.variant==="form"?r`
35
35
  ${this.renderHeader(e)}
36
36
  <div class="content" id=${t}>
37
- <form id=${this.formId} action=${this.formAction} method=${this.formMethod||p}>
37
+ <form id=${this.formId} action=${this.formAction} method=${this.formMethod||p} @submit=${this.__onFormSubmit}>
38
38
  <slot></slot>
39
39
  </form>
40
40
  </div>
@@ -51,4 +51,4 @@ import{g as p,h as f,m as b,p as s,v as r,y as v}from"../../vendor/vendor.js";im
51
51
  >
52
52
  ${this.renderBody(e,t)}
53
53
  </div>
54
- `}},h.styles=v`@keyframes scb-kf-fade-in{0%{opacity:0}to{opacity:1}}@keyframes scb-kf-fade-out{0%{opacity:1}to{opacity:0}}:host{display:block;position:relative;font-family:var(--brand-font, Inter, Arial, sans-serif);margin-block-start:var(--scb-dialog-spacing-block-start, 0);margin-block-end:var(--scb-dialog-spacing-block-end, 0);margin-inline-start:var(--scb-dialog-spacing-inline-start, 0);margin-inline-end:var(--scb-dialog-spacing-inline-end, 0)}.scrim{position:var(--scb-dialog-scrim-position, fixed);inset:0;background:color-mix(in srgb,var(--md-sys-color-scrim) 32%,transparent);z-index:var(--z-dialog-scrim, 1000);opacity:1;transition:opacity var(--motion-duration-short, 0.25s);transition-timing-function:var(--motion-easing-standard, cubic-bezier(0.2, 0, 0, 1));height:var(--scb-dialog-scrim-height, auto)}.container{outline:0;position:var(--scb-dialog-container-position, fixed);inset:50%auto auto 50%;transform:translate(-50%,-50%) scale(1);background:var(--md-sys-color-surface);color:var(--md-sys-color-on-surface);border-radius:var(--scb-dialog-radius, var(--spacing-5, 16px));box-shadow:0 var(--spacing-1, 2px) var(--spacing-5, 16px) color-mix(in srgb,var(--md-sys-color-shadow) 20%,transparent);min-width:var(--scb-dialog-min-w, 340px);width:var(--scb-dialog-width, auto);max-width:var(--scb-dialog-max-w, 90vw);max-height:var(--scb-dialog-max-h, 90vh);display:flex;flex-direction:column;padding:var(--scb-dialog-padding, var(--spacing-7, 24px));z-index:var(--z-dialog, 1001);opacity:1;transition:opacity var(--motion-duration-medium, 0.3s),transform var(--motion-duration-medium, 0.3s);transition-timing-function:var(--motion-easing-emphasized-decelerate, cubic-bezier(0.05, 0.7, 0.1, 1))}:host(:not([open])) .container,:host(:not([open])) .scrim{opacity:0;pointer-events:none}:host([open]) .scrim{animation:var(--motion-keyframe-fade-in, scb-kf-fade-in) var(--motion-duration-short, 0.25s) var(--motion-easing-standard, cubic-bezier(0.2, 0, 0, 1)) both}:host([open]) .container{animation:var(--motion-keyframe-fade-in, scb-kf-fade-in) var(--motion-duration-medium, 0.3s) var(--motion-easing-emphasized-decelerate, cubic-bezier(0.05, 0.7, 0.1, 1)) both}.header{display:flex;align-items:flex-start;gap:var(--spacing-4, 12px);margin-bottom:var(--spacing-5, 16px)}.header .title{display:flex;flex-direction:column;gap:var(--spacing-3, 8px)}.header .label{font-weight:var(--md-sys-typescale-headline-small-weight, 700);font-size:var(--md-sys-typescale-headline-small-size, 1.5rem);line-height:var(--md-sys-typescale-headline-small-line-height, 2rem)}.header .close{margin-left:auto}.dialog-icon{inline-size:var(--scb-dialog-icon-size, var(--spacing-7, 24px));block-size:var(--scb-dialog-icon-size, var(--spacing-7, 24px))}.content{flex:1 1 auto;overflow:auto;margin-bottom:var(--spacing-5, 16px);color:var(--md-sys-color-on-surface-variant)}.content-surface{border-radius:calc(var(--scb-dialog-radius, var(--spacing-5, 16px)) - var(--spacing-2, 4px));overflow:hidden;background:var(--md-sys-color-surface-container-lowest, var(--md-sys-color-surface))}:host([variant="iframe"]) .container{--scb-dialog-min-w:var(--scb-dialog-min-w-iframe, var(--scb-dialog-min-w-floating, 360px));--scb-dialog-padding:var(--scb-dialog-padding-iframe, var(--spacing-3, 8px) var(--spacing-3, 8px) var(--spacing-3, 8px))}:host([variant="iframe"]) .header{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:start;gap:var(--spacing-2, 4px);margin-bottom:var(--spacing-3, 8px);padding-block:var(--scb-dialog-header-padding-block-iframe, var(--spacing-3, 8px));padding-inline-start:var(--scb-dialog-header-padding-inline-start-iframe, var(--spacing-3, 8px));padding-inline-end:var(--scb-dialog-header-padding-inline-end-iframe, var(--spacing-3, 8px))}:host([variant="iframe"]) .header .title{min-width:0}:host([variant="iframe"]) .header .label{padding-inline-start:var(--scb-dialog-header-label-padding-inline-start-iframe, 0)}:host([variant="iframe"]) .header .close{margin-left:0;align-self:start;justify-self:end;margin-top:var(--spacing-negative-2, -4px);margin-right:var(--spacing-negative-4, -12px)}:host([variant="iframe"]) .content{margin-bottom:0;color:inherit}:host([variant="iframe"]) .content-surface{block-size:100%}:host([variant="iframe"]) ::slotted(iframe){display:block;inline-size:100%;block-size:var(--scb-dialog-iframe-height, min(70vh, 720px));border:0;background:var(--md-sys-color-surface-container-lowest, var(--md-sys-color-surface))}.actions{display:flex;align-items:center;gap:var(--spacing-3, 8px);justify-content:flex-end}.actions .start{margin-right:auto}:host([variant="choose"]) .container{--scb-dialog-min-w:var(--scb-dialog-min-w-choose, 280px)}:host([variant="alert"]) .container{--scb-dialog-min-w:var(--scb-dialog-min-w-alert, 320px)}:host([variant="confirm"]) .container{--scb-dialog-min-w:var(--scb-dialog-min-w-confirm, 360px)}:host([variant="form"]) form{display:grid;grid-template-columns:1fr;gap:var(--scb-form-gap, var(--spacing-6, 20px))}:host([variant="form"]) .content{overflow:visible}:host([variant="floating"]) .container{--scb-dialog-min-w:var(--scb-dialog-min-w-floating, 360px)}:host([variant="choose"]) ::slotted(scb-radio-button){display:block;margin-block:var(--scb-choice-gap, 6px)}`,h);n([s({type:Boolean,reflect:!0,converter:g})],a.prototype,"open",void 0);n([s({type:String,attribute:"max-w",reflect:!0})],a.prototype,"maxW",void 0);n([s({type:String,attribute:"max-h",reflect:!0})],a.prototype,"maxH",void 0);n([s({type:Number,attribute:"z-index",reflect:!0})],a.prototype,"zIndex",void 0);n([s({type:Boolean,attribute:!1})],a.prototype,"inSb",void 0);n([s({type:Boolean,attribute:"scrim-close",converter:g})],a.prototype,"scrimClose",void 0);n([s({type:String,reflect:!0})],a.prototype,"spacing",void 0);n([s({type:String,attribute:"spacing-top",reflect:!0})],a.prototype,"spacingTop",void 0);n([s({type:String,attribute:"spacing-bottom",reflect:!0})],a.prototype,"spacingBottom",void 0);n([s({type:String,attribute:"spacing-left",reflect:!0})],a.prototype,"spacingLeft",void 0);n([s({type:String,attribute:"spacing-right",reflect:!0})],a.prototype,"spacingRight",void 0);n([s({type:String,reflect:!0})],a.prototype,"variant",void 0);n([s({type:String})],a.prototype,"label",void 0);n([s({type:String})],a.prototype,"icon",void 0);n([s({type:String,attribute:"supporting-text"})],a.prototype,"supportingText",void 0);n([s({type:String,attribute:"ok-button"})],a.prototype,"okButton",void 0);n([s({type:String,attribute:"cancel-button"})],a.prototype,"cancelButton",void 0);n([s({type:String,attribute:"delete-button"})],a.prototype,"deleteButton",void 0);n([s({type:String,attribute:"confirm-button"})],a.prototype,"confirmButton",void 0);n([s({type:String,attribute:"deny-button"})],a.prototype,"denyButton",void 0);n([s({type:String,attribute:"reset-button"})],a.prototype,"resetButton",void 0);n([s({type:String,attribute:"submit-button"})],a.prototype,"submitButton",void 0);n([s({type:String,attribute:"form-id"})],a.prototype,"formId",void 0);n([s({type:String,attribute:"form-action"})],a.prototype,"formAction",void 0);n([s({type:String,attribute:"form-method"})],a.prototype,"formMethod",void 0);a=n([b("scb-dialog")],a);
54
+ `}},h.styles=v`@keyframes scb-kf-fade-in{0%{opacity:0}to{opacity:1}}@keyframes scb-kf-fade-out{0%{opacity:1}to{opacity:0}}:host{display:block;position:relative;font-family:var(--brand-font, Inter, Arial, sans-serif);margin-block-start:var(--scb-dialog-spacing-block-start, 0);margin-block-end:var(--scb-dialog-spacing-block-end, 0);margin-inline-start:var(--scb-dialog-spacing-inline-start, 0);margin-inline-end:var(--scb-dialog-spacing-inline-end, 0)}.scrim{position:var(--scb-dialog-scrim-position, fixed);inset:0;background:color-mix(in srgb,var(--md-sys-color-scrim) 32%,transparent);z-index:var(--z-dialog-scrim, 1000);opacity:1;transition:opacity var(--motion-duration-short, 0.25s);transition-timing-function:var(--motion-easing-standard, cubic-bezier(0.2, 0, 0, 1));height:var(--scb-dialog-scrim-height, auto)}.container{outline:0;position:var(--scb-dialog-container-position, fixed);inset:50%auto auto 50%;transform:translate(-50%,-50%) scale(1);background:var(--md-sys-color-surface);color:var(--md-sys-color-on-surface);border-radius:var(--scb-dialog-radius, var(--spacing-5, 16px));box-shadow:0 var(--spacing-1, 2px) var(--spacing-5, 16px) color-mix(in srgb,var(--md-sys-color-shadow) 20%,transparent);min-width:var(--scb-dialog-min-w, 340px);width:var(--scb-dialog-width, auto);max-width:var(--scb-dialog-max-w, 90vw);max-height:var(--scb-dialog-max-h, 90vh);display:flex;flex-direction:column;padding:var(--scb-dialog-padding, var(--spacing-7, 24px));z-index:var(--z-dialog, 1001);opacity:1;transition:opacity var(--motion-duration-medium, 0.3s),transform var(--motion-duration-medium, 0.3s);transition-timing-function:var(--motion-easing-emphasized-decelerate, cubic-bezier(0.05, 0.7, 0.1, 1))}:host(:not([open])) .container,:host(:not([open])) .scrim{opacity:0;pointer-events:none}:host([open]) .scrim{animation:var(--motion-keyframe-fade-in, scb-kf-fade-in) var(--motion-duration-short, 0.25s) var(--motion-easing-standard, cubic-bezier(0.2, 0, 0, 1)) both}:host([open]) .container{animation:var(--motion-keyframe-fade-in, scb-kf-fade-in) var(--motion-duration-medium, 0.3s) var(--motion-easing-emphasized-decelerate, cubic-bezier(0.05, 0.7, 0.1, 1)) both}.header{display:flex;align-items:flex-start;gap:var(--spacing-4, 12px);margin-bottom:var(--spacing-5, 16px)}.header .title{display:flex;flex-direction:column;gap:var(--spacing-3, 8px)}.header .label{font-weight:var(--md-sys-typescale-headline-small-weight, 700);font-size:var(--md-sys-typescale-headline-small-size, 1.5rem);line-height:var(--md-sys-typescale-headline-small-line-height, 2rem)}.header .close{margin-left:auto}.dialog-icon{inline-size:var(--scb-dialog-icon-size, var(--spacing-7, 24px));block-size:var(--scb-dialog-icon-size, var(--spacing-7, 24px))}.content{flex:1 1 auto;overflow:auto;margin-bottom:var(--spacing-5, 16px);color:var(--md-sys-color-on-surface-variant)}.content-surface{border-radius:calc(var(--scb-dialog-radius, var(--spacing-5, 16px)) - var(--spacing-2, 4px));overflow:hidden;background:var(--md-sys-color-surface-container-lowest, var(--md-sys-color-surface))}:host([variant="iframe"]) .container{--scb-dialog-min-w:var(--scb-dialog-min-w-iframe, var(--scb-dialog-min-w-floating, 360px));--scb-dialog-padding:var(--scb-dialog-padding-iframe, var(--spacing-3, 8px) var(--spacing-3, 8px) var(--spacing-3, 8px))}:host([variant="iframe"]) .header{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:start;gap:var(--spacing-2, 4px);margin-bottom:var(--spacing-3, 8px);padding-block:var(--scb-dialog-header-padding-block-iframe, var(--spacing-3, 8px));padding-inline-start:var(--scb-dialog-header-padding-inline-start-iframe, var(--spacing-3, 8px));padding-inline-end:var(--scb-dialog-header-padding-inline-end-iframe, var(--spacing-3, 8px))}:host([variant="iframe"]) .header .title{min-width:0}:host([variant="iframe"]) .header .label{padding-inline-start:var(--scb-dialog-header-label-padding-inline-start-iframe, 0)}:host([variant="iframe"]) .header .close{margin-left:0;align-self:start;justify-self:end;margin-top:var(--spacing-negative-2, -4px);margin-right:var(--spacing-negative-4, -12px)}:host([variant="iframe"]) .content{margin-bottom:0;color:inherit}:host([variant="iframe"]) .content-surface{block-size:100%}:host([variant="iframe"]) ::slotted(iframe){display:block;inline-size:100%;block-size:var(--scb-dialog-iframe-height, min(70vh, 720px));border:0;background:var(--md-sys-color-surface-container-lowest, var(--md-sys-color-surface))}.actions{display:flex;align-items:center;gap:var(--spacing-3, 8px);justify-content:flex-end}.actions .start{margin-right:auto}:host([variant="choose"]) .container{--scb-dialog-min-w:var(--scb-dialog-min-w-choose, 280px)}:host([variant="alert"]) .container{--scb-dialog-min-w:var(--scb-dialog-min-w-alert, 320px)}:host([variant="confirm"]) .container{--scb-dialog-min-w:var(--scb-dialog-min-w-confirm, 360px)}:host([variant="form"]) form{display:grid;grid-template-columns:1fr;gap:var(--scb-form-gap, var(--spacing-6, 20px))}:host([variant="form"]) .content{overflow:visible}:host([variant="floating"]) .container{--scb-dialog-min-w:var(--scb-dialog-min-w-floating, 360px)}:host([variant="choose"]) ::slotted(scb-radio-button){display:block;margin-block:var(--scb-choice-gap, 6px)}`,h);a([s({type:Boolean,reflect:!0,converter:g})],n.prototype,"open",void 0);a([s({type:String,attribute:"max-w",reflect:!0})],n.prototype,"maxW",void 0);a([s({type:String,attribute:"max-h",reflect:!0})],n.prototype,"maxH",void 0);a([s({type:Number,attribute:"z-index",reflect:!0})],n.prototype,"zIndex",void 0);a([s({type:Boolean,attribute:!1})],n.prototype,"inSb",void 0);a([s({type:Boolean,attribute:"scrim-close",converter:g})],n.prototype,"scrimClose",void 0);a([s({type:String,reflect:!0})],n.prototype,"spacing",void 0);a([s({type:String,attribute:"spacing-top",reflect:!0})],n.prototype,"spacingTop",void 0);a([s({type:String,attribute:"spacing-bottom",reflect:!0})],n.prototype,"spacingBottom",void 0);a([s({type:String,attribute:"spacing-left",reflect:!0})],n.prototype,"spacingLeft",void 0);a([s({type:String,attribute:"spacing-right",reflect:!0})],n.prototype,"spacingRight",void 0);a([s({type:String,reflect:!0})],n.prototype,"variant",void 0);a([s({type:String})],n.prototype,"label",void 0);a([s({type:String})],n.prototype,"icon",void 0);a([s({type:String,attribute:"supporting-text"})],n.prototype,"supportingText",void 0);a([s({type:String,attribute:"ok-button"})],n.prototype,"okButton",void 0);a([s({type:String,attribute:"cancel-button"})],n.prototype,"cancelButton",void 0);a([s({type:String,attribute:"delete-button"})],n.prototype,"deleteButton",void 0);a([s({type:String,attribute:"confirm-button"})],n.prototype,"confirmButton",void 0);a([s({type:String,attribute:"deny-button"})],n.prototype,"denyButton",void 0);a([s({type:String,attribute:"reset-button"})],n.prototype,"resetButton",void 0);a([s({type:String,attribute:"submit-button"})],n.prototype,"submitButton",void 0);a([s({type:String,attribute:"form-id"})],n.prototype,"formId",void 0);a([s({type:String,attribute:"form-action"})],n.prototype,"formAction",void 0);a([s({type:String,attribute:"form-method"})],n.prototype,"formMethod",void 0);n=a([b("scb-dialog")],n);
@@ -1,4 +1,4 @@
1
- import{f as $,h as z,m as k,p as n,v as c,y as S}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import"../../vendor/icon.js";import"../../vendor/ripple.js";import{ensureFocusRingReady as E}from"../shared/lazy-focus-ring.js";import{t as r}from"../../vendor/decorate.js";import{n as T,t as a}from"../../vendor/assertClassBrand.js";import"../scb-icon-button/scb-icon-button.js";import"../scb-datepicker/scb-datepicker.js";import"../scb-tooltip/scb-tooltip.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,o,d){try{customElements.get(i)||e(i,o,d)}catch(u){var p=String(u||"");if(p.indexOf("already been used")===-1&&p.indexOf("NotSupportedError")===-1)throw u}}}}catch{}})();var l,b,s=(l=new WeakSet,b=class extends z{constructor(){super(),T(this,l),this._internals=null,this._inputFocused=!1,this._kbShouldShowRing=!1,this._onGlobalKeydown=e=>{e.key==="Tab"&&(E(),this._kbShouldShowRing=!0,this._inputFocused&&a(l,this,x).call(this))},this._onGlobalPointerDown=()=>{this._kbShouldShowRing=!1,this._inputFocused&&a(l,this,x).call(this)},this._hasRenderedOnce=!1,this._boundField=null,this._onFieldInput=()=>{const e=this._boundField;if(!e)return;const i=e;if(this.value=i.value,this._internals){const o=this.disabled?null:this.value;this._internals.setFormValue(o)}a(l,this,f).call(this),this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("onValueChanged",{detail:{value:this.value},bubbles:!0,composed:!0}))},this._onFieldChange=()=>{this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))},this._onFieldSelect=()=>{this.dispatchEvent(new Event("select",{bubbles:!0,composed:!0}))},this._onFieldFocus=()=>{this._inputFocused=!0,a(l,this,x).call(this)},this._onFieldBlur=()=>{this._inputFocused=!1,a(l,this,x).call(this)},this.type="text",this.label="",this.supportingText="",this.helpText="",this.helpLabel="Visa hjälptext",this.errorText="",this.leadingIcon="",this.name="",this.pattern="",this.value="",this.underLabel="",this.error=!1,this.disabled=!1,this.required=!1,this.size="large",this.spacing=void 0,this.spacingTop=void 0,this.spacingBottom=void 0,this.spacingLeft=void 0,this.spacingRight=void 0,this._form=null,this._formSubmitHandler=null,this._formResetHandler=null,this._initialValue="",this._inputId="",this._showDatepicker=!1,this._toggleDatepicker=()=>{this._showDatepicker=!this._showDatepicker},this._onDateSelected=e=>{if(this.value=e.detail.value,this._showDatepicker=!1,this._internals){const i=this.disabled?null:this.value;this._internals.setFormValue(i)}a(l,this,f).call(this),this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("onValueChanged",{detail:{value:this.value},bubbles:!0,composed:!0}))},"attachInternals"in this&&(this._internals=this.attachInternals())}_syncDensityForSize(){this.size==="extra-small"?this.setAttribute("data-density","-5"):this.size==="small"?this.setAttribute("data-density","-4"):this.size==="medium"?this.setAttribute("data-density","-2"):this.removeAttribute("data-density")}_renderLabel(){const e=!!this.underLabel,i=c`
1
+ import{f as $,h as k,m as z,p as n,v as c,y as S}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import"../../vendor/icon.js";import"../../vendor/ripple.js";import{ensureFocusRingReady as E}from"../shared/lazy-focus-ring.js";import{t as l}from"../../vendor/decorate.js";import{n as T,t as a}from"../../vendor/assertClassBrand.js";import"../scb-icon-button/scb-icon-button.js";import"../scb-datepicker/scb-datepicker.js";import"../scb-tooltip/scb-tooltip.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,o,d){try{customElements.get(i)||e(i,o,d)}catch(u){var p=String(u||"");if(p.indexOf("already been used")===-1&&p.indexOf("NotSupportedError")===-1)throw u}}}}catch{}})();var r,b,s=(r=new WeakSet,b=class extends k{constructor(){super(),T(this,r),this._internals=null,this._inputFocused=!1,this._kbShouldShowRing=!1,this._onGlobalKeydown=e=>{e.key==="Tab"&&(E(),this._kbShouldShowRing=!0,this._inputFocused&&a(r,this,x).call(this))},this._onGlobalPointerDown=()=>{this._kbShouldShowRing=!1,this._inputFocused&&a(r,this,x).call(this)},this._hasRenderedOnce=!1,this._boundField=null,this._onFieldInput=()=>{const e=this._boundField;if(!e)return;const i=e;if(this.value=i.value,this._internals){const o=this.disabled?null:this.value;this._internals.setFormValue(o)}a(r,this,f).call(this),this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("onValueChanged",{detail:{value:this.value},bubbles:!0,composed:!0}))},this._onFieldChange=()=>{this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))},this._onFieldSelect=()=>{this.dispatchEvent(new Event("select",{bubbles:!0,composed:!0}))},this._onFieldFocus=()=>{this._inputFocused=!0,a(r,this,x).call(this)},this._onFieldBlur=()=>{this._inputFocused=!1,a(r,this,x).call(this)},this.type="text",this.label="",this.supportingText="",this.helpText="",this.helpLabel="Visa hjälptext",this.errorText="",this.leadingIcon="",this.name="",this.pattern="",this.value="",this.underLabel="",this.error=!1,this.disabled=!1,this.required=!1,this.size="large",this.spacing=void 0,this.spacingTop=void 0,this.spacingBottom=void 0,this.spacingLeft=void 0,this.spacingRight=void 0,this._form=null,this._formSubmitHandler=null,this._formResetHandler=null,this._initialValue="",this._inputId="",this._showDatepicker=!1,this._toggleDatepicker=()=>{this._showDatepicker=!this._showDatepicker},this._openDatepicker=()=>{this._showDatepicker=!0},this._onDatepickerClosed=()=>{this._showDatepicker=!1},this._onDateSelected=e=>{if(this.value=e.detail.value,this._showDatepicker=!1,this._internals){const i=this.disabled?null:this.value;this._internals.setFormValue(i)}a(r,this,f).call(this),this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("onValueChanged",{detail:{value:this.value},bubbles:!0,composed:!0}))},"attachInternals"in this&&(this._internals=this.attachInternals())}_syncDensityForSize(){this.size==="extra-small"?this.setAttribute("data-density","-5"):this.size==="small"?this.setAttribute("data-density","-4"):this.size==="medium"?this.setAttribute("data-density","-2"):this.removeAttribute("data-density")}_renderLabel(){const e=!!this.underLabel,i=c`
2
2
  <label
3
3
  class="scb-textfield-label ${!e&&!this.helpText?"scb-textfield-label--without-supporting":""}"
4
4
  for="${this._inputId}"
@@ -97,8 +97,8 @@ import{f as $,h as z,m as k,p as n,v as c,y as S}from"../../vendor/vendor.js";im
97
97
  aria-invalid=${this.error?"true":"false"}
98
98
  aria-describedby=${o}
99
99
  readonly
100
- @focus=${this._toggleDatepicker}
101
- @click=${this._toggleDatepicker}
100
+ @focus=${this._openDatepicker}
101
+ @click=${this._openDatepicker}
102
102
  />
103
103
  <md-ripple></md-ripple>
104
104
  <md-focus-ring class="input-ring"></md-focus-ring>
@@ -116,6 +116,7 @@ import{f as $,h as z,m as k,p as n,v as c,y as S}from"../../vendor/vendor.js";im
116
116
  .selectedValue=${this.value}
117
117
  .open=${this._showDatepicker}
118
118
  @date-selected=${this._onDateSelected}
119
+ @datepicker-closed=${this._onDatepickerClosed}
119
120
  ></scb-datepicker>
120
121
  </div>
121
122
  `:this.type==="datetime-local"?c`
@@ -135,8 +136,8 @@ import{f as $,h as z,m as k,p as n,v as c,y as S}from"../../vendor/vendor.js";im
135
136
  aria-invalid=${this.error?"true":"false"}
136
137
  aria-describedby=${o}
137
138
  readonly
138
- @focus=${this._toggleDatepicker}
139
- @click=${this._toggleDatepicker}
139
+ @focus=${this._openDatepicker}
140
+ @click=${this._openDatepicker}
140
141
  />
141
142
 
142
143
  <md-ripple></md-ripple>
@@ -157,6 +158,7 @@ import{f as $,h as z,m as k,p as n,v as c,y as S}from"../../vendor/vendor.js";im
157
158
  .selectedValue=${this.value}
158
159
  .open=${this._showDatepicker}
159
160
  @date-selected=${this._onDateSelected}
161
+ @datepicker-closed=${this._onDatepickerClosed}
160
162
  ></scb-datepicker>
161
163
  </div>
162
164
  `:this.type==="time"?c`
@@ -175,7 +177,7 @@ import{f as $,h as z,m as k,p as n,v as c,y as S}from"../../vendor/vendor.js";im
175
177
  ?required=${this.required}
176
178
  aria-invalid=${this.error?"true":"false"}
177
179
  aria-describedby=${o}
178
- @input=${y=>{const _=y.target;if(this.value=_.value,this._internals){const w=this.disabled?null:this.value;this._internals.setFormValue(w)}a(l,this,f).call(this),this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("onValueChanged",{detail:{value:this.value},bubbles:!0,composed:!0}))}}
180
+ @input=${y=>{const _=y.target;if(this.value=_.value,this._internals){const w=this.disabled?null:this.value;this._internals.setFormValue(w)}a(r,this,f).call(this),this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("onValueChanged",{detail:{value:this.value},bubbles:!0,composed:!0}))}}
179
181
  />
180
182
  ${i}
181
183
  <md-ripple></md-ripple>
@@ -205,7 +207,7 @@ import{f as $,h as z,m as k,p as n,v as c,y as S}from"../../vendor/vendor.js";im
205
207
  <md-focus-ring class="input-ring"></md-focus-ring>
206
208
  </div>
207
209
  </div>
208
- `}firstUpdated(e){super.firstUpdated(e),this._initialValue=this.value,this._internals&&this.value&&this._internals.setFormValue(this.value),a(l,this,m).call(this),a(l,this,g).call(this)}updated(e){if(super.updated(e),this.toggleAttribute("aria-disabled",this.disabled),e.has("size")&&this._syncDensityForSize(),this._internals&&(e.has("value")||e.has("disabled"))){const i=this.disabled?null:this.value;this._internals.setFormValue(i)}e.has("type")&&(a(l,this,m).call(this),this._hasRenderedOnce&&a(l,this,F).call(this)),(e.has("spacing")||e.has("spacingTop")||e.has("spacingBottom")||e.has("spacingLeft")||e.has("spacingRight"))&&a(l,this,g).call(this),this._hasRenderedOnce=!0}formDisabledCallback(e){this.disabled=e}connectedCallback(){super.connectedCallback(),this._syncDensityForSize(),this._inputId=this.id||`scb-textfield-${Math.random().toString(36).substr(2,9)}`,this._formSubmitHandler=e=>{this.reportValidity()||(e.preventDefault(),e.stopPropagation())},this._form=this.closest("form"),this._form&&(this._form.addEventListener("submit",this._formSubmitHandler,!0),this._formResetHandler=()=>{this.value=this._initialValue;const e=this.shadowRoot?.querySelector(".scb-textfield");e&&(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)&&(e.value=this._initialValue),this.error=!1},this._form.addEventListener("reset",this._formResetHandler,!0)),window.addEventListener("keydown",this._onGlobalKeydown,!0),window.addEventListener("pointerdown",this._onGlobalPointerDown,!0)}disconnectedCallback(){super.disconnectedCallback(),this._form&&this._formSubmitHandler&&(this._form.removeEventListener("submit",this._formSubmitHandler,!0),this._formResetHandler&&this._form.removeEventListener("reset",this._formResetHandler,!0)),a(l,this,v).call(this),window.removeEventListener("keydown",this._onGlobalKeydown,!0),window.removeEventListener("pointerdown",this._onGlobalPointerDown,!0)}reportValidity(){return a(l,this,f).call(this,!0)}_onClearClick(){const e=this.shadowRoot?.querySelector(".scb-textfield");if(e&&(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)){if(e.value="",this.value="",this._internals){const i=this.disabled?null:this.value;this._internals.setFormValue(i),this._internals.setValidity({})}this.error=!1,e.setCustomValidity(""),this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("onValueChanged",{detail:{value:this.value},bubbles:!0,composed:!0})),e.focus()}}},b.formAssociated=!0,b.styles=[S`:host{--scb-textfield-number-max-width:280px;--scb-textfield-text-max-width:400px;--scb-textfield-search-max-width:600px;--scb-textfield-email-max-width:400px;--scb-textfield-password-max-width:400px;--scb-textfield-tel-max-width:400px;--scb-textfield-url-max-width:400px;--scb-textfield-textarea-max-width:600px;font-family:var(--brand-font);color:var(--md-sys-color-on-surface);margin-block-start:var(--scb-textfield-spacing-block-start, 0);margin-block-end:var(--scb-textfield-spacing-block-end, 0);margin-inline-start:var(--scb-textfield-spacing-inline-start, 0);margin-inline-end:var(--scb-textfield-spacing-inline-end, 0);-webkit-tap-highlight-color:transparent;--scb-textfield-padding-x:var(--spacing-5);--scb-textfield-padding-y:var(--spacing-2);--scb-textfield-min-height:56px;--scb-textfield-font-size:var(--md-sys-typescale-body-large-size);--scb-textfield-line-height:var(--md-sys-typescale-body-large-line-height);--scb-textfield-label-font-size:var(--md-sys-typescale-label-medium-size);--scb-textfield-label-line-height:var(--md-sys-typescale-label-medium-line-height);--scb-textfield-label-letter-spacing:var(--md-sys-typescale-label-medium-tracking);--scb-textfield-supporting-font-size:var(--md-sys-typescale-body-medium-size);--scb-textfield-supporting-line-height:var(--md-sys-typescale-body-medium-line-height);--scb-textfield-supporting-letter-spacing:var(--md-sys-typescale-body-medium-tracking);--scb-textfield-label-gap:var(--spacing-3);--scb-textfield-leading-inset:var(--spacing-4);--scb-textfield-leading-icon-size:var(--icon-size-medium, 24px);--scb-textfield-leading-gap:var(--spacing-4);--scb-textfield-leading-padding:calc(
210
+ `}firstUpdated(e){super.firstUpdated(e),this._initialValue=this.value,this._internals&&this.value&&this._internals.setFormValue(this.value),a(r,this,g).call(this),a(r,this,m).call(this)}updated(e){if(super.updated(e),this.toggleAttribute("aria-disabled",this.disabled),e.has("size")&&this._syncDensityForSize(),this._internals&&(e.has("value")||e.has("disabled"))){const i=this.disabled?null:this.value;this._internals.setFormValue(i)}e.has("type")&&(a(r,this,g).call(this),this._hasRenderedOnce&&a(r,this,F).call(this)),(e.has("spacing")||e.has("spacingTop")||e.has("spacingBottom")||e.has("spacingLeft")||e.has("spacingRight"))&&a(r,this,m).call(this),this._hasRenderedOnce=!0}formDisabledCallback(e){this.disabled=e}connectedCallback(){super.connectedCallback(),this._syncDensityForSize(),this._inputId=this.id||`scb-textfield-${Math.random().toString(36).substr(2,9)}`,this._formSubmitHandler=e=>{this.reportValidity()||(e.preventDefault(),e.stopPropagation())},this._form=this.closest("form"),this._form&&(this._form.addEventListener("submit",this._formSubmitHandler,!0),this._formResetHandler=()=>{this.value=this._initialValue;const e=this.shadowRoot?.querySelector(".scb-textfield");e&&(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)&&(e.value=this._initialValue),this.error=!1},this._form.addEventListener("reset",this._formResetHandler,!0)),window.addEventListener("keydown",this._onGlobalKeydown,!0),window.addEventListener("pointerdown",this._onGlobalPointerDown,!0)}disconnectedCallback(){super.disconnectedCallback(),this._form&&this._formSubmitHandler&&(this._form.removeEventListener("submit",this._formSubmitHandler,!0),this._formResetHandler&&this._form.removeEventListener("reset",this._formResetHandler,!0)),a(r,this,v).call(this),window.removeEventListener("keydown",this._onGlobalKeydown,!0),window.removeEventListener("pointerdown",this._onGlobalPointerDown,!0)}reportValidity(){return a(r,this,f).call(this,!0)}_onClearClick(){const e=this.shadowRoot?.querySelector(".scb-textfield");if(e&&(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)){if(e.value="",this.value="",this._internals){const i=this.disabled?null:this.value;this._internals.setFormValue(i),this._internals.setValidity({})}this.error=!1,e.setCustomValidity(""),this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("onValueChanged",{detail:{value:this.value},bubbles:!0,composed:!0})),e.focus()}}},b.formAssociated=!0,b.styles=[S`:host{--scb-textfield-number-max-width:280px;--scb-textfield-text-max-width:400px;--scb-textfield-search-max-width:600px;--scb-textfield-email-max-width:400px;--scb-textfield-password-max-width:400px;--scb-textfield-tel-max-width:400px;--scb-textfield-url-max-width:400px;--scb-textfield-textarea-max-width:600px;font-family:var(--brand-font);color:var(--md-sys-color-on-surface);margin-block-start:var(--scb-textfield-spacing-block-start, 0);margin-block-end:var(--scb-textfield-spacing-block-end, 0);margin-inline-start:var(--scb-textfield-spacing-inline-start, 0);margin-inline-end:var(--scb-textfield-spacing-inline-end, 0);-webkit-tap-highlight-color:transparent;--scb-textfield-padding-x:var(--spacing-5);--scb-textfield-padding-y:var(--spacing-2);--scb-textfield-min-height:56px;--scb-textfield-font-size:var(--md-sys-typescale-body-large-size);--scb-textfield-line-height:var(--md-sys-typescale-body-large-line-height);--scb-textfield-label-font-size:var(--md-sys-typescale-label-medium-size);--scb-textfield-label-line-height:var(--md-sys-typescale-label-medium-line-height);--scb-textfield-label-letter-spacing:var(--md-sys-typescale-label-medium-tracking);--scb-textfield-supporting-font-size:var(--md-sys-typescale-body-medium-size);--scb-textfield-supporting-line-height:var(--md-sys-typescale-body-medium-line-height);--scb-textfield-supporting-letter-spacing:var(--md-sys-typescale-body-medium-tracking);--scb-textfield-label-gap:var(--spacing-3);--scb-textfield-leading-inset:var(--spacing-4);--scb-textfield-leading-icon-size:var(--icon-size-medium, 24px);--scb-textfield-leading-gap:var(--spacing-4);--scb-textfield-leading-padding:calc(
209
211
  var(--scb-textfield-leading-inset) +
210
212
  var(--scb-textfield-leading-icon-size) +
211
213
  var(--scb-textfield-leading-gap)
@@ -213,4 +215,4 @@ import{f as $,h as z,m as k,p as n,v as c,y as S}from"../../vendor/vendor.js";im
213
215
  var(--scb-textfield-trailing-inset) +
214
216
  var(--scb-textfield-trailing-action-size) +
215
217
  var(--spacing-2)
216
- )}:host([size='extra-small']),:host([size='medium']),:host([size='small']){--scb-textfield-label-font-size:var(--md-sys-typescale-label-small-size);--scb-textfield-label-line-height:var(--md-sys-typescale-label-small-line-height);--scb-textfield-label-letter-spacing:var(--md-sys-typescale-label-small-tracking);--scb-textfield-supporting-font-size:var(--md-sys-typescale-body-small-size);--scb-textfield-supporting-line-height:var(--md-sys-typescale-body-small-line-height);--scb-textfield-supporting-letter-spacing:var(--md-sys-typescale-body-small-tracking);--scb-textfield-leading-inset:var(--spacing-3);--scb-textfield-trailing-inset:var(--spacing-3)}:host([size='medium']){--scb-textfield-padding-x:var(--spacing-4);--scb-textfield-padding-y:var(--spacing-3);--scb-textfield-min-height:48px;--scb-textfield-font-size:var(--md-sys-typescale-body-medium-size);--scb-textfield-line-height:var(--md-sys-typescale-body-medium-line-height);--scb-textfield-leading-icon-size:var(--icon-size-small, 20px);--scb-textfield-leading-gap:var(--spacing-5);--scb-textfield-trailing-icon-size:var(--icon-size-small, 20px);--scb-textfield-trailing-gap:var(--spacing-3);--scb-textfield-trailing-action-size:var(--scale-10, 40px)}:host([size='extra-small']),:host([size='small']){--scb-textfield-font-size:var(--md-sys-typescale-body-small-size);--scb-textfield-line-height:var(--md-sys-typescale-body-small-line-height)}:host([size='small']){--scb-textfield-padding-x:var(--spacing-4);--scb-textfield-padding-y:var(--spacing-3);--scb-textfield-min-height:40px;--scb-textfield-leading-icon-size:var(--icon-size-small, 20px);--scb-textfield-leading-gap:var(--spacing-5);--scb-textfield-trailing-icon-size:var(--icon-size-small, 20px);--scb-textfield-trailing-gap:var(--spacing-3);--scb-textfield-trailing-action-size:var(--scale-09, 36px)}:host([size='extra-small']){--scb-textfield-padding-x:var(--spacing-3);--scb-textfield-padding-y:var(--spacing-2);--scb-textfield-min-height:32px;--scb-textfield-leading-icon-size:var(--icon-size-extra-small, 16px);--scb-textfield-leading-gap:var(--spacing-4);--scb-textfield-trailing-icon-size:var(--icon-size-extra-small, 16px);--scb-textfield-trailing-gap:var(--spacing-2);--scb-textfield-trailing-action-size:var(--scale-08, 32px)}:host([type='number']){--scb-textfield-max-width:var(--scb-textfield-number-max-width)}:host([type='datetime-local']),:host([type='text']){--scb-textfield-max-width:var(--scb-textfield-text-max-width)}:host([type='search']){--scb-textfield-max-width:var(--scb-textfield-search-max-width)}:host([type='email']){--scb-textfield-max-width:var(--scb-textfield-email-max-width)}:host([type='password']){--scb-textfield-max-width:var(--scb-textfield-password-max-width)}:host([type='tel']){--scb-textfield-max-width:var(--scb-textfield-tel-max-width)}:host([type='url']){--scb-textfield-max-width:var(--scb-textfield-url-max-width)}:host([type='textarea']){--scb-textfield-max-width:var(--scb-textfield-textarea-max-width)}:host([type='date']),:host([type='time']){--scb-textfield-max-width:var(--scb-textfield-text-max-width)}input[type=time]::-webkit-calendar-picker-indicator{display:none;background:0 0}:host{display:flex;flex-direction:column;max-width:var(--scb-textfield-max-width)}:host([error]) .scb-textfield-supporting-text{color:var(--md-sys-color-error)}:host([error]) .scb-textfield{border-color:var(--md-sys-color-error)}:host([error]) .scb-textfield:focus-visible{border-color:var(--md-sys-color-error);box-shadow:inset 0 0 0 2px var(--md-sys-color-error)}:host([disabled]){opacity:.38;cursor:default}.scb-textfield-label{display:block;font-size:var(--scb-textfield-label-font-size);font-weight:var(--weight-semibold);line-height:var(--scb-textfield-label-line-height);letter-spacing:var(--scb-textfield-label-letter-spacing)}.scb-textfield-label-row{display:flex;align-items:center;gap:var(--spacing-1, 2px)}.scb-textfield-label-row--without-supporting{margin-bottom:var(--scb-textfield-label-gap)}.scb-textfield-help-tooltip{display:inline-flex;align-items:center;flex:0 0 auto;line-height:0}.scb-textfield-help-button{--scb-icon-button-container-size:var(--scale-06, 24px);--scb-icon-button-icon-size:var(--icon-size-extra-small, 16px)}.scb-textfield-label--without-supporting,.scb-textfield-supporting-text{margin-bottom:var(--scb-textfield-label-gap)}.scb-textfield-supporting-text{display:block;font-size:var(--scb-textfield-supporting-font-size);line-height:var(--scb-textfield-supporting-line-height);letter-spacing:var(--scb-textfield-supporting-letter-spacing);color:var(--md-sys-color-on-surface-variant)}.scb-textfield{padding:var(--scb-textfield-padding-y) var(--scb-textfield-padding-x);min-height:var(--scb-textfield-min-height);border:1px solid var(--md-sys-color-outline);border-radius:var(--md-sys-shape-corner-small);font-size:var(--scb-textfield-font-size);font-family:var(--brand-font);line-height:var(--scb-textfield-line-height);width:100%;box-sizing:border-box;background-color:transparent;color:var(--md-sys-color-on-surface);position:relative;z-index:1}:host([type='date']) .scb-textfield,:host([type='search']) .scb-textfield{padding-right:var(--scb-textfield-trailing-reserved)}md-icon+.ripple-wrapper>.scb-textfield{padding-left:var(--scb-textfield-leading-padding)}.scb-textfield-icon{position:absolute;left:var(--scb-textfield-leading-inset);top:50%;transform:translateY(-50%);pointer-events:none;font-size:var(--scb-textfield-leading-icon-size);z-index:2}.scb-textfield:focus-visible{outline:0;box-shadow:inset 0 0 0 2px var(--md-sys-color-primary);border:1px solid var(--md-sys-color-primary)}.ripple-wrapper,.scb-textfield-wrapper{position:relative;width:100%}md-focus-ring.input-ring,md-ripple{border-radius:var(--md-sys-shape-corner-small);position:absolute;inset:0;pointer-events:none}md-focus-ring.input-ring{display:none;z-index:3}.ripple-wrapper[data-kb-focus=true] md-focus-ring.input-ring{display:block}md-ripple{z-index:0;--md-ripple-hover-color:transparent;--md-ripple-hover-opacity:0}input[type=search]::-webkit-search-cancel-button{appearance:none;display:none}.scb-textfield-clear,.scb-textfield-error-icon{position:absolute;right:var(--scb-textfield-trailing-inset);top:50%;transform:translateY(-50%);z-index:2}.scb-textfield-error-icon{pointer-events:none;font-size:var(--scb-textfield-trailing-icon-size);color:var(--md-sys-color-error)}.scb-textfield.has-error-icon{padding-right:calc(var(--scb-textfield-trailing-inset) + var(--scb-textfield-trailing-icon-size) + var(--scb-textfield-trailing-gap))}.scb-textfield-clear{width:var(--scb-textfield-trailing-icon-size);height:var(--scb-textfield-trailing-icon-size);padding:0;margin:0;border:0;background:0 0;display:inline-flex;align-items:center;justify-content:center;cursor:pointer;color:var(--md-sys-color-on-surface)}:host([error]) .scb-textfield-clear{right:calc(var(--scb-textfield-trailing-inset) + var(--scb-textfield-trailing-icon-size) + var(--spacing-2))}.scb-textfield-clear:focus-visible{outline:2px solid var(--md-sys-color-primary);outline-offset:2px}.scb-textfield-clear svg{width:100%;height:100%;display:block}.scb-textfield-datepicker-button{position:absolute;right:var(--scb-textfield-trailing-inset);top:50%;transform:translateY(-50%);z-index:4}`],b);function g(){const t=a(l,this,h).call(this,this.spacing),e=a(l,this,h).call(this,this.spacingTop)??t,i=a(l,this,h).call(this,this.spacingBottom)??t,o=a(l,this,h).call(this,this.spacingLeft),d=a(l,this,h).call(this,this.spacingRight);e?this.style.setProperty("--scb-textfield-spacing-block-start",e):this.style.removeProperty("--scb-textfield-spacing-block-start"),i?this.style.setProperty("--scb-textfield-spacing-block-end",i):this.style.removeProperty("--scb-textfield-spacing-block-end"),o?this.style.setProperty("--scb-textfield-spacing-inline-start",o):this.style.removeProperty("--scb-textfield-spacing-inline-start"),d?this.style.setProperty("--scb-textfield-spacing-inline-end",d):this.style.removeProperty("--scb-textfield-spacing-inline-end")}function h(t){if(!t)return;const e=String(t).trim();if(e)return/^\d+$/.test(e)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(e,10)))})`:e}function f(t=!1){const e=this.shadowRoot?.querySelector(".scb-textfield");if(!(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement))return!0;const i=this.errorText||"Ogiltig inmatning.";let o="";if(e.setCustomValidity(""),this.required&&!e.value)o=i,e.setCustomValidity(o);else if(this.pattern&&e.value)try{new RegExp(this.pattern).test(e.value)||(o=i,e.setCustomValidity(o))}catch{e.setCustomValidity("")}const d=t?e.reportValidity():e.checkValidity();if(this.error=!d,this._internals)if(d)this._internals.setValidity({});else{const p=o||e.validationMessage||i;this._internals.setValidity({customError:!0},p,e)}return d}function m(){const t=this.shadowRoot?.querySelector(".scb-textfield");t&&(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement)&&this._boundField!==t&&(a(l,this,v).call(this),this._boundField=t,this.type!=="time"&&t.addEventListener("input",this._onFieldInput),t.addEventListener("change",this._onFieldChange),t.addEventListener("select",this._onFieldSelect),t.addEventListener("focus",this._onFieldFocus),t.addEventListener("blur",this._onFieldBlur))}function v(){const t=this._boundField;t&&(t.removeEventListener("input",this._onFieldInput),t.removeEventListener("change",this._onFieldChange),t.removeEventListener("select",this._onFieldSelect),t.removeEventListener("focus",this._onFieldFocus),t.removeEventListener("blur",this._onFieldBlur),this._boundField=null)}function F(){this._showDatepicker=!1;const t=this.shadowRoot?.querySelector(".scb-textfield");if(t&&(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement)&&(t.value="",t.setCustomValidity("")),this.value="",this.error=!1,this._internals){const e=this.disabled?null:"";this._internals.setFormValue(e),this._internals.setValidity({})}}function x(){const t=this.renderRoot?.querySelector(".ripple-wrapper");t&&(this._inputFocused&&this._kbShouldShowRing?t.setAttribute("data-kb-focus","true"):t.removeAttribute("data-kb-focus"))}r([n({type:String,reflect:!0})],s.prototype,"type",void 0);r([n({type:String})],s.prototype,"label",void 0);r([n({type:String,attribute:"supporting-text"})],s.prototype,"supportingText",void 0);r([n({type:String,attribute:"help-text"})],s.prototype,"helpText",void 0);r([n({type:String,attribute:"help-label"})],s.prototype,"helpLabel",void 0);r([n({type:String,attribute:"error-text"})],s.prototype,"errorText",void 0);r([n({type:String,attribute:"leading-icon"})],s.prototype,"leadingIcon",void 0);r([n({type:String})],s.prototype,"name",void 0);r([n({type:String})],s.prototype,"pattern",void 0);r([n({type:String,attribute:"value"})],s.prototype,"value",void 0);r([n({type:String})],s.prototype,"underLabel",void 0);r([n({type:Boolean,reflect:!0})],s.prototype,"error",void 0);r([n({type:Boolean,reflect:!0})],s.prototype,"disabled",void 0);r([n({type:Boolean,reflect:!0})],s.prototype,"required",void 0);r([n({type:String,reflect:!0})],s.prototype,"size",void 0);r([n({type:String,reflect:!0})],s.prototype,"spacing",void 0);r([n({type:String,attribute:"spacing-top",reflect:!0})],s.prototype,"spacingTop",void 0);r([n({type:String,attribute:"spacing-bottom",reflect:!0})],s.prototype,"spacingBottom",void 0);r([n({type:String,attribute:"spacing-left",reflect:!0})],s.prototype,"spacingLeft",void 0);r([n({type:String,attribute:"spacing-right",reflect:!0})],s.prototype,"spacingRight",void 0);r([$()],s.prototype,"_showDatepicker",void 0);s=r([k("scb-textfield")],s);
218
+ )}:host([size='extra-small']),:host([size='medium']),:host([size='small']){--scb-textfield-label-font-size:var(--md-sys-typescale-label-small-size);--scb-textfield-label-line-height:var(--md-sys-typescale-label-small-line-height);--scb-textfield-label-letter-spacing:var(--md-sys-typescale-label-small-tracking);--scb-textfield-supporting-font-size:var(--md-sys-typescale-body-small-size);--scb-textfield-supporting-line-height:var(--md-sys-typescale-body-small-line-height);--scb-textfield-supporting-letter-spacing:var(--md-sys-typescale-body-small-tracking);--scb-textfield-leading-inset:var(--spacing-3);--scb-textfield-trailing-inset:var(--spacing-3)}:host([size='medium']){--scb-textfield-padding-x:var(--spacing-4);--scb-textfield-padding-y:var(--spacing-3);--scb-textfield-min-height:48px;--scb-textfield-font-size:var(--md-sys-typescale-body-medium-size);--scb-textfield-line-height:var(--md-sys-typescale-body-medium-line-height);--scb-textfield-leading-icon-size:var(--icon-size-small, 20px);--scb-textfield-leading-gap:var(--spacing-5);--scb-textfield-trailing-icon-size:var(--icon-size-small, 20px);--scb-textfield-trailing-gap:var(--spacing-3);--scb-textfield-trailing-action-size:var(--scale-10, 40px)}:host([size='extra-small']),:host([size='small']){--scb-textfield-font-size:var(--md-sys-typescale-body-small-size);--scb-textfield-line-height:var(--md-sys-typescale-body-small-line-height)}:host([size='small']){--scb-textfield-padding-x:var(--spacing-4);--scb-textfield-padding-y:var(--spacing-3);--scb-textfield-min-height:40px;--scb-textfield-leading-icon-size:var(--icon-size-small, 20px);--scb-textfield-leading-gap:var(--spacing-5);--scb-textfield-trailing-icon-size:var(--icon-size-small, 20px);--scb-textfield-trailing-gap:var(--spacing-3);--scb-textfield-trailing-action-size:var(--scale-09, 36px)}:host([size='extra-small']){--scb-textfield-padding-x:var(--spacing-3);--scb-textfield-padding-y:var(--spacing-2);--scb-textfield-min-height:32px;--scb-textfield-leading-icon-size:var(--icon-size-extra-small, 16px);--scb-textfield-leading-gap:var(--spacing-4);--scb-textfield-trailing-icon-size:var(--icon-size-extra-small, 16px);--scb-textfield-trailing-gap:var(--spacing-2);--scb-textfield-trailing-action-size:var(--scale-08, 32px)}:host([type='number']){--scb-textfield-max-width:var(--scb-textfield-number-max-width)}:host([type='datetime-local']),:host([type='text']){--scb-textfield-max-width:var(--scb-textfield-text-max-width)}:host([type='search']){--scb-textfield-max-width:var(--scb-textfield-search-max-width)}:host([type='email']){--scb-textfield-max-width:var(--scb-textfield-email-max-width)}:host([type='password']){--scb-textfield-max-width:var(--scb-textfield-password-max-width)}:host([type='tel']){--scb-textfield-max-width:var(--scb-textfield-tel-max-width)}:host([type='url']){--scb-textfield-max-width:var(--scb-textfield-url-max-width)}:host([type='textarea']){--scb-textfield-max-width:var(--scb-textfield-textarea-max-width)}:host([type='date']),:host([type='time']){--scb-textfield-max-width:var(--scb-textfield-text-max-width)}input[type=time]::-webkit-calendar-picker-indicator{display:none;background:0 0}:host{display:flex;flex-direction:column;max-width:var(--scb-textfield-max-width)}:host([error]) .scb-textfield-supporting-text{color:var(--md-sys-color-error)}:host([error]) .scb-textfield{border-color:var(--md-sys-color-error)}:host([error]) .scb-textfield:focus-visible{border-color:var(--md-sys-color-error);box-shadow:inset 0 0 0 2px var(--md-sys-color-error)}:host([disabled]){opacity:.38;cursor:default}.scb-textfield-label{display:block;font-size:var(--scb-textfield-label-font-size);font-weight:var(--weight-semibold);line-height:var(--scb-textfield-label-line-height);letter-spacing:var(--scb-textfield-label-letter-spacing)}.scb-textfield-label-row{display:flex;align-items:center;gap:var(--spacing-1, 2px)}.scb-textfield-label-row--without-supporting{margin-bottom:var(--scb-textfield-label-gap)}.scb-textfield-help-tooltip{display:inline-flex;align-items:center;flex:0 0 auto;line-height:0}.scb-textfield-help-button{--scb-icon-button-container-size:var(--scale-06, 24px);--scb-icon-button-icon-size:var(--icon-size-extra-small, 16px)}.scb-textfield-label--without-supporting,.scb-textfield-supporting-text{margin-bottom:var(--scb-textfield-label-gap)}.scb-textfield-supporting-text{display:block;font-size:var(--scb-textfield-supporting-font-size);line-height:var(--scb-textfield-supporting-line-height);letter-spacing:var(--scb-textfield-supporting-letter-spacing);color:var(--md-sys-color-on-surface-variant)}.scb-textfield{padding:var(--scb-textfield-padding-y) var(--scb-textfield-padding-x);min-height:var(--scb-textfield-min-height);border:1px solid var(--md-sys-color-outline);border-radius:var(--md-sys-shape-corner-small);font-size:var(--scb-textfield-font-size);font-family:var(--brand-font);line-height:var(--scb-textfield-line-height);width:100%;box-sizing:border-box;background-color:transparent;color:var(--md-sys-color-on-surface);position:relative;z-index:1}:host([type='date']) .scb-textfield,:host([type='search']) .scb-textfield{padding-right:var(--scb-textfield-trailing-reserved)}md-icon+.ripple-wrapper>.scb-textfield{padding-left:var(--scb-textfield-leading-padding)}.scb-textfield-icon{position:absolute;left:var(--scb-textfield-leading-inset);top:50%;transform:translateY(-50%);pointer-events:none;font-size:var(--scb-textfield-leading-icon-size);z-index:2}.scb-textfield:focus-visible{outline:0;box-shadow:inset 0 0 0 2px var(--md-sys-color-primary);border:1px solid var(--md-sys-color-primary)}.ripple-wrapper,.scb-textfield-wrapper{position:relative;width:100%}md-focus-ring.input-ring,md-ripple{border-radius:var(--md-sys-shape-corner-small);position:absolute;inset:0;pointer-events:none}md-focus-ring.input-ring{display:none;z-index:3}.ripple-wrapper[data-kb-focus=true] md-focus-ring.input-ring{display:block}md-ripple{z-index:0;--md-ripple-hover-color:transparent;--md-ripple-hover-opacity:0}input[type=search]::-webkit-search-cancel-button{appearance:none;display:none}.scb-textfield-clear,.scb-textfield-error-icon{position:absolute;right:var(--scb-textfield-trailing-inset);top:50%;transform:translateY(-50%);z-index:2}.scb-textfield-error-icon{pointer-events:none;font-size:var(--scb-textfield-trailing-icon-size);color:var(--md-sys-color-error)}.scb-textfield.has-error-icon{padding-right:calc(var(--scb-textfield-trailing-inset) + var(--scb-textfield-trailing-icon-size) + var(--scb-textfield-trailing-gap))}.scb-textfield-clear{width:var(--scb-textfield-trailing-icon-size);height:var(--scb-textfield-trailing-icon-size);padding:0;margin:0;border:0;background:0 0;display:inline-flex;align-items:center;justify-content:center;cursor:pointer;color:var(--md-sys-color-on-surface)}:host([error]) .scb-textfield-clear{right:calc(var(--scb-textfield-trailing-inset) + var(--scb-textfield-trailing-icon-size) + var(--spacing-2))}.scb-textfield-clear:focus-visible{outline:2px solid var(--md-sys-color-primary);outline-offset:2px}.scb-textfield-clear svg{width:100%;height:100%;display:block}.scb-textfield-datepicker-button{position:absolute;right:var(--scb-textfield-trailing-inset);top:50%;transform:translateY(-50%);z-index:4}`],b);function m(){const t=a(r,this,h).call(this,this.spacing),e=a(r,this,h).call(this,this.spacingTop)??t,i=a(r,this,h).call(this,this.spacingBottom)??t,o=a(r,this,h).call(this,this.spacingLeft),d=a(r,this,h).call(this,this.spacingRight);e?this.style.setProperty("--scb-textfield-spacing-block-start",e):this.style.removeProperty("--scb-textfield-spacing-block-start"),i?this.style.setProperty("--scb-textfield-spacing-block-end",i):this.style.removeProperty("--scb-textfield-spacing-block-end"),o?this.style.setProperty("--scb-textfield-spacing-inline-start",o):this.style.removeProperty("--scb-textfield-spacing-inline-start"),d?this.style.setProperty("--scb-textfield-spacing-inline-end",d):this.style.removeProperty("--scb-textfield-spacing-inline-end")}function h(t){if(!t)return;const e=String(t).trim();if(e)return/^\d+$/.test(e)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(e,10)))})`:e}function f(t=!1){const e=this.shadowRoot?.querySelector(".scb-textfield");if(!(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement))return!0;const i=this.errorText||"Ogiltig inmatning.";let o="";if(e.setCustomValidity(""),this.required&&!e.value)o=i,e.setCustomValidity(o);else if(this.pattern&&e.value)try{new RegExp(this.pattern).test(e.value)||(o=i,e.setCustomValidity(o))}catch{e.setCustomValidity("")}const d=t?e.reportValidity():e.checkValidity();if(this.error=!d,this._internals)if(d)this._internals.setValidity({});else{const p=o||e.validationMessage||i;this._internals.setValidity({customError:!0},p,e)}return d}function g(){const t=this.shadowRoot?.querySelector(".scb-textfield");t&&(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement)&&this._boundField!==t&&(a(r,this,v).call(this),this._boundField=t,this.type!=="time"&&t.addEventListener("input",this._onFieldInput),t.addEventListener("change",this._onFieldChange),t.addEventListener("select",this._onFieldSelect),t.addEventListener("focus",this._onFieldFocus),t.addEventListener("blur",this._onFieldBlur))}function v(){const t=this._boundField;t&&(t.removeEventListener("input",this._onFieldInput),t.removeEventListener("change",this._onFieldChange),t.removeEventListener("select",this._onFieldSelect),t.removeEventListener("focus",this._onFieldFocus),t.removeEventListener("blur",this._onFieldBlur),this._boundField=null)}function F(){this._showDatepicker=!1;const t=this.shadowRoot?.querySelector(".scb-textfield");if(t&&(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement)&&(t.value="",t.setCustomValidity("")),this.value="",this.error=!1,this._internals){const e=this.disabled?null:"";this._internals.setFormValue(e),this._internals.setValidity({})}}function x(){const t=this.renderRoot?.querySelector(".ripple-wrapper");t&&(this._inputFocused&&this._kbShouldShowRing?t.setAttribute("data-kb-focus","true"):t.removeAttribute("data-kb-focus"))}l([n({type:String,reflect:!0})],s.prototype,"type",void 0);l([n({type:String})],s.prototype,"label",void 0);l([n({type:String,attribute:"supporting-text"})],s.prototype,"supportingText",void 0);l([n({type:String,attribute:"help-text"})],s.prototype,"helpText",void 0);l([n({type:String,attribute:"help-label"})],s.prototype,"helpLabel",void 0);l([n({type:String,attribute:"error-text"})],s.prototype,"errorText",void 0);l([n({type:String,attribute:"leading-icon"})],s.prototype,"leadingIcon",void 0);l([n({type:String})],s.prototype,"name",void 0);l([n({type:String})],s.prototype,"pattern",void 0);l([n({type:String,attribute:"value"})],s.prototype,"value",void 0);l([n({type:String})],s.prototype,"underLabel",void 0);l([n({type:Boolean,reflect:!0})],s.prototype,"error",void 0);l([n({type:Boolean,reflect:!0})],s.prototype,"disabled",void 0);l([n({type:Boolean,reflect:!0})],s.prototype,"required",void 0);l([n({type:String,reflect:!0})],s.prototype,"size",void 0);l([n({type:String,reflect:!0})],s.prototype,"spacing",void 0);l([n({type:String,attribute:"spacing-top",reflect:!0})],s.prototype,"spacingTop",void 0);l([n({type:String,attribute:"spacing-bottom",reflect:!0})],s.prototype,"spacingBottom",void 0);l([n({type:String,attribute:"spacing-left",reflect:!0})],s.prototype,"spacingLeft",void 0);l([n({type:String,attribute:"spacing-right",reflect:!0})],s.prototype,"spacingRight",void 0);l([$()],s.prototype,"_showDatepicker",void 0);s=l([z("scb-textfield")],s);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "scb-wc",
3
- "version": "0.1.108",
3
+ "version": "0.1.110",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "module": "index.js",
@@ -462,5 +462,5 @@
462
462
  },
463
463
  "./mvc/*": "./mvc/*"
464
464
  },
465
- "buildHash": "49AEBDDA7DFD6E7A1A81BDC35621E232C2F54708CA36861B00517589E7984900"
465
+ "buildHash": "142C02A70BEADDF9A046F77D5654C44E3053D4709FC7D54E0D45AE864754460E"
466
466
  }
@@ -45,6 +45,7 @@ export declare class ScbDialog extends LitElement {
45
45
  private __applySpacing;
46
46
  private __setOpen;
47
47
  private __fire;
48
+ private __fireCancelable;
48
49
  private __getSlottedElements;
49
50
  private __appendHiddenFormValue;
50
51
  private __clearGeneratedFormValues;
@@ -57,6 +58,7 @@ export declare class ScbDialog extends LitElement {
57
58
  private __onDeny;
58
59
  private __onReset;
59
60
  private __onSubmit;
61
+ private __onFormSubmit;
60
62
  private __onKeydownTrap;
61
63
  private __slotIsEmpty;
62
64
  private renderHeader;
@@ -52,6 +52,8 @@ export declare class ScbTextField extends LitElement {
52
52
  private _renderSupportingText;
53
53
  render(): TemplateResult;
54
54
  private _toggleDatepicker;
55
+ private _openDatepicker;
56
+ private _onDatepickerClosed;
55
57
  private _onDateSelected;
56
58
  /**
57
59
  * Vi re-dispatchar inbyggda "input", "change" och "select"-events med { bubbles: true, composed: true }.
@@ -64,8 +64,11 @@ var c = class extends n {
64
64
  if (!t) return;
65
65
  let n = window.innerWidth, r = window.innerHeight, i = Math.max(220, n - this._viewportMargin * 2);
66
66
  if (this._isRenderedInsideDialog()) {
67
- let t = Math.min(e.offsetWidth || 380, i), a = e.offsetHeight || 420, o = (n - t) / 2, s = (r - a) / 2;
68
- this.style.setProperty("--scb-datepicker-position", "fixed"), this.style.setProperty("--scb-datepicker-top", `${s}px`), this.style.setProperty("--scb-datepicker-bottom", "auto"), this.style.setProperty("--scb-datepicker-left", `${o}px`), this.style.setProperty("--scb-datepicker-transform", "none"), this.style.setProperty("--scb-datepicker-computed-width", `${t}px`), this.style.setProperty("--scb-datepicker-max-height", `${Math.max(220, r - this._viewportMargin * 2)}px`);
67
+ let a = Math.min(e.offsetWidth || 380, i), o = e.offsetHeight || 420, s = Math.min(Math.max(t.left, this._viewportMargin), n - this._viewportMargin - a), c = r - t.bottom - this._viewportMargin, l = t.top - this._viewportMargin, u = c < o + this._popupOffset && l > c;
68
+ if (this.style.setProperty("--scb-datepicker-position", "absolute"), this.style.setProperty("--scb-datepicker-computed-width", `${a}px`), this.style.setProperty("--scb-datepicker-left", `${s - t.left}px`), this.style.setProperty("--scb-datepicker-transform", "none"), this.style.setProperty("--scb-datepicker-bottom", "auto"), u) {
69
+ let e = Math.max(this._viewportMargin, t.top - o - this._popupOffset) - t.top;
70
+ this.style.setProperty("--scb-datepicker-top", `${e}px`), this.style.setProperty("--scb-datepicker-max-height", `${Math.max(0, l - this._popupOffset)}px`);
71
+ } else this.style.setProperty("--scb-datepicker-top", `${t.height + this._popupOffset}px`), this.style.setProperty("--scb-datepicker-max-height", `${Math.max(0, c - this._popupOffset)}px`);
69
72
  return;
70
73
  }
71
74
  let a = Math.min(e.offsetWidth || 380, i), o = e.offsetHeight || 420, s = Math.min(Math.max(t.left, this._viewportMargin), n - this._viewportMargin - a), c = r - t.bottom - this._viewportMargin, l = t.top - this._viewportMargin, u = c < o + this._popupOffset && l > c;
@@ -231,7 +234,7 @@ var c = class extends n {
231
234
  background: none;
232
235
  font-size: 16px;
233
236
  cursor: pointer;
234
- font-family: 'Inter';
237
+ font-family: var(--brand-font, Inter, Arial, sans-serif);
235
238
  align-content: center;
236
239
  }
237
240
  .day.selected {
@@ -42,7 +42,22 @@ var s = { fromAttribute(e) {
42
42
  if (this.__syncSlottedFormValues(e), !this.__validateFormAndSlottedFields(e)) return;
43
43
  e.requestSubmit();
44
44
  }
45
- this.__fire("submit"), this.__setOpen(!1);
45
+ }, this.__onFormSubmit = (e) => {
46
+ let t = e.currentTarget;
47
+ if (!(t instanceof HTMLFormElement)) return;
48
+ if (this.__syncSlottedFormValues(t), !this.__validateFormAndSlottedFields(t)) {
49
+ e.preventDefault();
50
+ return;
51
+ }
52
+ let n = new FormData(t);
53
+ if (!this.__fireCancelable("submit", {
54
+ form: t,
55
+ formData: n
56
+ })) {
57
+ e.preventDefault();
58
+ return;
59
+ }
60
+ this.__setOpen(!1);
46
61
  }, this.__onKeydownTrap = (e) => {
47
62
  if (!this.open || e.key !== "Tab") return;
48
63
  let t = Array.from(this.shadowRoot.querySelectorAll("button,[href],input,select,textarea,[tabindex]:not([tabindex=\"-1\"])")).filter((e) => !e.hasAttribute("disabled"));
@@ -336,6 +351,14 @@ var s = { fromAttribute(e) {
336
351
  composed: !0
337
352
  }));
338
353
  }
354
+ __fireCancelable(e, t) {
355
+ return this.dispatchEvent(new CustomEvent(e, {
356
+ detail: t,
357
+ bubbles: !0,
358
+ composed: !0,
359
+ cancelable: !0
360
+ }));
361
+ }
339
362
  __getSlottedElements() {
340
363
  let e = this.shadowRoot?.querySelector("slot");
341
364
  if (!(e instanceof HTMLSlotElement)) return [];
@@ -480,7 +503,7 @@ var s = { fromAttribute(e) {
480
503
  return this.variant === "form" ? r`
481
504
  ${this.renderHeader(e)}
482
505
  <div class="content" id=${t}>
483
- <form id=${this.formId} action=${this.formAction} method=${this.formMethod || i}>
506
+ <form id=${this.formId} action=${this.formAction} method=${this.formMethod || i} @submit=${this.__onFormSubmit}>
484
507
  <slot></slot>
485
508
  </form>
486
509
  </div>
@@ -49,6 +49,10 @@ var c = class extends n {
49
49
  this._inputFocused = !1, this.#o();
50
50
  }, this.type = "text", this.label = "", this.supportingText = "", this.helpText = "", this.helpLabel = "Visa hjälptext", this.errorText = "", this.leadingIcon = "", this.name = "", this.pattern = "", this.value = "", this.underLabel = "", this.error = !1, this.disabled = !1, this.required = !1, this.size = "large", this.spacing = void 0, this.spacingTop = void 0, this.spacingBottom = void 0, this.spacingLeft = void 0, this.spacingRight = void 0, this._form = null, this._formSubmitHandler = null, this._formResetHandler = null, this._initialValue = "", this._inputId = "", this._showDatepicker = !1, this._toggleDatepicker = () => {
51
51
  this._showDatepicker = !this._showDatepicker;
52
+ }, this._openDatepicker = () => {
53
+ this._showDatepicker = !0;
54
+ }, this._onDatepickerClosed = () => {
55
+ this._showDatepicker = !1;
52
56
  }, this._onDateSelected = (e) => {
53
57
  if (this.value = e.detail.value, this._showDatepicker = !1, this._internals) {
54
58
  let e = this.disabled ? null : this.value;
@@ -573,8 +577,8 @@ var c = class extends n {
573
577
  aria-invalid=${this.error ? "true" : "false"}
574
578
  aria-describedby=${n}
575
579
  readonly
576
- @focus=${this._toggleDatepicker}
577
- @click=${this._toggleDatepicker}
580
+ @focus=${this._openDatepicker}
581
+ @click=${this._openDatepicker}
578
582
  />
579
583
  <md-ripple></md-ripple>
580
584
  <md-focus-ring class="input-ring"></md-focus-ring>
@@ -592,6 +596,7 @@ var c = class extends n {
592
596
  .selectedValue=${this.value}
593
597
  .open=${this._showDatepicker}
594
598
  @date-selected=${this._onDateSelected}
599
+ @datepicker-closed=${this._onDatepickerClosed}
595
600
  ></scb-datepicker>
596
601
  </div>
597
602
  ` : this.type === "datetime-local" ? i`
@@ -611,8 +616,8 @@ var c = class extends n {
611
616
  aria-invalid=${this.error ? "true" : "false"}
612
617
  aria-describedby=${n}
613
618
  readonly
614
- @focus=${this._toggleDatepicker}
615
- @click=${this._toggleDatepicker}
619
+ @focus=${this._openDatepicker}
620
+ @click=${this._openDatepicker}
616
621
  />
617
622
 
618
623
  <md-ripple></md-ripple>
@@ -633,6 +638,7 @@ var c = class extends n {
633
638
  .selectedValue=${this.value}
634
639
  .open=${this._showDatepicker}
635
640
  @date-selected=${this._onDateSelected}
641
+ @datepicker-closed=${this._onDatepickerClosed}
636
642
  ></scb-datepicker>
637
643
  </div>
638
644
  ` : this.type === "time" ? i`
package/scb-wc.bundle.js CHANGED
@@ -4340,7 +4340,7 @@
4340
4340
  :host([overlay][direction='vertical'][anchor='start']) {
4341
4341
  left: calc(var(--scb-divider-gap) / -2);
4342
4342
  }
4343
- `}firstUpdated(){this.#e()}updated(e){e.has(`spacing`)&&this.#e()}mapSpacingToken(e){if(!e)return;let t=String(e).trim();if(t)return/^\d+$/.test(t)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(t,10)))})`:t}#e(){let e=this.mapSpacingToken(this.spacing);e?this.style.setProperty(`--scb-divider-spacing-orth`,e):this.style.removeProperty(`--scb-divider-spacing-orth`)}render(){return x``}},P([_({type:String,reflect:!0})],fu.prototype,`variant`,void 0),P([_({type:String,reflect:!0})],fu.prototype,`direction`,void 0),P([_({type:String,reflect:!0})],fu.prototype,`inset`,void 0),P([_({type:Boolean,reflect:!0})],fu.prototype,`overlay`,void 0),P([_({type:String,reflect:!0})],fu.prototype,`anchor`,void 0),P([_({type:String,reflect:!0})],fu.prototype,`spacing`,void 0),fu=P([a(`scb-divider`)],fu)}));w(),b(),Yc(),bc(),k(),E(),pu(),N(),F();var mu=class extends C{constructor(...e){super(...e),this._currentDate=new Date,this._selectedDate=null,this._showMonthDropdown=!1,this._showYearDropdown=!1,this.variant=`date`,this.lang=`sv`,this.selectedValue=``,this.open=!0,this._selectedHour=0,this._selectedMinute=0,this._viewportMargin=8,this._popupOffset=4,this._onWindowReposition=()=>{this._positionPopupWithinViewport()},this._monthNames=[this.lang==`sv`?`Januari`:`January`,this.lang==`sv`?`Februari`:`February`,this.lang==`sv`?`Mars`:`March`,(this.lang,`April`),this.lang==`sv`?`Maj`:`May`,this.lang==`sv`?`Juni`:`June`,this.lang==`sv`?`Juli`:`July`,this.lang==`sv`?`Augusti`:`August`,(this.lang,`September`),this.lang==`sv`?`Oktober`:`October`,(this.lang,`November`),(this.lang,`December`)],this._outsideClickHandler=e=>{this.open&&(e.composedPath().includes(this)||this._close())},this._prevMonth=()=>{let e=this._currentDate.getFullYear(),t=this._currentDate.getMonth();t===0?this._currentDate=new Date(e-1,11,1):this._currentDate=new Date(e,t-1,1)},this._prevYear=()=>{let e=this._currentDate.getFullYear(),t=this._currentDate.getMonth();this._currentDate=new Date(e-1,t,1)},this._nextMonth=()=>{let e=this._currentDate.getFullYear(),t=this._currentDate.getMonth();t===11?this._currentDate=new Date(e+1,0,1):this._currentDate=new Date(e,t+1,1)},this._nextYear=()=>{let e=this._currentDate.getFullYear(),t=this._currentDate.getMonth();this._currentDate=new Date(e+1,t,1)},this._onTimeChange=e=>{let[t,n]=e.target.value.split(`:`),r=parseInt(t,10),i=parseInt(n,10);this._selectedHour=isNaN(r)?0:Math.max(0,Math.min(23,r)),this._selectedMinute=isNaN(i)?0:Math.max(0,Math.min(59,i)),this._fireDateTimeChange()},this._close=()=>{this.open=!1,this.dispatchEvent(new CustomEvent(`datepicker-closed`,{bubbles:!0,composed:!0}))}}_isRenderedInsideDialog(){let e=this.getRootNode(),t=e instanceof ShadowRoot?e.host:null;return t instanceof HTMLElement&&t.closest(`scb-dialog`)?!0:!!this.closest(`scb-dialog`)}connectedCallback(){super.connectedCallback(),this._removeLazyFocusRingListeners=ac(this,this.renderRoot)}_positionPopupWithinViewport(){if(!this.open)return;let e=this.renderRoot.querySelector(`.datepicker-popup`);if(!e)return;let t=this.parentElement?.getBoundingClientRect();if(!t)return;let n=window.innerWidth,r=window.innerHeight,i=Math.max(220,n-this._viewportMargin*2);if(this._isRenderedInsideDialog()){let t=Math.min(e.offsetWidth||380,i),a=e.offsetHeight||420,o=(n-t)/2,s=(r-a)/2;this.style.setProperty(`--scb-datepicker-position`,`fixed`),this.style.setProperty(`--scb-datepicker-top`,`${s}px`),this.style.setProperty(`--scb-datepicker-bottom`,`auto`),this.style.setProperty(`--scb-datepicker-left`,`${o}px`),this.style.setProperty(`--scb-datepicker-transform`,`none`),this.style.setProperty(`--scb-datepicker-computed-width`,`${t}px`),this.style.setProperty(`--scb-datepicker-max-height`,`${Math.max(220,r-this._viewportMargin*2)}px`);return}let a=Math.min(e.offsetWidth||380,i),o=e.offsetHeight||420,s=Math.min(Math.max(t.left,this._viewportMargin),n-this._viewportMargin-a),c=r-t.bottom-this._viewportMargin,l=t.top-this._viewportMargin,u=c<o+this._popupOffset&&l>c;this.style.setProperty(`--scb-datepicker-position`,`fixed`),this.style.setProperty(`--scb-datepicker-computed-width`,`${a}px`),this.style.setProperty(`--scb-datepicker-left`,`${s}px`),this.style.setProperty(`--scb-datepicker-transform`,`none`),u?(this.style.setProperty(`--scb-datepicker-top`,`${Math.max(this._viewportMargin,t.top-o-this._popupOffset)}px`),this.style.setProperty(`--scb-datepicker-bottom`,`auto`),this.style.setProperty(`--scb-datepicker-max-height`,`${Math.max(0,l-this._popupOffset)}px`)):(this.style.setProperty(`--scb-datepicker-top`,`${t.bottom+this._popupOffset}px`),this.style.setProperty(`--scb-datepicker-bottom`,`auto`),this.style.setProperty(`--scb-datepicker-max-height`,`${Math.max(0,c-this._popupOffset)}px`))}static{this.styles=[p`
4343
+ `}firstUpdated(){this.#e()}updated(e){e.has(`spacing`)&&this.#e()}mapSpacingToken(e){if(!e)return;let t=String(e).trim();if(t)return/^\d+$/.test(t)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(t,10)))})`:t}#e(){let e=this.mapSpacingToken(this.spacing);e?this.style.setProperty(`--scb-divider-spacing-orth`,e):this.style.removeProperty(`--scb-divider-spacing-orth`)}render(){return x``}},P([_({type:String,reflect:!0})],fu.prototype,`variant`,void 0),P([_({type:String,reflect:!0})],fu.prototype,`direction`,void 0),P([_({type:String,reflect:!0})],fu.prototype,`inset`,void 0),P([_({type:Boolean,reflect:!0})],fu.prototype,`overlay`,void 0),P([_({type:String,reflect:!0})],fu.prototype,`anchor`,void 0),P([_({type:String,reflect:!0})],fu.prototype,`spacing`,void 0),fu=P([a(`scb-divider`)],fu)}));w(),b(),Yc(),bc(),k(),E(),pu(),N(),F();var mu=class extends C{constructor(...e){super(...e),this._currentDate=new Date,this._selectedDate=null,this._showMonthDropdown=!1,this._showYearDropdown=!1,this.variant=`date`,this.lang=`sv`,this.selectedValue=``,this.open=!0,this._selectedHour=0,this._selectedMinute=0,this._viewportMargin=8,this._popupOffset=4,this._onWindowReposition=()=>{this._positionPopupWithinViewport()},this._monthNames=[this.lang==`sv`?`Januari`:`January`,this.lang==`sv`?`Februari`:`February`,this.lang==`sv`?`Mars`:`March`,(this.lang,`April`),this.lang==`sv`?`Maj`:`May`,this.lang==`sv`?`Juni`:`June`,this.lang==`sv`?`Juli`:`July`,this.lang==`sv`?`Augusti`:`August`,(this.lang,`September`),this.lang==`sv`?`Oktober`:`October`,(this.lang,`November`),(this.lang,`December`)],this._outsideClickHandler=e=>{this.open&&(e.composedPath().includes(this)||this._close())},this._prevMonth=()=>{let e=this._currentDate.getFullYear(),t=this._currentDate.getMonth();t===0?this._currentDate=new Date(e-1,11,1):this._currentDate=new Date(e,t-1,1)},this._prevYear=()=>{let e=this._currentDate.getFullYear(),t=this._currentDate.getMonth();this._currentDate=new Date(e-1,t,1)},this._nextMonth=()=>{let e=this._currentDate.getFullYear(),t=this._currentDate.getMonth();t===11?this._currentDate=new Date(e+1,0,1):this._currentDate=new Date(e,t+1,1)},this._nextYear=()=>{let e=this._currentDate.getFullYear(),t=this._currentDate.getMonth();this._currentDate=new Date(e+1,t,1)},this._onTimeChange=e=>{let[t,n]=e.target.value.split(`:`),r=parseInt(t,10),i=parseInt(n,10);this._selectedHour=isNaN(r)?0:Math.max(0,Math.min(23,r)),this._selectedMinute=isNaN(i)?0:Math.max(0,Math.min(59,i)),this._fireDateTimeChange()},this._close=()=>{this.open=!1,this.dispatchEvent(new CustomEvent(`datepicker-closed`,{bubbles:!0,composed:!0}))}}_isRenderedInsideDialog(){let e=this.getRootNode(),t=e instanceof ShadowRoot?e.host:null;return t instanceof HTMLElement&&t.closest(`scb-dialog`)?!0:!!this.closest(`scb-dialog`)}connectedCallback(){super.connectedCallback(),this._removeLazyFocusRingListeners=ac(this,this.renderRoot)}_positionPopupWithinViewport(){if(!this.open)return;let e=this.renderRoot.querySelector(`.datepicker-popup`);if(!e)return;let t=this.parentElement?.getBoundingClientRect();if(!t)return;let n=window.innerWidth,r=window.innerHeight,i=Math.max(220,n-this._viewportMargin*2);if(this._isRenderedInsideDialog()){let a=Math.min(e.offsetWidth||380,i),o=e.offsetHeight||420,s=Math.min(Math.max(t.left,this._viewportMargin),n-this._viewportMargin-a),c=r-t.bottom-this._viewportMargin,l=t.top-this._viewportMargin,u=c<o+this._popupOffset&&l>c;if(this.style.setProperty(`--scb-datepicker-position`,`absolute`),this.style.setProperty(`--scb-datepicker-computed-width`,`${a}px`),this.style.setProperty(`--scb-datepicker-left`,`${s-t.left}px`),this.style.setProperty(`--scb-datepicker-transform`,`none`),this.style.setProperty(`--scb-datepicker-bottom`,`auto`),u){let e=Math.max(this._viewportMargin,t.top-o-this._popupOffset)-t.top;this.style.setProperty(`--scb-datepicker-top`,`${e}px`),this.style.setProperty(`--scb-datepicker-max-height`,`${Math.max(0,l-this._popupOffset)}px`)}else this.style.setProperty(`--scb-datepicker-top`,`${t.height+this._popupOffset}px`),this.style.setProperty(`--scb-datepicker-max-height`,`${Math.max(0,c-this._popupOffset)}px`);return}let a=Math.min(e.offsetWidth||380,i),o=e.offsetHeight||420,s=Math.min(Math.max(t.left,this._viewportMargin),n-this._viewportMargin-a),c=r-t.bottom-this._viewportMargin,l=t.top-this._viewportMargin,u=c<o+this._popupOffset&&l>c;this.style.setProperty(`--scb-datepicker-position`,`fixed`),this.style.setProperty(`--scb-datepicker-computed-width`,`${a}px`),this.style.setProperty(`--scb-datepicker-left`,`${s}px`),this.style.setProperty(`--scb-datepicker-transform`,`none`),u?(this.style.setProperty(`--scb-datepicker-top`,`${Math.max(this._viewportMargin,t.top-o-this._popupOffset)}px`),this.style.setProperty(`--scb-datepicker-bottom`,`auto`),this.style.setProperty(`--scb-datepicker-max-height`,`${Math.max(0,l-this._popupOffset)}px`)):(this.style.setProperty(`--scb-datepicker-top`,`${t.bottom+this._popupOffset}px`),this.style.setProperty(`--scb-datepicker-bottom`,`auto`),this.style.setProperty(`--scb-datepicker-max-height`,`${Math.max(0,c-this._popupOffset)}px`))}static{this.styles=[p`
4344
4344
  :host {
4345
4345
  --scb-datepicker-width: 380px;
4346
4346
  --scb-datepicker-z-index: 1100;
@@ -4499,7 +4499,7 @@
4499
4499
  background: none;
4500
4500
  font-size: 16px;
4501
4501
  cursor: pointer;
4502
- font-family: 'Inter';
4502
+ font-family: var(--brand-font, Inter, Arial, sans-serif);
4503
4503
  align-content: center;
4504
4504
  }
4505
4505
  .day.selected {
@@ -4635,7 +4635,7 @@
4635
4635
  `:``}
4636
4636
  </div>
4637
4637
  </div>
4638
- `}_getMonthDays(e,t){let n=new Date(Date.UTC(e,t,1)),r=new Date(Date.UTC(e,t+1,0)),i=[],a=[],o=n.getUTCDay(),s=o===0?6:o-1;for(let e=0;e<s;e++)a.push(null);for(let n=1;n<=r.getUTCDate();n++){let r=new Date(Date.UTC(e,t,n));a.push(r),a.length===7&&(i.push(a),a=[])}if(a.length){for(;a.length<7;)a.push(null);i.push(a)}return i}_toggleMonthDropdown(){this._showMonthDropdown=!this._showMonthDropdown,this._showMonthDropdown&&(this._showYearDropdown=!1,setTimeout(()=>{let e=this.renderRoot.querySelector(`#selected-month`);e&&e.scrollIntoView({block:`center`})},0))}_toggleYearDropdown(){this._showYearDropdown=!this._showYearDropdown,this._showYearDropdown&&(this._showMonthDropdown=!1,setTimeout(()=>{let e=this.renderRoot.querySelector(`#selected-year`);e&&e.scrollIntoView({block:`center`})},0))}_onMonthChangeCustom(e){let t=this._currentDate.getFullYear();this._currentDate=new Date(t,e,1),this._showMonthDropdown=!1}_onYearChangeCustom(e){let t=this._currentDate.getMonth();this._currentDate=new Date(e,t,1),this._showYearDropdown=!1}_isToday(e,t){return e.getDate()===t.getDate()&&e.getMonth()===t.getMonth()&&e.getFullYear()===t.getFullYear()}_isSelected(e){return this._selectedDate&&e.getDate()===this._selectedDate.getDate()&&e.getMonth()===this._selectedDate.getMonth()&&e.getFullYear()===this._selectedDate.getFullYear()}_selectDate(e){if(this._selectedDate=e,this.variant===`datetime-local`){let t=new Date(e);t.setHours(this._selectedHour??0,this._selectedMinute??0,0,0),this._selectedHour=t.getHours(),this._selectedMinute=t.getMinutes();let n=e=>e.toString().padStart(2,`0`),r=`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())} ${n(t.getHours())}:${n(t.getMinutes())}`;this.dispatchEvent(new CustomEvent(`date-selected`,{detail:{value:r},bubbles:!0,composed:!0}))}else{let t=e.toISOString().slice(0,10);this.dispatchEvent(new CustomEvent(`date-selected`,{detail:{value:t},bubbles:!0,composed:!0}))}}_fireDateTimeChange(){if(this.variant===`datetime-local`&&this._selectedDate){let e=new Date(this._selectedDate);e.setHours(this._selectedHour??0,this._selectedMinute??0,0,0);let t=e=>e.toString().padStart(2,`0`),n=`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())} ${t(e.getHours())}:${t(e.getMinutes())}`;this.dispatchEvent(new CustomEvent(`date-selected`,{detail:{value:n},bubbles:!0,composed:!0}))}}};P([v()],mu.prototype,`_currentDate`,void 0),P([v()],mu.prototype,`_selectedDate`,void 0),P([v()],mu.prototype,`_showMonthDropdown`,void 0),P([v()],mu.prototype,`_showYearDropdown`,void 0),P([_({type:String})],mu.prototype,`variant`,void 0),P([_({type:String})],mu.prototype,`lang`,void 0),P([_({type:String})],mu.prototype,`selectedValue`,void 0),P([_({type:Boolean})],mu.prototype,`open`,void 0),P([v()],mu.prototype,`_selectedHour`,void 0),P([v()],mu.prototype,`_selectedMinute`,void 0),mu=P([a(`scb-datepicker`)],mu),w(),b(),k(),E(),N(),Yc(),gl(),F();var H=class extends C{static{this.formAssociated=!0}constructor(){super(),this._internals=null,this._inputFocused=!1,this._kbShouldShowRing=!1,this._onGlobalKeydown=e=>{e.key===`Tab`&&(nc(),this._kbShouldShowRing=!0,this._inputFocused&&this.#o())},this._onGlobalPointerDown=()=>{this._kbShouldShowRing=!1,this._inputFocused&&this.#o()},this._hasRenderedOnce=!1,this._boundField=null,this._onFieldInput=()=>{let e=this._boundField;if(!e)return;let t=e;if(this.value=t.value,this._internals){let e=this.disabled?null:this.value;this._internals.setFormValue(e)}this.#n(),this.dispatchEvent(new Event(`input`,{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent(`onValueChanged`,{detail:{value:this.value},bubbles:!0,composed:!0}))},this._onFieldChange=()=>{this.dispatchEvent(new Event(`change`,{bubbles:!0,composed:!0}))},this._onFieldSelect=()=>{this.dispatchEvent(new Event(`select`,{bubbles:!0,composed:!0}))},this._onFieldFocus=()=>{this._inputFocused=!0,this.#o()},this._onFieldBlur=()=>{this._inputFocused=!1,this.#o()},this.type=`text`,this.label=``,this.supportingText=``,this.helpText=``,this.helpLabel=`Visa hjälptext`,this.errorText=``,this.leadingIcon=``,this.name=``,this.pattern=``,this.value=``,this.underLabel=``,this.error=!1,this.disabled=!1,this.required=!1,this.size=`large`,this.spacing=void 0,this.spacingTop=void 0,this.spacingBottom=void 0,this.spacingLeft=void 0,this.spacingRight=void 0,this._form=null,this._formSubmitHandler=null,this._formResetHandler=null,this._initialValue=``,this._inputId=``,this._showDatepicker=!1,this._toggleDatepicker=()=>{this._showDatepicker=!this._showDatepicker},this._onDateSelected=e=>{if(this.value=e.detail.value,this._showDatepicker=!1,this._internals){let e=this.disabled?null:this.value;this._internals.setFormValue(e)}this.#n(),this.dispatchEvent(new Event(`input`,{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent(`onValueChanged`,{detail:{value:this.value},bubbles:!0,composed:!0}))},`attachInternals`in this&&(this._internals=this.attachInternals())}static{this.styles=[p`
4638
+ `}_getMonthDays(e,t){let n=new Date(Date.UTC(e,t,1)),r=new Date(Date.UTC(e,t+1,0)),i=[],a=[],o=n.getUTCDay(),s=o===0?6:o-1;for(let e=0;e<s;e++)a.push(null);for(let n=1;n<=r.getUTCDate();n++){let r=new Date(Date.UTC(e,t,n));a.push(r),a.length===7&&(i.push(a),a=[])}if(a.length){for(;a.length<7;)a.push(null);i.push(a)}return i}_toggleMonthDropdown(){this._showMonthDropdown=!this._showMonthDropdown,this._showMonthDropdown&&(this._showYearDropdown=!1,setTimeout(()=>{let e=this.renderRoot.querySelector(`#selected-month`);e&&e.scrollIntoView({block:`center`})},0))}_toggleYearDropdown(){this._showYearDropdown=!this._showYearDropdown,this._showYearDropdown&&(this._showMonthDropdown=!1,setTimeout(()=>{let e=this.renderRoot.querySelector(`#selected-year`);e&&e.scrollIntoView({block:`center`})},0))}_onMonthChangeCustom(e){let t=this._currentDate.getFullYear();this._currentDate=new Date(t,e,1),this._showMonthDropdown=!1}_onYearChangeCustom(e){let t=this._currentDate.getMonth();this._currentDate=new Date(e,t,1),this._showYearDropdown=!1}_isToday(e,t){return e.getDate()===t.getDate()&&e.getMonth()===t.getMonth()&&e.getFullYear()===t.getFullYear()}_isSelected(e){return this._selectedDate&&e.getDate()===this._selectedDate.getDate()&&e.getMonth()===this._selectedDate.getMonth()&&e.getFullYear()===this._selectedDate.getFullYear()}_selectDate(e){if(this._selectedDate=e,this.variant===`datetime-local`){let t=new Date(e);t.setHours(this._selectedHour??0,this._selectedMinute??0,0,0),this._selectedHour=t.getHours(),this._selectedMinute=t.getMinutes();let n=e=>e.toString().padStart(2,`0`),r=`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())} ${n(t.getHours())}:${n(t.getMinutes())}`;this.dispatchEvent(new CustomEvent(`date-selected`,{detail:{value:r},bubbles:!0,composed:!0}))}else{let t=e.toISOString().slice(0,10);this.dispatchEvent(new CustomEvent(`date-selected`,{detail:{value:t},bubbles:!0,composed:!0}))}}_fireDateTimeChange(){if(this.variant===`datetime-local`&&this._selectedDate){let e=new Date(this._selectedDate);e.setHours(this._selectedHour??0,this._selectedMinute??0,0,0);let t=e=>e.toString().padStart(2,`0`),n=`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())} ${t(e.getHours())}:${t(e.getMinutes())}`;this.dispatchEvent(new CustomEvent(`date-selected`,{detail:{value:n},bubbles:!0,composed:!0}))}}};P([v()],mu.prototype,`_currentDate`,void 0),P([v()],mu.prototype,`_selectedDate`,void 0),P([v()],mu.prototype,`_showMonthDropdown`,void 0),P([v()],mu.prototype,`_showYearDropdown`,void 0),P([_({type:String})],mu.prototype,`variant`,void 0),P([_({type:String})],mu.prototype,`lang`,void 0),P([_({type:String})],mu.prototype,`selectedValue`,void 0),P([_({type:Boolean})],mu.prototype,`open`,void 0),P([v()],mu.prototype,`_selectedHour`,void 0),P([v()],mu.prototype,`_selectedMinute`,void 0),mu=P([a(`scb-datepicker`)],mu),w(),b(),k(),E(),N(),Yc(),gl(),F();var H=class extends C{static{this.formAssociated=!0}constructor(){super(),this._internals=null,this._inputFocused=!1,this._kbShouldShowRing=!1,this._onGlobalKeydown=e=>{e.key===`Tab`&&(nc(),this._kbShouldShowRing=!0,this._inputFocused&&this.#o())},this._onGlobalPointerDown=()=>{this._kbShouldShowRing=!1,this._inputFocused&&this.#o()},this._hasRenderedOnce=!1,this._boundField=null,this._onFieldInput=()=>{let e=this._boundField;if(!e)return;let t=e;if(this.value=t.value,this._internals){let e=this.disabled?null:this.value;this._internals.setFormValue(e)}this.#n(),this.dispatchEvent(new Event(`input`,{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent(`onValueChanged`,{detail:{value:this.value},bubbles:!0,composed:!0}))},this._onFieldChange=()=>{this.dispatchEvent(new Event(`change`,{bubbles:!0,composed:!0}))},this._onFieldSelect=()=>{this.dispatchEvent(new Event(`select`,{bubbles:!0,composed:!0}))},this._onFieldFocus=()=>{this._inputFocused=!0,this.#o()},this._onFieldBlur=()=>{this._inputFocused=!1,this.#o()},this.type=`text`,this.label=``,this.supportingText=``,this.helpText=``,this.helpLabel=`Visa hjälptext`,this.errorText=``,this.leadingIcon=``,this.name=``,this.pattern=``,this.value=``,this.underLabel=``,this.error=!1,this.disabled=!1,this.required=!1,this.size=`large`,this.spacing=void 0,this.spacingTop=void 0,this.spacingBottom=void 0,this.spacingLeft=void 0,this.spacingRight=void 0,this._form=null,this._formSubmitHandler=null,this._formResetHandler=null,this._initialValue=``,this._inputId=``,this._showDatepicker=!1,this._toggleDatepicker=()=>{this._showDatepicker=!this._showDatepicker},this._openDatepicker=()=>{this._showDatepicker=!0},this._onDatepickerClosed=()=>{this._showDatepicker=!1},this._onDateSelected=e=>{if(this.value=e.detail.value,this._showDatepicker=!1,this._internals){let e=this.disabled?null:this.value;this._internals.setFormValue(e)}this.#n(),this.dispatchEvent(new Event(`input`,{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent(`onValueChanged`,{detail:{value:this.value},bubbles:!0,composed:!0}))},`attachInternals`in this&&(this._internals=this.attachInternals())}static{this.styles=[p`
4639
4639
  :host {
4640
4640
  --scb-textfield-number-max-width: 280px;
4641
4641
  --scb-textfield-text-max-width: 400px;
@@ -5127,8 +5127,8 @@
5127
5127
  aria-invalid=${this.error?`true`:`false`}
5128
5128
  aria-describedby=${n}
5129
5129
  readonly
5130
- @focus=${this._toggleDatepicker}
5131
- @click=${this._toggleDatepicker}
5130
+ @focus=${this._openDatepicker}
5131
+ @click=${this._openDatepicker}
5132
5132
  />
5133
5133
  <md-ripple></md-ripple>
5134
5134
  <md-focus-ring class="input-ring"></md-focus-ring>
@@ -5146,6 +5146,7 @@
5146
5146
  .selectedValue=${this.value}
5147
5147
  .open=${this._showDatepicker}
5148
5148
  @date-selected=${this._onDateSelected}
5149
+ @datepicker-closed=${this._onDatepickerClosed}
5149
5150
  ></scb-datepicker>
5150
5151
  </div>
5151
5152
  `:this.type===`datetime-local`?x`
@@ -5165,8 +5166,8 @@
5165
5166
  aria-invalid=${this.error?`true`:`false`}
5166
5167
  aria-describedby=${n}
5167
5168
  readonly
5168
- @focus=${this._toggleDatepicker}
5169
- @click=${this._toggleDatepicker}
5169
+ @focus=${this._openDatepicker}
5170
+ @click=${this._openDatepicker}
5170
5171
  />
5171
5172
 
5172
5173
  <md-ripple></md-ripple>
@@ -5187,6 +5188,7 @@
5187
5188
  .selectedValue=${this.value}
5188
5189
  .open=${this._showDatepicker}
5189
5190
  @date-selected=${this._onDateSelected}
5191
+ @datepicker-closed=${this._onDatepickerClosed}
5190
5192
  ></scb-datepicker>
5191
5193
  </div>
5192
5194
  `:this.type===`time`?x`
@@ -5409,7 +5411,7 @@
5409
5411
  </div>`:S}
5410
5412
  </label>
5411
5413
  <slot></slot>
5412
- `}};P([_({type:Boolean,reflect:!0})],Su.prototype,`disabled`,void 0),P([_({type:Boolean,reflect:!0})],Su.prototype,`checked`,void 0),P([_({type:String,reflect:!0})],Su.prototype,`name`,void 0),P([_({type:String,reflect:!0})],Su.prototype,`value`,void 0),P([_({type:String,reflect:!0})],Su.prototype,`size`,void 0),P([_({type:Boolean,reflect:!0})],Su.prototype,`deselectable`,void 0),P([_({type:String})],Su.prototype,`label`,void 0),P([_({type:String,attribute:`supporting-text`})],Su.prototype,`supportingText`,void 0),P([_({type:String,attribute:`aria-label`})],Su.prototype,`ariaLabel`,void 0),Su=P([a(`scb-radio-button`)],Su),w(),b(),bc(),Yc(),Fc(),al(),k(),F();var Cu={fromAttribute(e){if(e===null)return!1;let t=e.trim().toLowerCase();return t!==`false`&&t!==`0`&&t!==`no`}},U=class extends C{constructor(...e){super(...e),this.open=!1,this.inSb=!1,this.scrimClose=!0,this.spacing=void 0,this.spacingTop=void 0,this.spacingBottom=void 0,this.spacingLeft=void 0,this.spacingRight=void 0,this.variant=`basic`,this.label=``,this.icon=``,this.supportingText=``,this.okButton=`OK`,this.cancelButton=`Avbryt`,this.deleteButton=`Delete`,this.confirmButton=`Ta bort`,this.denyButton=`Avbryt`,this.resetButton=`Återställ`,this.submitButton=`Spara`,this.formId=``,this.formAction=``,this.formMethod=``,this.__lastTriggerEl=null,this.__scrollLocked=!1,this.__onDocumentClick=e=>{this.__getActionFromEvent(e)===`toggle`&&(this.__setOpen(!this.open),e.stopPropagation())},this.__onDocumentKeydown=e=>{this.open&&e.key===`Escape`&&(this.__fire(`esc`),this.__setOpen(!1))},this.__onScrimClick=()=>{this.scrimClose&&(this.__fire(`scrim`),this.__setOpen(!1))},this.__onOk=()=>{this.__fire(`ok`),this.__setOpen(!1)},this.__onCancel=()=>{this.__fire(`cancel`),this.__setOpen(!1)},this.__onConfirm=()=>{this.__fire(`confirm`),this.__setOpen(!1)},this.__onDeny=()=>{this.__fire(`deny`),this.__setOpen(!1)},this.__onReset=()=>{let e=this.shadowRoot?.querySelector(`form`);e instanceof HTMLFormElement&&(this.__clearGeneratedFormValues(e),e.reset()),(this.shadowRoot?.querySelector(`slot`)?.assignedElements({flatten:!0})??[]).forEach(e=>{let t=e.tagName;t===`SCB-TEXTFIELD`&&(e.value=``),t===`SCB-CHECKBOX`&&(e.checked=!1),t===`SCB-RADIO-BUTTON`&&(e.checked=!1),t===`SCB-SWITCH`&&(e.selected=!1),t===`SCB-CHIP`&&(e.selected=!1)}),this.__fire(`reset`)},this.__onSubmit=()=>{let e=this.shadowRoot?.querySelector(`form`);if(e instanceof HTMLFormElement){if(this.__syncSlottedFormValues(e),!this.__validateFormAndSlottedFields(e))return;e.requestSubmit()}this.__fire(`submit`),this.__setOpen(!1)},this.__onKeydownTrap=e=>{if(!this.open||e.key!==`Tab`)return;let t=Array.from(this.shadowRoot.querySelectorAll(`button,[href],input,select,textarea,[tabindex]:not([tabindex="-1"])`)).filter(e=>!e.hasAttribute(`disabled`));if(!t.length)return;let n=t[0],r=t[t.length-1];e.shiftKey&&document.activeElement===n?(r.focus(),e.preventDefault()):!e.shiftKey&&document.activeElement===r&&(n.focus(),e.preventDefault())}}static{this.styles=p`
5414
+ `}};P([_({type:Boolean,reflect:!0})],Su.prototype,`disabled`,void 0),P([_({type:Boolean,reflect:!0})],Su.prototype,`checked`,void 0),P([_({type:String,reflect:!0})],Su.prototype,`name`,void 0),P([_({type:String,reflect:!0})],Su.prototype,`value`,void 0),P([_({type:String,reflect:!0})],Su.prototype,`size`,void 0),P([_({type:Boolean,reflect:!0})],Su.prototype,`deselectable`,void 0),P([_({type:String})],Su.prototype,`label`,void 0),P([_({type:String,attribute:`supporting-text`})],Su.prototype,`supportingText`,void 0),P([_({type:String,attribute:`aria-label`})],Su.prototype,`ariaLabel`,void 0),Su=P([a(`scb-radio-button`)],Su),w(),b(),bc(),Yc(),Fc(),al(),k(),F();var Cu={fromAttribute(e){if(e===null)return!1;let t=e.trim().toLowerCase();return t!==`false`&&t!==`0`&&t!==`no`}},U=class extends C{constructor(...e){super(...e),this.open=!1,this.inSb=!1,this.scrimClose=!0,this.spacing=void 0,this.spacingTop=void 0,this.spacingBottom=void 0,this.spacingLeft=void 0,this.spacingRight=void 0,this.variant=`basic`,this.label=``,this.icon=``,this.supportingText=``,this.okButton=`OK`,this.cancelButton=`Avbryt`,this.deleteButton=`Delete`,this.confirmButton=`Ta bort`,this.denyButton=`Avbryt`,this.resetButton=`Återställ`,this.submitButton=`Spara`,this.formId=``,this.formAction=``,this.formMethod=``,this.__lastTriggerEl=null,this.__scrollLocked=!1,this.__onDocumentClick=e=>{this.__getActionFromEvent(e)===`toggle`&&(this.__setOpen(!this.open),e.stopPropagation())},this.__onDocumentKeydown=e=>{this.open&&e.key===`Escape`&&(this.__fire(`esc`),this.__setOpen(!1))},this.__onScrimClick=()=>{this.scrimClose&&(this.__fire(`scrim`),this.__setOpen(!1))},this.__onOk=()=>{this.__fire(`ok`),this.__setOpen(!1)},this.__onCancel=()=>{this.__fire(`cancel`),this.__setOpen(!1)},this.__onConfirm=()=>{this.__fire(`confirm`),this.__setOpen(!1)},this.__onDeny=()=>{this.__fire(`deny`),this.__setOpen(!1)},this.__onReset=()=>{let e=this.shadowRoot?.querySelector(`form`);e instanceof HTMLFormElement&&(this.__clearGeneratedFormValues(e),e.reset()),(this.shadowRoot?.querySelector(`slot`)?.assignedElements({flatten:!0})??[]).forEach(e=>{let t=e.tagName;t===`SCB-TEXTFIELD`&&(e.value=``),t===`SCB-CHECKBOX`&&(e.checked=!1),t===`SCB-RADIO-BUTTON`&&(e.checked=!1),t===`SCB-SWITCH`&&(e.selected=!1),t===`SCB-CHIP`&&(e.selected=!1)}),this.__fire(`reset`)},this.__onSubmit=()=>{let e=this.shadowRoot?.querySelector(`form`);if(e instanceof HTMLFormElement){if(this.__syncSlottedFormValues(e),!this.__validateFormAndSlottedFields(e))return;e.requestSubmit()}},this.__onFormSubmit=e=>{let t=e.currentTarget;if(!(t instanceof HTMLFormElement))return;if(this.__syncSlottedFormValues(t),!this.__validateFormAndSlottedFields(t)){e.preventDefault();return}let n=new FormData(t);if(!this.__fireCancelable(`submit`,{form:t,formData:n})){e.preventDefault();return}this.__setOpen(!1)},this.__onKeydownTrap=e=>{if(!this.open||e.key!==`Tab`)return;let t=Array.from(this.shadowRoot.querySelectorAll(`button,[href],input,select,textarea,[tabindex]:not([tabindex="-1"])`)).filter(e=>!e.hasAttribute(`disabled`));if(!t.length)return;let n=t[0],r=t[t.length-1];e.shiftKey&&document.activeElement===n?(r.focus(),e.preventDefault()):!e.shiftKey&&document.activeElement===r&&(n.focus(),e.preventDefault())}}static{this.styles=p`
5413
5415
  :host {
5414
5416
  display:block;
5415
5417
  position:relative;
@@ -5620,7 +5622,7 @@
5620
5622
  to { opacity: 0; }
5621
5623
  }
5622
5624
 
5623
- `}__getActionFromEvent(e){if(!this.id)return null;for(let t of e.composedPath())if(t instanceof Element&&(t.getAttribute(`data-dialog-toggle`)===this.id||t.getAttribute(`aria-controls`)===this.id))return this.__lastTriggerEl=t,`toggle`;return null}connectedCallback(){super.connectedCallback(),this.__applyZIndex(),this.__applyMaxSize(),document.addEventListener(`click`,this.__onDocumentClick,!1),document.addEventListener(`keydown`,this.__onDocumentKeydown,!0),this.addEventListener(`keydown`,this.__onKeydownTrap)}disconnectedCallback(){document.removeEventListener(`click`,this.__onDocumentClick,!1),document.removeEventListener(`keydown`,this.__onDocumentKeydown,!0),this.removeEventListener(`keydown`,this.__onKeydownTrap),this.__toggleScrollLock(!1),super.disconnectedCallback()}__applyZIndex(){let e=typeof this.zIndex==`number`&&Number.isFinite(this.zIndex)?this.zIndex:void 0;if(e===void 0){this.style.removeProperty(`--z-dialog-scrim`),this.style.removeProperty(`--z-dialog`);return}this.style.setProperty(`--z-dialog-scrim`,String(e)),this.style.setProperty(`--z-dialog`,String(e+1))}__applyMaxSize(){let e=(this.maxW??``).trim(),t=(this.maxH??``).trim();e?(this.style.setProperty(`--scb-dialog-max-w`,e),this.style.setProperty(`--scb-dialog-width`,`min(${e}, 90vw)`)):(this.style.removeProperty(`--scb-dialog-max-w`),this.style.removeProperty(`--scb-dialog-width`)),t?this.style.setProperty(`--scb-dialog-max-h`,t):this.style.removeProperty(`--scb-dialog-max-h`)}updated(e){if(e.has(`zIndex`)&&this.__applyZIndex(),(e.has(`maxW`)||e.has(`maxH`))&&this.__applyMaxSize(),e.has(`open`)){let t=e.get(`open`);this.__updateTriggersExpanded(),this.open&&!t?!this.inSb&&!this.__usesInPlaceLayout()&&this.updateComplete.then(()=>{let e=this.shadowRoot?.querySelector(`button,[href],input,select,textarea,[tabindex]:not([tabindex="-1"])`);e?e.focus():this.shadowRoot?.querySelector(`.container`)?.focus()}):!this.open&&t&&this.__lastTriggerEl?.focus?.(),this.__toggleScrollLock(this.open)}(e.has(`spacing`)||e.has(`spacingTop`)||e.has(`spacingBottom`)||e.has(`spacingLeft`)||e.has(`spacingRight`))&&this.__applySpacing()}__updateTriggersExpanded(){this.id&&document.querySelectorAll(`[aria-controls="${this.id}"], [data-dialog-toggle="${this.id}"]`).forEach(e=>{e.hasAttribute(`aria-controls`)&&e.setAttribute(`aria-expanded`,String(this.open))})}__usesInPlaceLayout(){let e=getComputedStyle(this);return e.getPropertyValue(`--scb-dialog-scrim-position`).trim()===`relative`||e.getPropertyValue(`--scb-dialog-container-position`).trim()===`absolute`}__toggleScrollLock(e){let t=document.documentElement,n=document.body;if(e){if(this.__scrollLocked||this.inSb||this.__usesInPlaceLayout())return;let e=window.innerWidth-t.clientWidth;t.style.overflow=`hidden`,n.style.paddingRight=e>0?`${e}px`:``,this.__scrollLocked=!0;return}this.__scrollLocked&&=(t.style.overflow=``,n.style.paddingRight=``,!1)}mapSpacingToken(e){if(!e)return;let t=String(e).trim();if(t)return/^\d+$/.test(t)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(t,10)))})`:t}__applySpacing(){let e=this.mapSpacingToken(this.spacing),t=this.mapSpacingToken(this.spacingTop)??e,n=this.mapSpacingToken(this.spacingBottom)??e,r=this.mapSpacingToken(this.spacingLeft),i=this.mapSpacingToken(this.spacingRight);t?this.style.setProperty(`--scb-dialog-spacing-block-start`,t):this.style.removeProperty(`--scb-dialog-spacing-block-start`),n?this.style.setProperty(`--scb-dialog-spacing-block-end`,n):this.style.removeProperty(`--scb-dialog-spacing-block-end`),r?this.style.setProperty(`--scb-dialog-spacing-inline-start`,r):this.style.removeProperty(`--scb-dialog-spacing-inline-start`),i?this.style.setProperty(`--scb-dialog-spacing-inline-end`,i):this.style.removeProperty(`--scb-dialog-spacing-inline-end`)}__setOpen(e){this.open=e,this.__fire(e?`open`:`close`)}__fire(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0}))}__getSlottedElements(){let e=this.shadowRoot?.querySelector(`slot`);if(!(e instanceof HTMLSlotElement))return[];let t=e.assignedElements({flatten:!0}),n=[];for(let e of t)n.push(e,...Array.from(e.querySelectorAll(`*`)));return n}__appendHiddenFormValue(e,t,n){let r=document.createElement(`input`);r.type=`hidden`,r.name=t,r.value=n,r.setAttribute(`data-scb-dialog-generated`,`true`),e.append(r)}__clearGeneratedFormValues(e){e.querySelectorAll(`input[data-scb-dialog-generated="true"]`).forEach(e=>e.remove())}__syncSlottedFormValues(e){this.__clearGeneratedFormValues(e),this.__getSlottedElements().forEach(t=>{if(!(t instanceof HTMLElement))return;let n=(t.getAttribute(`name`)??``).trim();if(n&&!(t.disabled===!0||t.hasAttribute(`disabled`))){if(t instanceof HTMLInputElement){if(t.form===e)return;let r=(t.type||``).toLowerCase();if(r===`checkbox`||r===`radio`){t.checked&&this.__appendHiddenFormValue(e,n,t.value||`on`);return}this.__appendHiddenFormValue(e,n,t.value??``);return}if(t instanceof HTMLTextAreaElement){if(t.form===e)return;this.__appendHiddenFormValue(e,n,t.value??``);return}if(t instanceof HTMLSelectElement){if(t.form===e)return;if(t.multiple){Array.from(t.selectedOptions).forEach(t=>{this.__appendHiddenFormValue(e,n,t.value)});return}this.__appendHiddenFormValue(e,n,t.value??``);return}switch(t.tagName){case`SCB-TEXTFIELD`:this.__appendHiddenFormValue(e,n,String(t.value??``));return;case`SCB-CHECKBOX`:t.checked&&this.__appendHiddenFormValue(e,n,String(t.value??t.getAttribute(`value`)??`on`));return;case`SCB-RADIO-BUTTON`:t.checked&&this.__appendHiddenFormValue(e,n,String(t.value??t.getAttribute(`value`)??`on`));return;case`SCB-SWITCH`:(t.selected||t.checked)&&this.__appendHiddenFormValue(e,n,String(t.value??t.getAttribute(`value`)??`on`));return;case`SCB-CHIP`:t.selected&&this.__appendHiddenFormValue(e,n,String(t.value??t.getAttribute(`value`)??`on`));return;default:`value`in t&&this.__appendHiddenFormValue(e,n,String(t.value??``))}}})}__validateFormAndSlottedFields(e){let t=e=>e.disabled===!0||e.hasAttribute(`disabled`),n=e.reportValidity(),r=null,i=new Set;return this.__getSlottedElements().forEach(e=>{if(!(e instanceof HTMLElement)||i.has(e)||t(e))return;i.add(e);let a=e;if(e.tagName===`SCB-TEXTFIELD`&&a.error===!0){r||=e,n=!1;return}if(typeof a.reportValidity==`function`){let t=!!a.reportValidity();!t&&!r&&(r=e),n&&=t}}),!n&&r&&r.focus(),n}__slotIsEmpty(){let e=this.shadowRoot?.querySelector(`slot`);return e?e.assignedElements({flatten:!0}).length===0:!0}renderHeader(e){let t=this.variant===`form`||this.variant===`floating`||this.variant===`iframe`;return x`
5625
+ `}__getActionFromEvent(e){if(!this.id)return null;for(let t of e.composedPath())if(t instanceof Element&&(t.getAttribute(`data-dialog-toggle`)===this.id||t.getAttribute(`aria-controls`)===this.id))return this.__lastTriggerEl=t,`toggle`;return null}connectedCallback(){super.connectedCallback(),this.__applyZIndex(),this.__applyMaxSize(),document.addEventListener(`click`,this.__onDocumentClick,!1),document.addEventListener(`keydown`,this.__onDocumentKeydown,!0),this.addEventListener(`keydown`,this.__onKeydownTrap)}disconnectedCallback(){document.removeEventListener(`click`,this.__onDocumentClick,!1),document.removeEventListener(`keydown`,this.__onDocumentKeydown,!0),this.removeEventListener(`keydown`,this.__onKeydownTrap),this.__toggleScrollLock(!1),super.disconnectedCallback()}__applyZIndex(){let e=typeof this.zIndex==`number`&&Number.isFinite(this.zIndex)?this.zIndex:void 0;if(e===void 0){this.style.removeProperty(`--z-dialog-scrim`),this.style.removeProperty(`--z-dialog`);return}this.style.setProperty(`--z-dialog-scrim`,String(e)),this.style.setProperty(`--z-dialog`,String(e+1))}__applyMaxSize(){let e=(this.maxW??``).trim(),t=(this.maxH??``).trim();e?(this.style.setProperty(`--scb-dialog-max-w`,e),this.style.setProperty(`--scb-dialog-width`,`min(${e}, 90vw)`)):(this.style.removeProperty(`--scb-dialog-max-w`),this.style.removeProperty(`--scb-dialog-width`)),t?this.style.setProperty(`--scb-dialog-max-h`,t):this.style.removeProperty(`--scb-dialog-max-h`)}updated(e){if(e.has(`zIndex`)&&this.__applyZIndex(),(e.has(`maxW`)||e.has(`maxH`))&&this.__applyMaxSize(),e.has(`open`)){let t=e.get(`open`);this.__updateTriggersExpanded(),this.open&&!t?!this.inSb&&!this.__usesInPlaceLayout()&&this.updateComplete.then(()=>{let e=this.shadowRoot?.querySelector(`button,[href],input,select,textarea,[tabindex]:not([tabindex="-1"])`);e?e.focus():this.shadowRoot?.querySelector(`.container`)?.focus()}):!this.open&&t&&this.__lastTriggerEl?.focus?.(),this.__toggleScrollLock(this.open)}(e.has(`spacing`)||e.has(`spacingTop`)||e.has(`spacingBottom`)||e.has(`spacingLeft`)||e.has(`spacingRight`))&&this.__applySpacing()}__updateTriggersExpanded(){this.id&&document.querySelectorAll(`[aria-controls="${this.id}"], [data-dialog-toggle="${this.id}"]`).forEach(e=>{e.hasAttribute(`aria-controls`)&&e.setAttribute(`aria-expanded`,String(this.open))})}__usesInPlaceLayout(){let e=getComputedStyle(this);return e.getPropertyValue(`--scb-dialog-scrim-position`).trim()===`relative`||e.getPropertyValue(`--scb-dialog-container-position`).trim()===`absolute`}__toggleScrollLock(e){let t=document.documentElement,n=document.body;if(e){if(this.__scrollLocked||this.inSb||this.__usesInPlaceLayout())return;let e=window.innerWidth-t.clientWidth;t.style.overflow=`hidden`,n.style.paddingRight=e>0?`${e}px`:``,this.__scrollLocked=!0;return}this.__scrollLocked&&=(t.style.overflow=``,n.style.paddingRight=``,!1)}mapSpacingToken(e){if(!e)return;let t=String(e).trim();if(t)return/^\d+$/.test(t)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(t,10)))})`:t}__applySpacing(){let e=this.mapSpacingToken(this.spacing),t=this.mapSpacingToken(this.spacingTop)??e,n=this.mapSpacingToken(this.spacingBottom)??e,r=this.mapSpacingToken(this.spacingLeft),i=this.mapSpacingToken(this.spacingRight);t?this.style.setProperty(`--scb-dialog-spacing-block-start`,t):this.style.removeProperty(`--scb-dialog-spacing-block-start`),n?this.style.setProperty(`--scb-dialog-spacing-block-end`,n):this.style.removeProperty(`--scb-dialog-spacing-block-end`),r?this.style.setProperty(`--scb-dialog-spacing-inline-start`,r):this.style.removeProperty(`--scb-dialog-spacing-inline-start`),i?this.style.setProperty(`--scb-dialog-spacing-inline-end`,i):this.style.removeProperty(`--scb-dialog-spacing-inline-end`)}__setOpen(e){this.open=e,this.__fire(e?`open`:`close`)}__fire(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0}))}__fireCancelable(e,t){return this.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0,cancelable:!0}))}__getSlottedElements(){let e=this.shadowRoot?.querySelector(`slot`);if(!(e instanceof HTMLSlotElement))return[];let t=e.assignedElements({flatten:!0}),n=[];for(let e of t)n.push(e,...Array.from(e.querySelectorAll(`*`)));return n}__appendHiddenFormValue(e,t,n){let r=document.createElement(`input`);r.type=`hidden`,r.name=t,r.value=n,r.setAttribute(`data-scb-dialog-generated`,`true`),e.append(r)}__clearGeneratedFormValues(e){e.querySelectorAll(`input[data-scb-dialog-generated="true"]`).forEach(e=>e.remove())}__syncSlottedFormValues(e){this.__clearGeneratedFormValues(e),this.__getSlottedElements().forEach(t=>{if(!(t instanceof HTMLElement))return;let n=(t.getAttribute(`name`)??``).trim();if(n&&!(t.disabled===!0||t.hasAttribute(`disabled`))){if(t instanceof HTMLInputElement){if(t.form===e)return;let r=(t.type||``).toLowerCase();if(r===`checkbox`||r===`radio`){t.checked&&this.__appendHiddenFormValue(e,n,t.value||`on`);return}this.__appendHiddenFormValue(e,n,t.value??``);return}if(t instanceof HTMLTextAreaElement){if(t.form===e)return;this.__appendHiddenFormValue(e,n,t.value??``);return}if(t instanceof HTMLSelectElement){if(t.form===e)return;if(t.multiple){Array.from(t.selectedOptions).forEach(t=>{this.__appendHiddenFormValue(e,n,t.value)});return}this.__appendHiddenFormValue(e,n,t.value??``);return}switch(t.tagName){case`SCB-TEXTFIELD`:this.__appendHiddenFormValue(e,n,String(t.value??``));return;case`SCB-CHECKBOX`:t.checked&&this.__appendHiddenFormValue(e,n,String(t.value??t.getAttribute(`value`)??`on`));return;case`SCB-RADIO-BUTTON`:t.checked&&this.__appendHiddenFormValue(e,n,String(t.value??t.getAttribute(`value`)??`on`));return;case`SCB-SWITCH`:(t.selected||t.checked)&&this.__appendHiddenFormValue(e,n,String(t.value??t.getAttribute(`value`)??`on`));return;case`SCB-CHIP`:t.selected&&this.__appendHiddenFormValue(e,n,String(t.value??t.getAttribute(`value`)??`on`));return;default:`value`in t&&this.__appendHiddenFormValue(e,n,String(t.value??``))}}})}__validateFormAndSlottedFields(e){let t=e=>e.disabled===!0||e.hasAttribute(`disabled`),n=e.reportValidity(),r=null,i=new Set;return this.__getSlottedElements().forEach(e=>{if(!(e instanceof HTMLElement)||i.has(e)||t(e))return;i.add(e);let a=e;if(e.tagName===`SCB-TEXTFIELD`&&a.error===!0){r||=e,n=!1;return}if(typeof a.reportValidity==`function`){let t=!!a.reportValidity();!t&&!r&&(r=e),n&&=t}}),!n&&r&&r.focus(),n}__slotIsEmpty(){let e=this.shadowRoot?.querySelector(`slot`);return e?e.assignedElements({flatten:!0}).length===0:!0}renderHeader(e){let t=this.variant===`form`||this.variant===`floating`||this.variant===`iframe`;return x`
5624
5626
  <div class="header">
5625
5627
  <div class="title">
5626
5628
  ${this.icon?x`<md-icon class="dialog-icon">${this.icon}</md-icon>`:S}
@@ -5656,7 +5658,7 @@
5656
5658
  </div>`}}renderBody(e,t){return this.variant===`form`?x`
5657
5659
  ${this.renderHeader(e)}
5658
5660
  <div class="content" id=${t}>
5659
- <form id=${this.formId} action=${this.formAction} method=${this.formMethod||S}>
5661
+ <form id=${this.formId} action=${this.formAction} method=${this.formMethod||S} @submit=${this.__onFormSubmit}>
5660
5662
  <slot></slot>
5661
5663
  </form>
5662
5664
  </div>