scb-wc-test 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,48 +1,54 @@
1
- import{a as g,r as h,n as p,i as w,x as i,t as m}from"../../vendor/vendor.js";import"../scb-icon-button/scb-icon-button.js";import"../scb-button/scb-button.js";import"../../vendor/vendor-material.js";import"../scb-divider/scb-divider.js";import"../../vendor/preload-helper.js";(function(){try{var e=typeof globalThis<"u"?globalThis:window;if(!e.__scb_ce_guard_installed__){e.__scb_ce_guard_installed__=!0;var t=customElements.define.bind(customElements);customElements.define=function(a,c,s){try{customElements.get(a)||t(a,c,s)}catch(n){var o=String(n||"");if(o.indexOf("already been used")===-1&&o.indexOf("NotSupportedError")===-1)throw n}}}}catch{}})();var v=Object.defineProperty,_=Object.getOwnPropertyDescriptor,l=(e,t,a,c)=>{for(var s=c>1?void 0:c?_(t,a):t,o=e.length-1,n;o>=0;o--)(n=e[o])&&(s=(c?n(t,a,s):n(s))||s);return c&&s&&v(t,a,s),s};let d=class extends w{constructor(){super(...arguments),this._currentDate=new Date,this._selectedDate=null,this._showMonthDropdown=!1,this._showYearDropdown=!1,this.variant="static",this.lang="sv",this.selectedValue="",this.open=!0,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._prevYear=()=>{const e=this._currentDate.getFullYear(),t=this._currentDate.getMonth();this._currentDate=new Date(e-1,t,1)},this._nextYear=()=>{const e=this._currentDate.getFullYear(),t=this._currentDate.getMonth();this._currentDate=new Date(e+1,t,1)},this._prevMonth=()=>{const e=this._currentDate.getFullYear(),t=this._currentDate.getMonth();this._currentDate=new Date(e,t-1,1)},this._nextMonth=()=>{const e=this._currentDate.getFullYear(),t=this._currentDate.getMonth();this._currentDate=new Date(e,t+1,1)},this._close=()=>{this.open=!1,this.dispatchEvent(new CustomEvent("datepicker-closed",{bubbles:!0,composed:!0}))}}updated(e){if(super.updated(e),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))}}_getMonthDays(e,t){const a=new Date(e,t,1),c=new Date(e,t+1,0),s=[];let o=[],n=(a.getDay()+6)%7;for(let r=0;r<n;r++)o.push(null);for(let r=1;r<=c.getDate();r++){const u=new Date(e,t,r);o.push(u),o.length===7&&(s.push(o),o=[])}if(o.length){for(;o.length<7;)o.push(null);s.push(o)}return s}render(){if(!this.open)return i``;const e=this._currentDate.getFullYear(),t=this._currentDate.getMonth(),a=new Date,c=this._getMonthDays(e,t),s=Array.from({length:101},(o,n)=>a.getFullYear()-50+n);return i`
1
+ import{a as g,r as h,n as p,i as w,x as i,t as m}from"../../vendor/vendor.js";import"../scb-icon-button/scb-icon-button.js";import"../scb-button/scb-button.js";import"../../vendor/vendor-material.js";import"../scb-divider/scb-divider.js";import"../../vendor/preload-helper.js";(function(){try{var e=typeof globalThis<"u"?globalThis:window;if(!e.__scb_ce_guard_installed__){e.__scb_ce_guard_installed__=!0;var t=customElements.define.bind(customElements);customElements.define=function(a,c,r){try{customElements.get(a)||t(a,c,r)}catch(s){var o=String(s||"");if(o.indexOf("already been used")===-1&&o.indexOf("NotSupportedError")===-1)throw s}}}}catch{}})();var v=Object.defineProperty,_=Object.getOwnPropertyDescriptor,l=(e,t,a,c)=>{for(var r=c>1?void 0:c?_(t,a):t,o=e.length-1,s;o>=0;o--)(s=e[o])&&(r=(c?s(t,a,r):s(r))||r);return c&&r&&v(t,a,r),r};let d=class extends w{constructor(){super(...arguments),this._currentDate=new Date,this._selectedDate=null,this._showMonthDropdown=!1,this._showYearDropdown=!1,this.variant="static",this.lang="sv",this.selectedValue="",this.open=!0,this._outsideClickHandler=e=>{this.variant!=="static"&&this.open&&(e.composedPath().includes(this)||this._close())},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._prevYear=()=>{const e=this._currentDate.getFullYear(),t=this._currentDate.getMonth();this._currentDate=new Date(e-1,t,1)},this._nextYear=()=>{const e=this._currentDate.getFullYear(),t=this._currentDate.getMonth();this._currentDate=new Date(e+1,t,1)},this._prevMonth=()=>{const e=this._currentDate.getFullYear(),t=this._currentDate.getMonth();this._currentDate=new Date(e,t-1,1)},this._nextMonth=()=>{const e=this._currentDate.getFullYear(),t=this._currentDate.getMonth();this._currentDate=new Date(e,t+1,1)},this._close=()=>{this.open=!1,this.dispatchEvent(new CustomEvent("datepicker-closed",{bubbles:!0,composed:!0})),window.removeEventListener("mousedown",this._outsideClickHandler)}}updated(e){if(super.updated(e),this.variant!=="static"&&this.open?window.addEventListener("mousedown",this._outsideClickHandler):window.removeEventListener("mousedown",this._outsideClickHandler),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))}}_getMonthDays(e,t){const a=new Date(e,t,1),c=new Date(e,t+1,0),r=[];let o=[],s=(a.getDay()+6)%7;for(let n=0;n<s;n++)o.push(null);for(let n=1;n<=c.getDate();n++){const u=new Date(e,t,n);o.push(u),o.length===7&&(r.push(o),o=[])}if(o.length){for(;o.length<7;)o.push(null);r.push(o)}return r}render(){if(!this.open)return i``;const e=this._currentDate.getFullYear(),t=this._currentDate.getMonth(),a=new Date,c=this._getMonthDays(e,t),r=Array.from({length:101},(o,s)=>a.getFullYear()-50+s);return i`
2
2
  <div class="datepicker-popup ${this.variant==="popup"?"popup":"static"}">
3
3
  <div class="header">
4
4
  <div class="month-selector ${this._showMonthDropdown?"open":""} ${this._showYearDropdown?"disable":""}">
5
5
  <scb-icon-button icon="chevron_left" @click=${this._prevMonth} aria-label=${this.lang=="sv"?"Föregående månad":"Previous month"}></scb-icon-button>
6
6
  <div class="custom-dropdown month-dropdown">
7
- <div
8
- @keydown=${o=>{(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),this._toggleMonthDropdown())}}
9
- tabindex="0" class="dropdown-selected" @click=${()=>this._toggleMonthDropdown()}>
7
+ <div
8
+ tabindex=${this._showYearDropdown?-1:0}
9
+ class="dropdown-selected"
10
+ @click=${()=>this._toggleMonthDropdown()}
11
+ @keydown=${o=>{(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),this._toggleMonthDropdown())}}
12
+ >
10
13
  ${this._monthNames[t].slice(0,3)}
11
14
  <md-icon>arrow_drop_down</md-icon>
12
15
  <md-focus-ring></md-focus-ring>
13
16
  <md-ripple></md-ripple>
14
- </div>
17
+ </div>
15
18
  </div>
16
19
  <scb-icon-button icon="chevron_right" @click=${this._nextMonth} aria-label=${this.lang=="sv"?"Nästa månad":"Next month"}></scb-icon-button>
17
20
  </div>
18
21
  <div class="year-selector ${this._showMonthDropdown?"disable":""} ${this._showYearDropdown?"open":""}">
19
22
  <scb-icon-button icon="chevron_left" @click=${this._prevYear} aria-label=${this.lang=="sv"?"Föregående år":"Previous year"}></scb-icon-button>
20
23
  <div class="custom-dropdown year-dropdown">
21
- <div
22
- @keydown=${o=>{(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),this._toggleYearDropdown())}}
23
- tabindex="0" class="dropdown-selected" @click=${()=>this._toggleYearDropdown()}>
24
- ${e}
25
- <md-icon>arrow_drop_down</md-icon>
26
- <md-focus-ring></md-focus-ring>
27
- <md-ripple></md-ripple>
24
+ <div
25
+ tabindex=${this._showMonthDropdown?-1:0}
26
+ class="dropdown-selected"
27
+ @click=${()=>this._toggleYearDropdown()}
28
+ @keydown=${o=>{(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),this._toggleYearDropdown())}}
29
+ >
30
+ ${e}
31
+ <md-icon>arrow_drop_down</md-icon>
32
+ <md-focus-ring></md-focus-ring>
33
+ <md-ripple></md-ripple>
28
34
  </div>
29
35
  </div>
30
36
  <scb-icon-button icon="chevron_right" @click=${this._nextYear} aria-label=${this.lang=="sv"?"Nästa år":"Next year"}></scb-icon-button>
31
37
  </div>
32
38
  </div>
33
- ${this._showMonthDropdown||this._showYearDropdown?i`<scb-divider></scb-divider>`:""}
39
+ ${this._showMonthDropdown||this._showYearDropdown?i`<scb-divider></scb-divider>`:""}
34
40
  <div class="datepicker-content" style="position:relative;">
35
41
  ${this._showMonthDropdown?i`
36
42
  <div class="dropdown-list">
37
- ${this._monthNames.map((o,n)=>i`
43
+ ${this._monthNames.map((o,s)=>i`
38
44
  <div
39
- @keydown=${r=>{(r.key==="Enter"||r.key===" ")&&(r.preventDefault(),this._onMonthChangeCustom(n))}}
45
+ @keydown=${n=>{(n.key==="Enter"||n.key===" ")&&(n.preventDefault(),this._onMonthChangeCustom(s))}}
40
46
  tabindex="0"
41
- class="dropdown-item${n===t?" selected":""}"
42
- @click=${()=>this._onMonthChangeCustom(n)}
43
- id=${n===t?"selected-month":""}
47
+ class="dropdown-item${s===t?" selected":""}"
48
+ @click=${()=>this._onMonthChangeCustom(s)}
49
+ id=${s===t?"selected-month":""}
44
50
  >
45
- ${n===t?i`<md-icon>check</md-icon>`:""}
51
+ ${s===t?i`<md-icon>check</md-icon>`:""}
46
52
  ${o}
47
53
  <md-ripple></md-ripple><md-focus-ring inward></md-focus-ring>
48
54
  </div>
@@ -51,9 +57,9 @@ import{a as g,r as h,n as p,i as w,x as i,t as m}from"../../vendor/vendor.js";im
51
57
  `:""}
52
58
  ${this._showYearDropdown?i`
53
59
  <div class="dropdown-list">
54
- ${s.map(o=>i`
60
+ ${r.map(o=>i`
55
61
  <div
56
- @keydown=${n=>{(n.key==="Enter"||n.key===" ")&&(n.preventDefault(),this._onYearChangeCustom(o))}}
62
+ @keydown=${s=>{(s.key==="Enter"||s.key===" ")&&(s.preventDefault(),this._onYearChangeCustom(o))}}
57
63
  tabindex="0"
58
64
  class="dropdown-item${o===e?" selected":""}"
59
65
  @click=${()=>this._onYearChangeCustom(o)}
@@ -77,15 +83,15 @@ import{a as g,r as h,n as p,i as w,x as i,t as m}from"../../vendor/vendor.js";im
77
83
  <tbody>
78
84
  ${c.map(o=>i`
79
85
  <tr>
80
- ${o.map(n=>n?i`
86
+ ${o.map(s=>s?i`
81
87
  <td>
82
88
  <div
83
- @keydown=${r=>{(r.key==="Enter"||r.key===" ")&&(r.preventDefault(),this._selectDate(n))}}
89
+ @keydown=${n=>{(n.key==="Enter"||n.key===" ")&&(n.preventDefault(),this._selectDate(s))}}
84
90
  role="button"
85
91
  tabindex="0"
86
- class="day${this._isToday(n,a)?" today":""}${this._isSelected(n)?" selected":""}"
87
- @click=${()=>this._selectDate(n)}
88
- >${n.getDate()}<md-ripple></md-ripple><md-focus-ring></md-focus-ring></div>
92
+ class="day${this._isToday(s,a)?" today":""}${this._isSelected(s)?" selected":""}"
93
+ @click=${()=>this._selectDate(s)}
94
+ >${s.getDate()}<md-ripple></md-ripple><md-focus-ring></md-focus-ring></div>
89
95
  </td>
90
96
  `:i`<td></td>`)}
91
97
  </tr>
@@ -96,7 +102,7 @@ import{a as g,r as h,n as p,i as w,x as i,t as m}from"../../vendor/vendor.js";im
96
102
  `:""}
97
103
  </div>
98
104
  <div class="datepicker-footer">
99
- ${!this._showMonthDropdown&&!this._showYearDropdown?i`
105
+ ${!this._showMonthDropdown&&!this._showYearDropdown&&this.variant=="popup"?i`
100
106
  <scb-button variant="text" label=${this.lang=="sv"?"Stäng":"Close"} @click=${this._close}></scb-button>
101
107
  `:""}
102
108
  </div>
@@ -104,9 +110,10 @@ import{a as g,r as h,n as p,i as w,x as i,t as m}from"../../vendor/vendor.js";im
104
110
  `}_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){this._selectedDate=e;const t=e.toISOString().slice(0,10);this.dispatchEvent(new CustomEvent("date-selected",{detail:{value:t},bubbles:!0,composed:!0}))}};d.styles=[g`
105
111
  :host {
106
112
  --scb-datepicker-width: 380px;
107
- width: var(--scb-datepicker-width);
113
+ max-width: var(--scb-datepicker-width);
108
114
  font-family: var(--brand-font);
109
115
  color: var(--md-sys-color-on-surface);
116
+ display: block;
110
117
  }
111
118
  .month-selector, .year-selector {
112
119
  display: flex;
@@ -178,9 +185,24 @@ import{a as g,r as h,n as p,i as w,x as i,t as m}from"../../vendor/vendor.js";im
178
185
  font-family: var(--brand-font);
179
186
  }
180
187
  .datepicker-content{
181
- overflow-y: auto;
182
- max-height: 260px;
188
+ overflow-y: auto;
189
+ max-height: 290px;
183
190
  }
191
+ .datepicker-content::-webkit-scrollbar {
192
+ width: 12px;
193
+ background: var(--md-sys-color-surface);
194
+ border-radius: var(--md-sys-shape-corner-small);
195
+ }
196
+ .datepicker-content::-webkit-scrollbar-thumb {
197
+ background: var(--md-sys-color-outline);
198
+ border-radius: var(--md-sys-shape-corner-small);
199
+ border: 4px solid var(--md-sys-color-surface);
200
+
201
+ }
202
+ .datepicker-content::-webkit-scrollbar-track {
203
+ background: var(--md-sys-color-surface);
204
+ border-radius: var(--md-sys-shape-corner-small);
205
+ }
184
206
  .popup {
185
207
  position:absolute;
186
208
  top:110%;
@@ -191,8 +213,8 @@ import{a as g,r as h,n as p,i as w,x as i,t as m}from"../../vendor/vendor.js";im
191
213
  display: flex;
192
214
  align-items: center;
193
215
  justify-content: space-between;
194
- margin-bottom: 12px;
195
- padding: 16px 24px 0 16px;
216
+ margin-bottom: 30px;
217
+ padding: 20px 16px 0px 16px;
196
218
  flex-wrap: wrap;
197
219
  }
198
220
  .datepicker-footer{
@@ -214,7 +236,7 @@ import{a as g,r as h,n as p,i as w,x as i,t as m}from"../../vendor/vendor.js";im
214
236
  color: var(--md-sys-color-on-surface-variant, #757575);
215
237
  font-size: 16px;
216
238
  font-weight: 600;
217
- padding: 4px;
239
+ padding-bottom: 20px;
218
240
  }
219
241
  td {
220
242
  text-align: center;
@@ -189,7 +189,7 @@ import{a as y,n as c,i as x,E as b,x as u,t as w}from"../../vendor/vendor.js";im
189
189
  line-height: var(--scb-search-line-height);
190
190
 
191
191
  color: var(--md-sys-color-on-surface);
192
- background: var(--md-sys-color-surface);
192
+ background: transparent;
193
193
 
194
194
  position: relative;
195
195
  z-index: 1;
@@ -235,7 +235,7 @@ import{a as y,n as c,i as x,E as b,x as u,t as w}from"../../vendor/vendor.js";im
235
235
  left: 0;
236
236
  width: 100%;
237
237
  z-index: 10;
238
- background: var(--md-sys-color-surface);
238
+ background: var(--md-sys-color-surface-container-lowest);
239
239
  border: var(--stroke-border, 1px) solid var(--md-sys-color-outline);
240
240
  border-top: 0;
241
241
  border-radius: 0 0 var(--scb-search-open-radius) var(--scb-search-open-radius);
@@ -1,4 +1,4 @@
1
- import{a as m,n as a,i as x,x as h,t as v}from"../../vendor/vendor.js";import"../../vendor/vendor-material.js";import"../scb-datepicker/scb-datepicker.js";import"../scb-icon-button/scb-icon-button.js";import"../../vendor/preload-helper.js";import"../scb-button/scb-button.js";import"../scb-divider/scb-divider.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,l,o){try{customElements.get(i)||e(i,l,o)}catch(c){var d=String(c||"");if(d.indexOf("already been used")===-1&&d.indexOf("NotSupportedError")===-1)throw c}}}}catch{}})();var y=Object.defineProperty,g=Object.getOwnPropertyDescriptor,f=t=>{throw TypeError(t)},r=(t,e,i,l)=>{for(var o=l>1?void 0:l?g(e,i):e,d=t.length-1,c;d>=0;d--)(c=t[d])&&(o=(l?c(e,i,o):c(o))||o);return l&&o&&y(e,i,o),o},_=(t,e,i)=>e.has(t)||f("Cannot "+i),w=(t,e,i)=>e.has(t)?f("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,i),p=(t,e,i)=>(_(t,e,"access private method"),i),n,b,u;let s=class extends x{constructor(){super(),w(this,n),this._internals=null,this.type="text",this.label="",this.supportingText="",this.errorText="",this.leadingIcon="",this.name="",this.pattern="",this.value="",this.underLabel="",this.error=!1,this.disabled=!1,this.required=!1,this.spacing="",this.spacingTop="",this.spacingBottom="",this._form=null,this._formSubmitHandler=null,this._formResetHandler=null,this._initialValue="",this._inputId="",this._showDatepicker=!1,this._toggleDatepicker=()=>{this._showDatepicker=!this._showDatepicker},this._onDateSelected=t=>{this.value=t.detail.value,this._showDatepicker=!1,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())}render(){const t=this.leadingIcon?h`<md-icon class="scb-textfield-icon">${this.leadingIcon}</md-icon>`:null,e=this.error?h`<md-icon class="scb-textfield-error-icon" aria-hidden="true">error</md-icon>`:null;this.underLabel=this.error?this.errorText||"Ogiltig inmatning.":this.supportingText,this.value=this.value||"";const i=this.underLabel?`${this._inputId}-supporting-text`:void 0,l=this.type==="search"&&this.value?h`
1
+ import{a as v,n as a,i as x,x as h,t as y}from"../../vendor/vendor.js";import"../../vendor/vendor-material.js";import"../scb-datepicker/scb-datepicker.js";import"../scb-icon-button/scb-icon-button.js";import"../../vendor/preload-helper.js";import"../scb-button/scb-button.js";import"../scb-divider/scb-divider.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,l){try{customElements.get(i)||e(i,o,l)}catch(p){var c=String(p||"");if(c.indexOf("already been used")===-1&&c.indexOf("NotSupportedError")===-1)throw p}}}}catch{}})();var g=Object.defineProperty,_=Object.getOwnPropertyDescriptor,m=t=>{throw TypeError(t)},r=(t,e,i,o)=>{for(var l=o>1?void 0:o?_(e,i):e,c=t.length-1,p;c>=0;c--)(p=t[c])&&(l=(o?p(e,i,l):p(l))||l);return o&&l&&g(e,i,l),l},w=(t,e,i)=>e.has(t)||m("Cannot "+i),k=(t,e,i)=>e.has(t)?m("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,i),d=(t,e,i)=>(w(t,e,"access private method"),i),n,f,b,u;let s=class extends x{constructor(){super(),k(this,n),this._internals=null,this._inputFocused=!1,this._kbShouldShowRing=!1,this._onGlobalKeydown=t=>{t.key==="Tab"&&(this._kbShouldShowRing=!0,this._inputFocused&&d(this,n,u).call(this))},this._onGlobalPointerDown=()=>{this._kbShouldShowRing=!1,this._inputFocused&&d(this,n,u).call(this)},this.type="text",this.label="",this.supportingText="",this.errorText="",this.leadingIcon="",this.name="",this.pattern="",this.value="",this.underLabel="",this.error=!1,this.disabled=!1,this.required=!1,this.spacing="",this.spacingTop="",this.spacingBottom="",this._form=null,this._formSubmitHandler=null,this._formResetHandler=null,this._initialValue="",this._inputId="",this._showDatepicker=!1,this._toggleDatepicker=()=>{this._showDatepicker=!this._showDatepicker},this._onDateSelected=t=>{this.value=t.detail.value,this._showDatepicker=!1,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())}render(){const t=this.leadingIcon?h`<md-icon class="scb-textfield-icon">${this.leadingIcon}</md-icon>`:null,e=this.error?h`<md-icon class="scb-textfield-error-icon" aria-hidden="true">error</md-icon>`:null;this.underLabel=this.error?this.errorText||"Ogiltig inmatning.":this.supportingText,this.value=this.value||"";const i=this.underLabel?`${this._inputId}-supporting-text`:void 0,o=this.type==="search"&&this.value?h`
2
2
  <button
3
3
  type="button"
4
4
  class="scb-textfield-clear"
@@ -39,7 +39,7 @@ import{a as m,n as a,i as x,x as h,t as v}from"../../vendor/vendor.js";import"..
39
39
  id="${this.underLabel?`${this._inputId}-supporting-text`:""}"
40
40
  >${this.underLabel}</span
41
41
  >
42
- <div class="scb-textfield-wrapper">
42
+ <div class="scb-textfield-wrapper ripple-wrapper">
43
43
  <textarea
44
44
  class="scb-textfield"
45
45
  ?disabled=${this.disabled}
@@ -51,6 +51,8 @@ import{a as m,n as a,i as x,x as h,t as v}from"../../vendor/vendor.js";import"..
51
51
  >
52
52
  ${this.value}</textarea
53
53
  >
54
+ <md-ripple></md-ripple>
55
+ <md-focus-ring class="input-ring"></md-focus-ring>
54
56
  </div>
55
57
  `:this.type==="date"?h`
56
58
  <label class="scb-textfield-label" for="${this._inputId}">${this.label}</label>
@@ -89,7 +91,7 @@ ${this.value}</textarea
89
91
  id="${this.underLabel?`${this._inputId}-supporting-text`:""}"
90
92
  >${this.underLabel}</span
91
93
  >
92
- <div class="scb-textfield-wrapper">
94
+ <div class="scb-textfield-wrapper ripple-wrapper">
93
95
  ${t}
94
96
  <input
95
97
  class="scb-textfield${this.error?" has-error-icon":""}"
@@ -102,10 +104,12 @@ ${this.value}</textarea
102
104
  aria-invalid=${this.error?"true":"false"}
103
105
  aria-describedby=${i}
104
106
  />
105
- ${l}
107
+ ${o}
106
108
  ${e}
109
+ <md-ripple></md-ripple>
110
+ <md-focus-ring class="input-ring"></md-focus-ring>
107
111
  </div>
108
- `}firstUpdated(t){super.firstUpdated(t),this._initialValue=this.value;const e=this.shadowRoot?.querySelector(".scb-textfield");e&&(e.addEventListener("input",()=>{const i=e;if(this.value=i.value,this._internals){const l=this.disabled?null:this.value;this._internals.setFormValue(l)}if(this.pattern){const l=new RegExp(this.pattern);this.error=!l.test(this.value)}this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("onValueChanged",{detail:{value:this.value},bubbles:!0,composed:!0}))}),e.addEventListener("change",()=>{this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}),e.addEventListener("select",()=>{this.dispatchEvent(new Event("select",{bubbles:!0,composed:!0}))})),p(this,n,b).call(this)}updated(t){if(super.updated(t),this.toggleAttribute("aria-disabled",this.disabled),this._internals&&(t.has("value")||t.has("disabled"))){const e=this.disabled?null:this.value;this._internals.setFormValue(e)}(t.has("spacing")||t.has("spacingTop")||t.has("spacingBottom"))&&p(this,n,b).call(this)}formDisabledCallback(t){this.disabled=t}connectedCallback(){super.connectedCallback(),this._inputId=this.id||`scb-textfield-${Math.random().toString(36).substr(2,9)}`,this._formSubmitHandler=t=>{this.reportValidity()||(t.preventDefault(),t.stopPropagation())},this._form=this.closest("form"),this._form&&(this._form.addEventListener("submit",this._formSubmitHandler,!0),this._formResetHandler=()=>{this.value=this._initialValue;const t=this.shadowRoot?.querySelector(".scb-textfield");t&&(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement)&&(t.value=this._initialValue),this.error=!1},this._form.addEventListener("reset",this._formResetHandler,!0))}disconnectedCallback(){super.disconnectedCallback(),this._form&&this._formSubmitHandler&&(this._form.removeEventListener("submit",this._formSubmitHandler,!0),this._formResetHandler&&this._form.removeEventListener("reset",this._formResetHandler,!0))}reportValidity(){const t=this.shadowRoot?.querySelector(".scb-textfield");if(t&&(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement)){this.required&&!t.value?t.setCustomValidity(this.errorText||"Ogiltig inmatning."):t.setCustomValidity("");const e=t.reportValidity();this.error=!e;const i=e?"":this.errorText||t.validationMessage||"Ogiltig inmatning.";return e||(this.errorText=i),this._internals&&(e?this._internals.setValidity({}):this._internals.setValidity({customError:!0},i,t)),e}return!0}_onClearClick(){const t=this.shadowRoot?.querySelector(".scb-textfield");if(t&&(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement)){if(t.value="",this.value="",this._internals){const e=this.disabled?null:this.value;this._internals.setFormValue(e),this._internals.setValidity({})}this.error=!1,t.setCustomValidity(""),this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("onValueChanged",{detail:{value:this.value},bubbles:!0,composed:!0})),t.focus()}}};n=new WeakSet;b=function(){const t=p(this,n,u).call(this,this.spacing),e=p(this,n,u).call(this,this.spacingTop)??t,i=p(this,n,u).call(this,this.spacingBottom)??t;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")};u=function(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};s.formAssociated=!0;s.styles=[m`
112
+ `}firstUpdated(t){super.firstUpdated(t),this._initialValue=this.value;const e=this.shadowRoot?.querySelector(".scb-textfield");e&&(e.addEventListener("input",()=>{const i=e;if(this.value=i.value,this._internals){const o=this.disabled?null:this.value;this._internals.setFormValue(o)}if(this.pattern){const o=new RegExp(this.pattern);this.error=!o.test(this.value)}this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("onValueChanged",{detail:{value:this.value},bubbles:!0,composed:!0}))}),e.addEventListener("change",()=>{this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}),e.addEventListener("select",()=>{this.dispatchEvent(new Event("select",{bubbles:!0,composed:!0}))}),e.addEventListener("focus",()=>{this._inputFocused=!0,d(this,n,u).call(this)}),e.addEventListener("blur",()=>{this._inputFocused=!1,d(this,n,u).call(this)})),d(this,n,f).call(this)}updated(t){if(super.updated(t),this.toggleAttribute("aria-disabled",this.disabled),this._internals&&(t.has("value")||t.has("disabled"))){const e=this.disabled?null:this.value;this._internals.setFormValue(e)}(t.has("spacing")||t.has("spacingTop")||t.has("spacingBottom"))&&d(this,n,f).call(this)}formDisabledCallback(t){this.disabled=t}connectedCallback(){super.connectedCallback(),this._inputId=this.id||`scb-textfield-${Math.random().toString(36).substr(2,9)}`,this._formSubmitHandler=t=>{this.reportValidity()||(t.preventDefault(),t.stopPropagation())},this._form=this.closest("form"),this._form&&(this._form.addEventListener("submit",this._formSubmitHandler,!0),this._formResetHandler=()=>{this.value=this._initialValue;const t=this.shadowRoot?.querySelector(".scb-textfield");t&&(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement)&&(t.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)),window.removeEventListener("keydown",this._onGlobalKeydown,!0),window.removeEventListener("pointerdown",this._onGlobalPointerDown,!0)}reportValidity(){const t=this.shadowRoot?.querySelector(".scb-textfield");if(t&&(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement)){this.required&&!t.value?t.setCustomValidity(this.errorText||"Ogiltig inmatning."):t.setCustomValidity("");const e=t.reportValidity();this.error=!e;const i=e?"":this.errorText||t.validationMessage||"Ogiltig inmatning.";return e||(this.errorText=i),this._internals&&(e?this._internals.setValidity({}):this._internals.setValidity({customError:!0},i,t)),e}return!0}_onClearClick(){const t=this.shadowRoot?.querySelector(".scb-textfield");if(t&&(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement)){if(t.value="",this.value="",this._internals){const e=this.disabled?null:this.value;this._internals.setFormValue(e),this._internals.setValidity({})}this.error=!1,t.setCustomValidity(""),this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("onValueChanged",{detail:{value:this.value},bubbles:!0,composed:!0})),t.focus()}}};n=new WeakSet;f=function(){const t=d(this,n,b).call(this,this.spacing),e=d(this,n,b).call(this,this.spacingTop)??t,i=d(this,n,b).call(this,this.spacingBottom)??t;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")};b=function(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};u=function(){const t=this.renderRoot?.querySelector(".ripple-wrapper");t&&(this._inputFocused&&this._kbShouldShowRing?t.setAttribute("data-kb-focus","true"):t.removeAttribute("data-kb-focus"))};s.formAssociated=!0;s.styles=[v`
109
113
  :host {
110
114
  --scb-textfield-number-max-width: 280px;
111
115
  --scb-textfield-text-max-width: 400px;
@@ -121,6 +125,8 @@ ${this.value}</textarea
121
125
  /* Vertikalt avstånd styrs av spacing-attributen via CSS-variabler */
122
126
  margin-block-start: var(--scb-textfield-spacing-block-start, 0);
123
127
  margin-block-end: var(--scb-textfield-spacing-block-end, 0);
128
+
129
+ -webkit-tap-highlight-color: transparent;
124
130
  }
125
131
 
126
132
  :host([type='number']) {
@@ -200,6 +206,8 @@ ${this.value}</textarea
200
206
  box-sizing: border-box;
201
207
  background-color: transparent;
202
208
  color: var(--md-sys-color-on-surface);
209
+ position: relative;
210
+ z-index: 1;
203
211
  }
204
212
 
205
213
  :host([type='search']) .scb-textfield {
@@ -217,6 +225,7 @@ ${this.value}</textarea
217
225
  transform: translateY(-50%);
218
226
  pointer-events: none;
219
227
  font-size: var(--scale-06);
228
+ z-index: 2;
220
229
  }
221
230
 
222
231
  .scb-textfield:focus-visible {
@@ -231,6 +240,35 @@ ${this.value}</textarea
231
240
  width: 100%;
232
241
  }
233
242
 
243
+ /* Wrapper som bär ripple och md-focus-ring */
244
+ .ripple-wrapper {
245
+ position: relative;
246
+ width: 100%;
247
+ }
248
+
249
+ md-focus-ring.input-ring {
250
+ position: absolute;
251
+ inset: 0;
252
+ pointer-events: none;
253
+ display: none;
254
+ border-radius: var(--md-sys-shape-corner-small);
255
+ z-index: 3;
256
+ }
257
+
258
+ .ripple-wrapper[data-kb-focus='true'] md-focus-ring.input-ring {
259
+ display: block;
260
+ }
261
+
262
+ md-ripple {
263
+ border-radius: var(--md-sys-shape-corner-small);
264
+ position: absolute;
265
+ inset: 0;
266
+ z-index: 0;
267
+ pointer-events: none;
268
+ --md-ripple-hover-color: transparent;
269
+ --md-ripple-hover-opacity: 0;
270
+ }
271
+
234
272
  input[type='search']::-webkit-search-cancel-button {
235
273
  appearance: none;
236
274
  display: none;
@@ -244,6 +282,7 @@ ${this.value}</textarea
244
282
  pointer-events: none;
245
283
  font-size: var(--scale-06);
246
284
  color: var(--md-sys-color-error);
285
+ z-index: 2;
247
286
  }
248
287
 
249
288
  .scb-textfield.has-error-icon {
@@ -269,6 +308,7 @@ ${this.value}</textarea
269
308
  justify-content: center;
270
309
  cursor: pointer;
271
310
  color: var(--md-sys-color-on-surface);
311
+ z-index: 2;
272
312
  }
273
313
 
274
314
  :host([error]) .scb-textfield-clear {
@@ -285,4 +325,4 @@ ${this.value}</textarea
285
325
  height: 100%;
286
326
  display: block;
287
327
  }
288
- `];r([a({type:String,reflect:!0})],s.prototype,"type",2);r([a({type:String})],s.prototype,"label",2);r([a({type:String,attribute:"supporting-text"})],s.prototype,"supportingText",2);r([a({type:String,attribute:"error-text"})],s.prototype,"errorText",2);r([a({type:String,attribute:"leading-icon"})],s.prototype,"leadingIcon",2);r([a({type:String})],s.prototype,"name",2);r([a({type:String})],s.prototype,"pattern",2);r([a({type:String,attribute:"value"})],s.prototype,"value",2);r([a({type:String})],s.prototype,"underLabel",2);r([a({type:Boolean,reflect:!0})],s.prototype,"error",2);r([a({type:Boolean,reflect:!0})],s.prototype,"disabled",2);r([a({type:Boolean,reflect:!0})],s.prototype,"required",2);r([a({type:String,reflect:!0})],s.prototype,"spacing",2);r([a({type:String,attribute:"spacing-top",reflect:!0})],s.prototype,"spacingTop",2);r([a({type:String,attribute:"spacing-bottom",reflect:!0})],s.prototype,"spacingBottom",2);r([a({type:Boolean})],s.prototype,"_showDatepicker",2);s=r([v("scb-textfield")],s);
328
+ `];r([a({type:String,reflect:!0})],s.prototype,"type",2);r([a({type:String})],s.prototype,"label",2);r([a({type:String,attribute:"supporting-text"})],s.prototype,"supportingText",2);r([a({type:String,attribute:"error-text"})],s.prototype,"errorText",2);r([a({type:String,attribute:"leading-icon"})],s.prototype,"leadingIcon",2);r([a({type:String})],s.prototype,"name",2);r([a({type:String})],s.prototype,"pattern",2);r([a({type:String,attribute:"value"})],s.prototype,"value",2);r([a({type:String})],s.prototype,"underLabel",2);r([a({type:Boolean,reflect:!0})],s.prototype,"error",2);r([a({type:Boolean,reflect:!0})],s.prototype,"disabled",2);r([a({type:Boolean,reflect:!0})],s.prototype,"required",2);r([a({type:String,reflect:!0})],s.prototype,"spacing",2);r([a({type:String,attribute:"spacing-top",reflect:!0})],s.prototype,"spacingTop",2);r([a({type:String,attribute:"spacing-bottom",reflect:!0})],s.prototype,"spacingBottom",2);r([a({type:Boolean})],s.prototype,"_showDatepicker",2);s=r([y("scb-textfield")],s);