scb-wc 0.1.74 → 0.1.76

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.
Files changed (88) hide show
  1. package/README.md +41 -22
  2. package/all.js +0 -2
  3. package/index.js +88 -90
  4. package/mvc/components/all.js +0 -2
  5. package/mvc/components/scb-accordion/scb-accordion-item.js +2 -2
  6. package/mvc/components/scb-avatar/scb-avatar.js +2 -2
  7. package/mvc/components/scb-breadcrumb/scb-breadcrumb.js +33 -15
  8. package/mvc/components/scb-button/scb-button.js +80 -41
  9. package/mvc/components/scb-calendar/scb-calendar.js +1 -1
  10. package/mvc/components/scb-calendar-card/scb-calendar-card.js +4 -4
  11. package/mvc/components/scb-card/scb-card.js +3 -3
  12. package/mvc/components/scb-checkbox/scb-checkbox.js +32 -7
  13. package/mvc/components/scb-chip/scb-chip.js +6 -6
  14. package/mvc/components/scb-dialog/scb-dialog.js +1 -1
  15. package/mvc/components/scb-dropdown/scb-dropdown.js +1 -1
  16. package/mvc/components/scb-fab/scb-fab.js +24 -6
  17. package/mvc/components/scb-fact-card/scb-fact-card.js +4 -4
  18. package/mvc/components/scb-header/scb-header.js +474 -124
  19. package/mvc/components/scb-horizontal-scroller/scb-horizontal-scroller.js +1 -1
  20. package/mvc/components/scb-icon-button/scb-icon-button.js +2 -2
  21. package/mvc/components/scb-keyfigure-card/scb-keyfigure-card.js +2 -2
  22. package/mvc/components/scb-link/scb-link.js +14 -10
  23. package/mvc/components/scb-list/scb-list-item.js +5 -5
  24. package/mvc/components/scb-list/scb-list.js +3 -3
  25. package/mvc/components/scb-menu/scb-menu-item.js +2 -2
  26. package/mvc/components/scb-nav/scb-nav.js +1 -1
  27. package/mvc/components/scb-notification-card/scb-notification-card.js +1 -1
  28. package/mvc/components/scb-options-menu/scb-options-menu-item.js +1 -1
  29. package/mvc/components/scb-pagination/scb-pagination.js +1 -1
  30. package/mvc/components/scb-progress-stepper/scb-progress-step.js +1 -1
  31. package/mvc/components/scb-radio-button/scb-radio-button.js +39 -9
  32. package/mvc/components/scb-search/scb-search.js +3 -3
  33. package/mvc/components/scb-segmented-button/scb-segmented-item.js +1 -1
  34. package/mvc/components/scb-select/scb-select-option.js +3 -3
  35. package/mvc/components/scb-select/scb-select.js +1 -1
  36. package/mvc/components/scb-slider/scb-slider.js +58 -4
  37. package/mvc/components/scb-status-pill/scb-status-pill.js +1 -1
  38. package/mvc/components/scb-stepper/scb-step.js +1 -1
  39. package/mvc/components/scb-switch/scb-switch.js +51 -6
  40. package/mvc/components/scb-tabs/scb-primary-tab.js +3 -2
  41. package/mvc/components/scb-tabs/scb-secondary-tab.js +3 -2
  42. package/mvc/components/scb-tabs/scb-tabs.js +11 -2
  43. package/mvc/components/scb-textfield/scb-textfield.js +319 -24
  44. package/mvc/components/scb-toc/scb-toc-item.js +1 -1
  45. package/mvc/components/scb-tooltip/scb-tooltip.js +1 -1
  46. package/mvc/vendor/assist-chip.js +20 -0
  47. package/mvc/vendor/attachable-controller.js +1 -0
  48. package/mvc/vendor/checkbox-validator.js +1 -0
  49. package/mvc/vendor/chip-set.js +2 -0
  50. package/mvc/vendor/chip.js +18 -0
  51. package/mvc/vendor/delegate.js +1 -0
  52. package/mvc/vendor/element-internals.js +1 -0
  53. package/mvc/vendor/elevation.js +2 -0
  54. package/mvc/vendor/filled-icon-button.js +2 -0
  55. package/mvc/vendor/filled-tonal-icon-button.js +2 -0
  56. package/mvc/vendor/filter-chip.js +43 -0
  57. package/mvc/vendor/focusable.js +1 -0
  58. package/mvc/vendor/form-associated.js +1 -0
  59. package/mvc/vendor/form-label-activation.js +1 -0
  60. package/mvc/vendor/form-submitter.js +1 -0
  61. package/mvc/vendor/icon-button.js +2 -0
  62. package/mvc/vendor/icon.js +2 -0
  63. package/mvc/vendor/list.js +8 -0
  64. package/mvc/vendor/md-focus-ring.js +2 -0
  65. package/mvc/vendor/outlined-icon-button.js +2 -0
  66. package/mvc/vendor/redispatch-event.js +1 -0
  67. package/mvc/vendor/ripple.js +2 -0
  68. package/mvc/vendor/rolldown-runtime.js +1 -0
  69. package/mvc/{components/scb-chevron → vendor}/scb-chevron.js +1 -1
  70. package/mvc/vendor/shared-styles.js +3 -0
  71. package/mvc/vendor/shared-styles2.js +30 -0
  72. package/mvc/vendor/tab-styles.js +17 -0
  73. package/mvc/vendor/validator.js +1 -0
  74. package/package.json +2 -2
  75. package/scb-breadcrumb/scb-breadcrumb.js +38 -21
  76. package/scb-chevron/scb-chevron.js +0 -1
  77. package/scb-components/scb-header/scb-header.d.ts +11 -4
  78. package/scb-datepicker/scb-datepicker.js +0 -1
  79. package/scb-header/scb-header.js +512 -156
  80. package/scb-link/scb-link.js +24 -20
  81. package/scb-wc-public-entry/index.d.ts +97 -0
  82. package/scb-wc.bundle.js +728 -358
  83. package/scb-wc.d.ts +194 -198
  84. package/mvc/components/scb-datepicker/scb-datepicker.js +0 -296
  85. package/mvc/vendor/vendor-material.js +0 -364
  86. package/scb-components/index.d.ts +0 -99
  87. package/scb-components/scb-chevron/scb-chevron.d.ts +0 -11
  88. package/scb-components/scb-datepicker/scb-datepicker.d.ts +0 -39
@@ -1,4 +1,299 @@
1
- import"../../vendor/vendor-material.js";import{_,b as w,g as $,h as d,m as k,y as o}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import{t as r}from"../../vendor/decorate.js";import{n as z,t as a}from"../../vendor/assertClassBrand.js";import"../scb-icon-button/scb-icon-button.js";import"../scb-datepicker/scb-datepicker.js";(function(){try{var t=typeof globalThis<"u"?globalThis:window;if(!t.__scb_ce_guard_installed__){t.__scb_ce_guard_installed__=!0;var e=customElements.define.bind(customElements);customElements.define=function(i,n,c){try{customElements.get(i)||e(i,n,c)}catch(b){var p=String(b||"");if(p.indexOf("already been used")===-1&&p.indexOf("NotSupportedError")===-1)throw b}}}}catch{}})();var s,u,l=(s=new WeakSet,u=class extends _{constructor(){super(),z(this,s),this._internals=null,this._inputFocused=!1,this._kbShouldShowRing=!1,this._onGlobalKeydown=e=>{e.key==="Tab"&&(this._kbShouldShowRing=!0,this._inputFocused&&a(s,this,g).call(this))},this._onGlobalPointerDown=()=>{this._kbShouldShowRing=!1,this._inputFocused&&a(s,this,g).call(this)},this._hasRenderedOnce=!1,this._boundField=null,this._onFieldInput=()=>{const e=this._boundField;if(!e)return;const i=e;if(this.value=i.value,this._internals){const n=this.disabled?null:this.value;this._internals.setFormValue(n)}a(s,this,f).call(this),this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("onValueChanged",{detail:{value:this.value},bubbles:!0,composed:!0}))},this._onFieldChange=()=>{this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))},this._onFieldSelect=()=>{this.dispatchEvent(new Event("select",{bubbles:!0,composed:!0}))},this._onFieldFocus=()=>{this._inputFocused=!0,a(s,this,g).call(this)},this._onFieldBlur=()=>{this._inputFocused=!1,a(s,this,g).call(this)},this.type="text",this.label="",this.supportingText="",this.errorText="",this.leadingIcon="",this.name="",this.pattern="",this.value="",this.underLabel="",this.error=!1,this.disabled=!1,this.required=!1,this.size="large",this.spacing=void 0,this.spacingTop=void 0,this.spacingBottom=void 0,this.spacingLeft=void 0,this.spacingRight=void 0,this._form=null,this._formSubmitHandler=null,this._formResetHandler=null,this._initialValue="",this._inputId="",this._showDatepicker=!1,this._toggleDatepicker=()=>{this._showDatepicker=!this._showDatepicker},this._onDateSelected=e=>{if(this.value=e.detail.value,this._showDatepicker=!1,this._internals){const i=this.disabled?null:this.value;this._internals.setFormValue(i)}a(s,this,f).call(this),this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("onValueChanged",{detail:{value:this.value},bubbles:!0,composed:!0}))},"attachInternals"in this&&(this._internals=this.attachInternals())}_syncDensityForSize(){this.size==="extra-small"?this.setAttribute("data-density","-5"):this.size==="small"?this.setAttribute("data-density","-4"):this.size==="medium"?this.setAttribute("data-density","-2"):this.removeAttribute("data-density")}render(){const e=this.leadingIcon?o`<md-icon class="scb-textfield-icon">${this.leadingIcon}</md-icon>`:null,i=this.error?o`<md-icon class="scb-textfield-error-icon" aria-hidden="true">error</md-icon>`:null;this.underLabel=this.error?this.errorText||"Ogiltig inmatning.":this.supportingText,this.value=this.value||"";const n=this.underLabel?`${this._inputId}-supporting-text`:void 0,c=this.type==="search"&&this.value?o`
1
+ import{_ as M,b as S,g as E,h as p,m,y as a}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import"../../vendor/md-focus-ring.js";import"../../vendor/icon.js";import"../../vendor/ripple.js";import{t as r}from"../../vendor/decorate.js";import{n as Y,t as b}from"../../vendor/assertClassBrand.js";import"../scb-button/scb-button.js";import"../scb-icon-button/scb-icon-button.js";import"../scb-divider/scb-divider.js";(function(){try{var s=typeof globalThis<"u"?globalThis:window;if(!s.__scb_ce_guard_installed__){s.__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(l){var u=String(l||"");if(u.indexOf("already been used")===-1&&u.indexOf("NotSupportedError")===-1)throw l}}}}catch{}})();var k,g=(k=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(),i=this._currentDate.getMonth();i===0?this._currentDate=new Date(t-1,11,1):this._currentDate=new Date(t,i-1,1)},this._prevYear=()=>{const t=this._currentDate.getFullYear(),i=this._currentDate.getMonth();this._currentDate=new Date(t-1,i,1)},this._nextMonth=()=>{const t=this._currentDate.getFullYear(),i=this._currentDate.getMonth();i===11?this._currentDate=new Date(t+1,0,1):this._currentDate=new Date(t,i+1,1)},this._nextYear=()=>{const t=this._currentDate.getFullYear(),i=this._currentDate.getMonth();this._currentDate=new Date(t+1,i,1)},this._onTimeChange=t=>{const[i,o]=t.target.value.split(":"),u=parseInt(i,10),l=parseInt(o,10);this._selectedHour=isNaN(u)?0:Math.max(0,Math.min(23,u)),this._selectedMinute=isNaN(l)?0:Math.max(0,Math.min(59,l)),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")}_positionPopupWithinViewport(){if(!this.open)return;const e=this.renderRoot.querySelector(".datepicker-popup");if(!e)return;const t=this.parentElement?.getBoundingClientRect();if(!t)return;const i=window.innerWidth,o=window.innerHeight,u=Math.max(220,i-this._viewportMargin*2);if(this._isRenderedInsideDialog()){const $=Math.min(e.offsetWidth||380,u),C=e.offsetHeight||420,T=(i-$)/2,V=(o-C)/2,H=T-t.left,I=V-t.top;this.style.setProperty("--scb-datepicker-position","absolute"),this.style.setProperty("--scb-datepicker-top",`${I}px`),this.style.setProperty("--scb-datepicker-bottom","auto"),this.style.setProperty("--scb-datepicker-left",`${H}px`),this.style.setProperty("--scb-datepicker-transform","none"),this.style.setProperty("--scb-datepicker-computed-width",`${$}px`),this.style.setProperty("--scb-datepicker-max-height",`${Math.max(220,o-this._viewportMargin*2)}px`);return}const l=Math.min(e.offsetWidth||380,u),n=e.offsetHeight||420,d=Math.min(Math.max(t.left,this._viewportMargin),i-this._viewportMargin-l)-t.left,f=o-t.bottom-this._viewportMargin,x=t.top-this._viewportMargin,L=f<n+this._popupOffset&&x>f;this.style.setProperty("--scb-datepicker-position","absolute"),this.style.setProperty("--scb-datepicker-computed-width",`${l}px`),this.style.setProperty("--scb-datepicker-left","0"),this.style.setProperty("--scb-datepicker-transform",`translateX(${d}px)`),L?(this.style.setProperty("--scb-datepicker-top","auto"),this.style.setProperty("--scb-datepicker-bottom",`calc(100% + ${this._popupOffset}px)`),this.style.setProperty("--scb-datepicker-max-height",`${Math.max(0,x-this._popupOffset)}px`)):(this.style.setProperty("--scb-datepicker-top",`calc(100% + ${this._popupOffset}px)`),this.style.setProperty("--scb-datepicker-bottom","auto"),this.style.setProperty("--scb-datepicker-max-height",`${Math.max(0,f-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(){window.removeEventListener("mousedown",this._outsideClickHandler),window.removeEventListener("resize",this._onWindowReposition),window.removeEventListener("scroll",this._onWindowReposition,!0),super.disconnectedCallback()}render(){if(!this.open)return a``;const e=this._currentDate.getFullYear(),t=this._currentDate.getMonth(),i=new Date,o=this._getMonthDays(e,t),u=Array.from({length:101},(n,d)=>i.getFullYear()-50+d),l=this.variant==="datetime-local"&&!this._showMonthDropdown&&!this._showYearDropdown;return a`
2
+ <div class="datepicker-popup popup">
3
+ <div class="header">
4
+ <div class="month-selector ${this._showMonthDropdown?"open":""} ${this._showYearDropdown?"disable":""}">
5
+ <scb-icon-button icon="chevron_left" @click=${this._prevMonth} aria-label=${this.lang=="sv"?"Föregående månad":"Previous month"}></scb-icon-button>
6
+ <div class="custom-dropdown month-dropdown">
7
+ <div
8
+ tabindex=${this._showYearDropdown?-1:0}
9
+ class="dropdown-selected"
10
+ @click=${()=>this._toggleMonthDropdown()}
11
+ @keydown=${n=>{(n.key==="Enter"||n.key===" ")&&(n.preventDefault(),this._toggleMonthDropdown())}}
12
+ >
13
+ ${this._monthNames[t].slice(0,3)}
14
+ <md-icon>arrow_drop_down</md-icon>
15
+ <md-focus-ring></md-focus-ring>
16
+ <md-ripple></md-ripple>
17
+ </div>
18
+ </div>
19
+ <scb-icon-button icon="chevron_right" @click=${this._nextMonth} aria-label=${this.lang=="sv"?"Nästa månad":"Next month"}></scb-icon-button>
20
+ </div>
21
+ <div class="year-selector ${this._showMonthDropdown?"disable":""} ${this._showYearDropdown?"open":""}">
22
+ <scb-icon-button icon="chevron_left" @click=${this._prevYear} aria-label=${this.lang=="sv"?"Föregående år":"Previous year"}></scb-icon-button>
23
+ <div class="custom-dropdown year-dropdown">
24
+ <div
25
+ tabindex=${this._showMonthDropdown?-1:0}
26
+ class="dropdown-selected"
27
+ @click=${()=>this._toggleYearDropdown()}
28
+ @keydown=${n=>{(n.key==="Enter"||n.key===" ")&&(n.preventDefault(),this._toggleYearDropdown())}}
29
+ >
30
+ ${e}
31
+ <md-icon>arrow_drop_down</md-icon>
32
+ <md-focus-ring></md-focus-ring>
33
+ <md-ripple></md-ripple>
34
+ </div>
35
+ </div>
36
+ <scb-icon-button icon="chevron_right" @click=${this._nextYear} aria-label=${this.lang=="sv"?"Nästa år":"Next year"}></scb-icon-button>
37
+ </div>
38
+ </div>
39
+ ${this._showMonthDropdown||this._showYearDropdown?a`<scb-divider></scb-divider>`:""}
40
+ <div class="datepicker-content" style="position:relative;">
41
+ ${this._showMonthDropdown?a`
42
+ <div class="dropdown-list">
43
+ ${this._monthNames.map((n,d)=>a`
44
+ <div
45
+ @keydown=${f=>{(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),this._onMonthChangeCustom(d))}}
46
+ tabindex="0"
47
+ class="dropdown-item${d===t?" selected":""}"
48
+ @click=${()=>this._onMonthChangeCustom(d)}
49
+ id=${d===t?"selected-month":""}
50
+ >
51
+ ${d===t?a`<md-icon>check</md-icon>`:""}
52
+ ${n}
53
+ <md-ripple></md-ripple><md-focus-ring inward></md-focus-ring>
54
+ </div>
55
+ `)}
56
+ </div>
57
+ `:""}
58
+ ${this._showYearDropdown?a`
59
+ <div class="dropdown-list">
60
+ ${u.map(n=>a`
61
+ <div
62
+ @keydown=${d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),this._onYearChangeCustom(n))}}
63
+ tabindex="0"
64
+ class="dropdown-item${n===e?" selected":""}"
65
+ @click=${()=>this._onYearChangeCustom(n)}
66
+ id=${n===e?"selected-year":""}
67
+ >
68
+ ${n===e?a`<md-icon>check</md-icon>`:""}
69
+ ${n}
70
+ <md-ripple></md-ripple><md-focus-ring inward></md-focus-ring>
71
+ </div>
72
+ `)}
73
+ </div>
74
+ `:""}
75
+ ${!this._showMonthDropdown&&!this._showYearDropdown?a`
76
+ <div class="datepicker-calendar">
77
+ <table>
78
+ <thead>
79
+ <tr>
80
+ <th>${this.lang=="sv"?"Må":"Mo"}</th><th>${this.lang=="sv"?"Ti":"Tu"}</th><th>${this.lang=="sv"?"On":"We"}</th><th>${this.lang=="sv"?"To":"Th"}</th><th>${this.lang=="sv","Fr"}</th><th>${this.lang=="sv"?"Lö":"Sa"}</th><th>${this.lang=="sv"?"Sö":"Su"}</th>
81
+ </tr>
82
+ </thead>
83
+ <tbody>
84
+ ${o.map(n=>a`
85
+ <tr>
86
+ ${n.map(d=>d?a`
87
+ <td>
88
+ <div
89
+ @keydown=${f=>{(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),this._selectDate(d))}}
90
+ role="button"
91
+ tabindex="0"
92
+ class="day${this._isToday(d,i)?" today":""}${this._isSelected(d)?" selected":""}"
93
+ @click=${()=>this._selectDate(d)}
94
+ >${d.getDate()}<md-ripple></md-ripple><md-focus-ring></md-focus-ring></div>
95
+ </td>
96
+ `:a`<td></td>`)}
97
+ </tr>
98
+ `)}
99
+ </tbody>
100
+ </table>
101
+ </div>
102
+ `:""}
103
+ </div>
104
+ ${l?a`
105
+ <div style="padding: 0 24px;">
106
+ <label style="display:flex;align-items:center;gap:8px;">
107
+ <span>${this.lang=="sv"?"Tid:":"Time:"}</span>
108
+ <scb-textfield type="time" .value=${`${String(this._selectedHour).padStart(2,"0")}:${String(this._selectedMinute).padStart(2,"0")}`} @blur=${this._onTimeChange} aria-label="${this.lang=="sv"?"Tid":"Time"}"></scb-textfield>
109
+ </label>
110
+ </div>
111
+ `:""}
112
+ <div class="datepicker-footer">
113
+ ${!this._showMonthDropdown&&!this._showYearDropdown?a`
114
+ <scb-button variant="text" label=${this.lang=="sv"?"Stäng":"Close"} @click=${this._close}></scb-button>
115
+ `:""}
116
+ </div>
117
+ </div>
118
+ `}_getMonthDays(e,t){const i=new Date(Date.UTC(e,t,1)),o=new Date(Date.UTC(e,t+1,0)),u=[];let l=[],n=i.getUTCDay(),d=n===0?6:n-1;for(let f=0;f<d;f++)l.push(null);for(let f=1;f<=o.getUTCDate();f++){const x=new Date(Date.UTC(e,t,f));l.push(x),l.length===7&&(u.push(l),l=[])}if(l.length){for(;l.length<7;)l.push(null);u.push(l)}return u}_toggleMonthDropdown(){this._showMonthDropdown=!this._showMonthDropdown,this._showMonthDropdown&&(this._showYearDropdown=!1,setTimeout(()=>{const e=this.renderRoot.querySelector("#selected-month");e&&e.scrollIntoView({block:"center"})},0))}_toggleYearDropdown(){this._showYearDropdown=!this._showYearDropdown,this._showYearDropdown&&(this._showMonthDropdown=!1,setTimeout(()=>{const e=this.renderRoot.querySelector("#selected-year");e&&e.scrollIntoView({block:"center"})},0))}_onMonthChangeCustom(e){const t=this._currentDate.getFullYear();this._currentDate=new Date(t,e,1),this._showMonthDropdown=!1}_onYearChangeCustom(e){const t=this._currentDate.getMonth();this._currentDate=new Date(e,t,1),this._showYearDropdown=!1}_isToday(e,t){return e.getDate()===t.getDate()&&e.getMonth()===t.getMonth()&&e.getFullYear()===t.getFullYear()}_isSelected(e){return this._selectedDate&&e.getDate()===this._selectedDate.getDate()&&e.getMonth()===this._selectedDate.getMonth()&&e.getFullYear()===this._selectedDate.getFullYear()}_selectDate(e){if(this._selectedDate=e,this.variant==="datetime-local"){const t=new Date(e);t.setHours(this._selectedHour??0,this._selectedMinute??0,0,0),this._selectedHour=t.getHours(),this._selectedMinute=t.getMinutes();const i=u=>u.toString().padStart(2,"0"),o=`${t.getFullYear()}-${i(t.getMonth()+1)}-${i(t.getDate())} ${i(t.getHours())}:${i(t.getMinutes())}`;this.dispatchEvent(new CustomEvent("date-selected",{detail:{value:o},bubbles:!0,composed:!0}))}else{const t=e.toISOString().slice(0,10);this.dispatchEvent(new CustomEvent("date-selected",{detail:{value:t},bubbles:!0,composed:!0}))}}_fireDateTimeChange(){if(this.variant==="datetime-local"&&this._selectedDate){const e=new Date(this._selectedDate);e.setHours(this._selectedHour??0,this._selectedMinute??0,0,0);const t=o=>o.toString().padStart(2,"0"),i=`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())} ${t(e.getHours())}:${t(e.getMinutes())}`;this.dispatchEvent(new CustomEvent("date-selected",{detail:{value:i},bubbles:!0,composed:!0}))}}},k.styles=[S`
119
+ :host {
120
+ --scb-datepicker-width: 380px;
121
+ --scb-datepicker-z-index: 1100;
122
+ --scb-datepicker-viewport-margin: 8px;
123
+ --scb-datepicker-offset: var(--spacing-2, 4px);
124
+ max-width: var(--scb-datepicker-computed-width, min(var(--scb-datepicker-width), calc(100vw - (var(--scb-datepicker-viewport-margin) * 2))));
125
+ font-family: var(--brand-font);
126
+ color: var(--md-sys-color-on-surface);
127
+ display: block;
128
+ position: var(--scb-datepicker-position, absolute);
129
+ top: var(--scb-datepicker-top, calc(100% + var(--scb-datepicker-offset)));
130
+ bottom: var(--scb-datepicker-bottom, auto);
131
+ left: var(--scb-datepicker-left, 0);
132
+ width: var(--scb-datepicker-computed-width, min(var(--scb-datepicker-width), calc(100vw - (var(--scb-datepicker-viewport-margin) * 2))));
133
+ transform: var(--scb-datepicker-transform, translateX(0px));
134
+ z-index: var(--scb-datepicker-z-index);
135
+ }
136
+ .month-selector, .year-selector {
137
+ display: flex;
138
+ align-items: center;
139
+ &.disable{
140
+ pointer-events: none;
141
+ opacity: 0.3;
142
+ scb-icon-button{
143
+ visibility: hidden;
144
+ }
145
+ }
146
+ &.open{
147
+ scb-icon-button{
148
+ visibility: hidden;
149
+ }
150
+ .dropdown-selected{
151
+ background: var(--md-sys-color-secondary-container);
152
+ }
153
+ }
154
+ }
155
+ .dropdown-selected {
156
+ position: relative;
157
+ border-radius: 8px;
158
+ font-size: 16px;
159
+ cursor: pointer;
160
+ text-align: left;
161
+ display: flex;
162
+ gap: 8px;
163
+ align-items: center;
164
+ padding: 4px 8px;
165
+ }
166
+ .dropdown-selected:focus {
167
+ outline: none;
168
+ }
169
+ .dropdown-selected md-focus-ring {
170
+ border-radius: 8px;
171
+ }
172
+ .dropdown-list {
173
+ position: relative;
174
+ background: var(--md-sys-color-surface);
175
+ padding: 4px 0;
176
+ }
177
+ .dropdown-item {
178
+ display: flex;
179
+ position: relative;
180
+ cursor: pointer;
181
+ padding: var(--spacing-3) 56px;
182
+ min-height: 40px;
183
+ align-items: center;
184
+ }
185
+ .dropdown-item:focus-within {
186
+ outline: none;
187
+ }
188
+ .dropdown-item md-focus-ring {
189
+ border-radius: var(--md-sys-shape-corner-small);
190
+ }
191
+ .dropdown-item.selected {
192
+ background: var(--md-sys-color-secondary-container, #e3f2fd);
193
+ font-weight: 500;
194
+ padding-left: 16px;
195
+ gap: 16px;
196
+ }
197
+ .datepicker-popup {
198
+ background: var(--md-sys-color-surface);
199
+ border-radius: var(--md-sys-shape-corner-small);
200
+ box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.30), 0 2px 6px 2px rgba(0, 0, 0, 0.15);
201
+ max-width: 100%;
202
+ width: 100%;
203
+ max-height: var(--scb-datepicker-max-height, 80vh);
204
+ overflow: auto;
205
+ font-family: var(--brand-font);
206
+ }
207
+ .datepicker-content{
208
+ overflow-y: auto;
209
+ max-height: 290px;
210
+ }
211
+ .datepicker-content::-webkit-scrollbar {
212
+ width: 12px;
213
+ background: var(--md-sys-color-surface);
214
+ border-radius: var(--md-sys-shape-corner-small);
215
+ }
216
+ .datepicker-content::-webkit-scrollbar-thumb {
217
+ background: var(--md-sys-color-outline);
218
+ border-radius: var(--md-sys-shape-corner-small);
219
+ border: 4px solid var(--md-sys-color-surface);
220
+
221
+ }
222
+ .datepicker-content::-webkit-scrollbar-track {
223
+ background: var(--md-sys-color-surface);
224
+ border-radius: var(--md-sys-shape-corner-small);
225
+ }
226
+ .popup {
227
+ position:absolute;
228
+ top:0;
229
+ left:0;
230
+ z-index:1;
231
+ }
232
+ .header {
233
+ display: flex;
234
+ align-items: center;
235
+ justify-content: space-between;
236
+ margin-bottom: 30px;
237
+ padding: 20px 16px 0px 16px;
238
+ flex-wrap: wrap;
239
+ }
240
+ .datepicker-footer{
241
+ padding: 8px 16px 24px 16px;
242
+ }
243
+ .month-label {
244
+ font-size: 18px;
245
+ font-weight: 500;
246
+ }
247
+ .datepicker-calendar{
248
+ padding: 0 16px;
249
+ }
250
+ table {
251
+ width: 100%;
252
+ border-collapse: collapse;
253
+ margin-bottom: 8px;
254
+ }
255
+ th {
256
+ color: var(--md-sys-color-on-surface-variant, #757575);
257
+ font-size: 16px;
258
+ font-weight: 600;
259
+ padding-bottom: 20px;
260
+ }
261
+ td {
262
+ text-align: center;
263
+ }
264
+
265
+ .day:focus-within{
266
+ outline: none;
267
+ }
268
+ .day {
269
+ position: relative;
270
+ width: 40px;
271
+ height: 40px;
272
+ border-radius: 50%;
273
+ border: none;
274
+ background: none;
275
+ font-size: 16px;
276
+ cursor: pointer;
277
+ font-family: 'Inter';
278
+ align-content: center;
279
+ }
280
+ .day.selected {
281
+ background: var(--md-sys-color-secondary-container);
282
+ }
283
+ .close-datepicker {
284
+ margin-top: 8px;
285
+ background: none;
286
+ border-color: none;
287
+ color: var(--md-sys-color-primary, #0057b8);
288
+ font-size: 16px;
289
+ cursor: pointer;
290
+ padding: 4px 12px;
291
+ border-radius: 8px;
292
+ }
293
+ .close-datepicker:hover {
294
+ background: var(--md-sys-color-primary-container, #e3f2fd);
295
+ }
296
+ `],k);r([m()],g.prototype,"_currentDate",void 0);r([m()],g.prototype,"_selectedDate",void 0);r([m()],g.prototype,"_showMonthDropdown",void 0);r([m()],g.prototype,"_showYearDropdown",void 0);r([p({type:String})],g.prototype,"variant",void 0);r([p({type:String})],g.prototype,"lang",void 0);r([p({type:String})],g.prototype,"selectedValue",void 0);r([p({type:Boolean})],g.prototype,"open",void 0);r([m()],g.prototype,"_selectedHour",void 0);r([m()],g.prototype,"_selectedMinute",void 0);g=r([E("scb-datepicker")],g);var c,y,h=(c=new WeakSet,y=class extends M{constructor(){super(),Y(this,c),this._internals=null,this._inputFocused=!1,this._kbShouldShowRing=!1,this._onGlobalKeydown=e=>{e.key==="Tab"&&(this._kbShouldShowRing=!0,this._inputFocused&&b(c,this,_).call(this))},this._onGlobalPointerDown=()=>{this._kbShouldShowRing=!1,this._inputFocused&&b(c,this,_).call(this)},this._hasRenderedOnce=!1,this._boundField=null,this._onFieldInput=()=>{const e=this._boundField;if(!e)return;const t=e;if(this.value=t.value,this._internals){const i=this.disabled?null:this.value;this._internals.setFormValue(i)}b(c,this,w).call(this),this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("onValueChanged",{detail:{value:this.value},bubbles:!0,composed:!0}))},this._onFieldChange=()=>{this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))},this._onFieldSelect=()=>{this.dispatchEvent(new Event("select",{bubbles:!0,composed:!0}))},this._onFieldFocus=()=>{this._inputFocused=!0,b(c,this,_).call(this)},this._onFieldBlur=()=>{this._inputFocused=!1,b(c,this,_).call(this)},this.type="text",this.label="",this.supportingText="",this.errorText="",this.leadingIcon="",this.name="",this.pattern="",this.value="",this.underLabel="",this.error=!1,this.disabled=!1,this.required=!1,this.size="large",this.spacing=void 0,this.spacingTop=void 0,this.spacingBottom=void 0,this.spacingLeft=void 0,this.spacingRight=void 0,this._form=null,this._formSubmitHandler=null,this._formResetHandler=null,this._initialValue="",this._inputId="",this._showDatepicker=!1,this._toggleDatepicker=()=>{this._showDatepicker=!this._showDatepicker},this._onDateSelected=e=>{if(this.value=e.detail.value,this._showDatepicker=!1,this._internals){const t=this.disabled?null:this.value;this._internals.setFormValue(t)}b(c,this,w).call(this),this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("onValueChanged",{detail:{value:this.value},bubbles:!0,composed:!0}))},"attachInternals"in this&&(this._internals=this.attachInternals())}_syncDensityForSize(){this.size==="extra-small"?this.setAttribute("data-density","-5"):this.size==="small"?this.setAttribute("data-density","-4"):this.size==="medium"?this.setAttribute("data-density","-2"):this.removeAttribute("data-density")}render(){const e=this.leadingIcon?a`<md-icon class="scb-textfield-icon">${this.leadingIcon}</md-icon>`:null,t=this.error?a`<md-icon class="scb-textfield-error-icon" aria-hidden="true">error</md-icon>`:null;this.underLabel=this.error?this.errorText||"Ogiltig inmatning.":this.supportingText,this.value=this.value||"";const i=this.underLabel?`${this._inputId}-supporting-text`:void 0,o=this.type==="search"&&this.value?a`
2
297
  <button
3
298
  type="button"
4
299
  class="scb-textfield-clear"
@@ -32,14 +327,14 @@ import"../../vendor/vendor-material.js";import{_,b as w,g as $,h as d,m as k,y a
32
327
  ></line>
33
328
  </svg>
34
329
  </button>
35
- `:null;return this.type==="textarea"?o`
330
+ `:null;return this.type==="textarea"?a`
36
331
  <label
37
332
  class="scb-textfield-label ${this.underLabel?"":"scb-textfield-label--without-supporting"}"
38
333
  for="${this._inputId}"
39
334
  >
40
335
  ${this.label}
41
336
  </label>
42
- ${this.underLabel?o`
337
+ ${this.underLabel?a`
43
338
  <span class="scb-textfield-supporting-text" id="${this._inputId}-supporting-text">
44
339
  ${this.underLabel}
45
340
  </span>
@@ -54,20 +349,20 @@ import"../../vendor/vendor-material.js";import{_,b as w,g as $,h as d,m as k,y a
54
349
  id="${this._inputId}"
55
350
  ?required=${this.required}
56
351
  aria-invalid=${this.error?"true":"false"}
57
- aria-describedby=${n}
352
+ aria-describedby=${i}
58
353
  ></textarea>
59
354
  <md-ripple></md-ripple>
60
355
  <md-focus-ring class="input-ring"></md-focus-ring>
61
356
  </div>
62
357
  </div>
63
- `:this.type==="date"?o`
358
+ `:this.type==="date"?a`
64
359
  <label
65
360
  class="scb-textfield-label ${this.underLabel?"":"scb-textfield-label--without-supporting"}"
66
361
  for="${this._inputId}"
67
362
  >
68
363
  ${this.label}
69
364
  </label>
70
- ${this.underLabel?o`
365
+ ${this.underLabel?a`
71
366
  <span class="scb-textfield-supporting-text" id="${this._inputId}-supporting-text">
72
367
  ${this.underLabel}
73
368
  </span>
@@ -84,7 +379,7 @@ import"../../vendor/vendor-material.js";import{_,b as w,g as $,h as d,m as k,y a
84
379
  ?disabled=${this.disabled}
85
380
  ?required=${this.required}
86
381
  aria-invalid=${this.error?"true":"false"}
87
- aria-describedby=${n}
382
+ aria-describedby=${i}
88
383
  readonly
89
384
  @focus=${this._toggleDatepicker}
90
385
  @click=${this._toggleDatepicker}
@@ -92,7 +387,7 @@ import"../../vendor/vendor-material.js";import{_,b as w,g as $,h as d,m as k,y a
92
387
  <md-ripple></md-ripple>
93
388
  <md-focus-ring class="input-ring"></md-focus-ring>
94
389
  </div>
95
- ${this.error?i:o`
390
+ ${this.error?t:a`
96
391
  <scb-icon-button
97
392
  class="scb-textfield-datepicker-button"
98
393
  icon="calendar_today"
@@ -107,14 +402,14 @@ import"../../vendor/vendor-material.js";import{_,b as w,g as $,h as d,m as k,y a
107
402
  @date-selected=${this._onDateSelected}
108
403
  ></scb-datepicker>
109
404
  </div>
110
- `:this.type==="datetime-local"?o`
405
+ `:this.type==="datetime-local"?a`
111
406
  <label
112
407
  class="scb-textfield-label ${this.underLabel?"":"scb-textfield-label--without-supporting"}"
113
408
  for="${this._inputId}"
114
409
  >
115
410
  ${this.label}
116
411
  </label>
117
- ${this.underLabel?o`
412
+ ${this.underLabel?a`
118
413
  <span class="scb-textfield-supporting-text" id="${this._inputId}-supporting-text">
119
414
  ${this.underLabel}
120
415
  </span>
@@ -131,7 +426,7 @@ import"../../vendor/vendor-material.js";import{_,b as w,g as $,h as d,m as k,y a
131
426
  ?disabled=${this.disabled}
132
427
  ?required=${this.required}
133
428
  aria-invalid=${this.error?"true":"false"}
134
- aria-describedby=${n}
429
+ aria-describedby=${i}
135
430
  readonly
136
431
  @focus=${this._toggleDatepicker}
137
432
  @click=${this._toggleDatepicker}
@@ -141,7 +436,7 @@ import"../../vendor/vendor-material.js";import{_,b as w,g as $,h as d,m as k,y a
141
436
  <md-focus-ring class="input-ring"></md-focus-ring>
142
437
  </div>
143
438
 
144
- ${this.error?i:o`
439
+ ${this.error?t:a`
145
440
  <scb-icon-button
146
441
  class="scb-textfield-datepicker-button"
147
442
  icon="calendar_today"
@@ -157,14 +452,14 @@ import"../../vendor/vendor-material.js";import{_,b as w,g as $,h as d,m as k,y a
157
452
  @date-selected=${this._onDateSelected}
158
453
  ></scb-datepicker>
159
454
  </div>
160
- `:this.type==="time"?o`
455
+ `:this.type==="time"?a`
161
456
  <label
162
457
  class="scb-textfield-label ${this.underLabel?"":"scb-textfield-label--without-supporting"}"
163
458
  for="${this._inputId}"
164
459
  >
165
460
  ${this.label}
166
461
  </label>
167
- ${this.underLabel?o`
462
+ ${this.underLabel?a`
168
463
  <span class="scb-textfield-supporting-text" id="${this._inputId}-supporting-text">
169
464
  ${this.underLabel}
170
465
  </span>
@@ -181,22 +476,22 @@ import"../../vendor/vendor-material.js";import{_,b as w,g as $,h as d,m as k,y a
181
476
  ?disabled=${this.disabled}
182
477
  ?required=${this.required}
183
478
  aria-invalid=${this.error?"true":"false"}
184
- aria-describedby=${n}
185
- @input=${p=>{const b=p.target;if(this.value=b.value,this._internals){const y=this.disabled?null:this.value;this._internals.setFormValue(y)}a(s,this,f).call(this),this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("onValueChanged",{detail:{value:this.value},bubbles:!0,composed:!0}))}}
479
+ aria-describedby=${i}
480
+ @input=${u=>{const l=u.target;if(this.value=l.value,this._internals){const n=this.disabled?null:this.value;this._internals.setFormValue(n)}b(c,this,w).call(this),this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("onValueChanged",{detail:{value:this.value},bubbles:!0,composed:!0}))}}
186
481
  />
187
- ${i}
482
+ ${t}
188
483
  <md-ripple></md-ripple>
189
484
  <md-focus-ring class="input-ring"></md-focus-ring>
190
485
  </div>
191
486
  </div>
192
- `:o`
487
+ `:a`
193
488
  <label
194
489
  class="scb-textfield-label ${this.underLabel?"":"scb-textfield-label--without-supporting"}"
195
490
  for="${this._inputId}"
196
491
  >
197
492
  ${this.label}
198
493
  </label>
199
- ${this.underLabel?o`
494
+ ${this.underLabel?a`
200
495
  <span class="scb-textfield-supporting-text" id="${this._inputId}-supporting-text">
201
496
  ${this.underLabel}
202
497
  </span>
@@ -213,15 +508,15 @@ import"../../vendor/vendor-material.js";import{_,b as w,g as $,h as d,m as k,y a
213
508
  ?disabled=${this.disabled}
214
509
  ?required=${this.required}
215
510
  aria-invalid=${this.error?"true":"false"}
216
- aria-describedby=${n}
511
+ aria-describedby=${i}
217
512
  />
218
- ${c}
219
- ${i}
513
+ ${o}
514
+ ${t}
220
515
  <md-ripple></md-ripple>
221
516
  <md-focus-ring class="input-ring"></md-focus-ring>
222
517
  </div>
223
518
  </div>
224
- `}firstUpdated(e){super.firstUpdated(e),this._initialValue=this.value,this._internals&&this.value&&this._internals.setFormValue(this.value),a(s,this,m).call(this),a(s,this,x).call(this)}updated(e){if(super.updated(e),this.toggleAttribute("aria-disabled",this.disabled),e.has("size")&&this._syncDensityForSize(),this._internals&&(e.has("value")||e.has("disabled"))){const i=this.disabled?null:this.value;this._internals.setFormValue(i)}e.has("type")&&(a(s,this,m).call(this),this._hasRenderedOnce&&a(s,this,S).call(this)),(e.has("spacing")||e.has("spacingTop")||e.has("spacingBottom")||e.has("spacingLeft")||e.has("spacingRight"))&&a(s,this,x).call(this),this._hasRenderedOnce=!0}formDisabledCallback(e){this.disabled=e}connectedCallback(){super.connectedCallback(),this._syncDensityForSize(),this._inputId=this.id||`scb-textfield-${Math.random().toString(36).substr(2,9)}`,this._formSubmitHandler=e=>{this.reportValidity()||(e.preventDefault(),e.stopPropagation())},this._form=this.closest("form"),this._form&&(this._form.addEventListener("submit",this._formSubmitHandler,!0),this._formResetHandler=()=>{this.value=this._initialValue;const e=this.shadowRoot?.querySelector(".scb-textfield");e&&(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)&&(e.value=this._initialValue),this.error=!1},this._form.addEventListener("reset",this._formResetHandler,!0)),window.addEventListener("keydown",this._onGlobalKeydown,!0),window.addEventListener("pointerdown",this._onGlobalPointerDown,!0)}disconnectedCallback(){super.disconnectedCallback(),this._form&&this._formSubmitHandler&&(this._form.removeEventListener("submit",this._formSubmitHandler,!0),this._formResetHandler&&this._form.removeEventListener("reset",this._formResetHandler,!0)),a(s,this,v).call(this),window.removeEventListener("keydown",this._onGlobalKeydown,!0),window.removeEventListener("pointerdown",this._onGlobalPointerDown,!0)}reportValidity(){return a(s,this,f).call(this,!0)}_onClearClick(){const e=this.shadowRoot?.querySelector(".scb-textfield");if(e&&(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)){if(e.value="",this.value="",this._internals){const i=this.disabled?null:this.value;this._internals.setFormValue(i),this._internals.setValidity({})}this.error=!1,e.setCustomValidity(""),this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("onValueChanged",{detail:{value:this.value},bubbles:!0,composed:!0})),e.focus()}}},u.formAssociated=!0,u.styles=[w`
519
+ `}firstUpdated(e){super.firstUpdated(e),this._initialValue=this.value,this._internals&&this.value&&this._internals.setFormValue(this.value),b(c,this,z).call(this),b(c,this,D).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 t=this.disabled?null:this.value;this._internals.setFormValue(t)}e.has("type")&&(b(c,this,z).call(this),this._hasRenderedOnce&&b(c,this,R).call(this)),(e.has("spacing")||e.has("spacingTop")||e.has("spacingBottom")||e.has("spacingLeft")||e.has("spacingRight"))&&b(c,this,D).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)),b(c,this,F).call(this),window.removeEventListener("keydown",this._onGlobalKeydown,!0),window.removeEventListener("pointerdown",this._onGlobalPointerDown,!0)}reportValidity(){return b(c,this,w).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 t=this.disabled?null:this.value;this._internals.setFormValue(t),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()}}},y.formAssociated=!0,y.styles=[S`
225
520
  :host {
226
521
  --scb-textfield-number-max-width: 280px;
227
522
  --scb-textfield-text-max-width: 400px;
@@ -592,4 +887,4 @@ import"../../vendor/vendor-material.js";import{_,b as w,g as $,h as d,m as k,y a
592
887
  transform: translateY(-50%);
593
888
  z-index: 4;
594
889
  }
595
- `],u);function x(){const t=a(s,this,h).call(this,this.spacing),e=a(s,this,h).call(this,this.spacingTop)??t,i=a(s,this,h).call(this,this.spacingBottom)??t,n=a(s,this,h).call(this,this.spacingLeft),c=a(s,this,h).call(this,this.spacingRight);e?this.style.setProperty("--scb-textfield-spacing-block-start",e):this.style.removeProperty("--scb-textfield-spacing-block-start"),i?this.style.setProperty("--scb-textfield-spacing-block-end",i):this.style.removeProperty("--scb-textfield-spacing-block-end"),n?this.style.setProperty("--scb-textfield-spacing-inline-start",n):this.style.removeProperty("--scb-textfield-spacing-inline-start"),c?this.style.setProperty("--scb-textfield-spacing-inline-end",c):this.style.removeProperty("--scb-textfield-spacing-inline-end")}function h(t){if(!t)return;const e=String(t).trim();if(e)return/^\d+$/.test(e)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(e,10)))})`:e}function f(t=!1){const e=this.shadowRoot?.querySelector(".scb-textfield");if(!(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement))return!0;const i=this.errorText||"Ogiltig inmatning.";let n="";if(e.setCustomValidity(""),this.required&&!e.value)n=i,e.setCustomValidity(n);else if(this.pattern&&e.value)try{new RegExp(this.pattern).test(e.value)||(n=i,e.setCustomValidity(n))}catch{e.setCustomValidity("")}const c=t?e.reportValidity():e.checkValidity();if(this.error=!c,this._internals)if(c)this._internals.setValidity({});else{const p=n||e.validationMessage||i;this._internals.setValidity({customError:!0},p,e)}return c}function m(){const t=this.shadowRoot?.querySelector(".scb-textfield");t&&(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement)&&this._boundField!==t&&(a(s,this,v).call(this),this._boundField=t,this.type!=="time"&&t.addEventListener("input",this._onFieldInput),t.addEventListener("change",this._onFieldChange),t.addEventListener("select",this._onFieldSelect),t.addEventListener("focus",this._onFieldFocus),t.addEventListener("blur",this._onFieldBlur))}function v(){const t=this._boundField;t&&(t.removeEventListener("input",this._onFieldInput),t.removeEventListener("change",this._onFieldChange),t.removeEventListener("select",this._onFieldSelect),t.removeEventListener("focus",this._onFieldFocus),t.removeEventListener("blur",this._onFieldBlur),this._boundField=null)}function S(){this._showDatepicker=!1;const t=this.shadowRoot?.querySelector(".scb-textfield");if(t&&(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement)&&(t.value="",t.setCustomValidity("")),this.value="",this.error=!1,this._internals){const e=this.disabled?null:"";this._internals.setFormValue(e),this._internals.setValidity({})}}function g(){const t=this.renderRoot?.querySelector(".ripple-wrapper");t&&(this._inputFocused&&this._kbShouldShowRing?t.setAttribute("data-kb-focus","true"):t.removeAttribute("data-kb-focus"))}r([d({type:String,reflect:!0})],l.prototype,"type",void 0);r([d({type:String})],l.prototype,"label",void 0);r([d({type:String,attribute:"supporting-text"})],l.prototype,"supportingText",void 0);r([d({type:String,attribute:"error-text"})],l.prototype,"errorText",void 0);r([d({type:String,attribute:"leading-icon"})],l.prototype,"leadingIcon",void 0);r([d({type:String})],l.prototype,"name",void 0);r([d({type:String})],l.prototype,"pattern",void 0);r([d({type:String,attribute:"value"})],l.prototype,"value",void 0);r([d({type:String})],l.prototype,"underLabel",void 0);r([d({type:Boolean,reflect:!0})],l.prototype,"error",void 0);r([d({type:Boolean,reflect:!0})],l.prototype,"disabled",void 0);r([d({type:Boolean,reflect:!0})],l.prototype,"required",void 0);r([d({type:String,reflect:!0})],l.prototype,"size",void 0);r([d({type:String,reflect:!0})],l.prototype,"spacing",void 0);r([d({type:String,attribute:"spacing-top",reflect:!0})],l.prototype,"spacingTop",void 0);r([d({type:String,attribute:"spacing-bottom",reflect:!0})],l.prototype,"spacingBottom",void 0);r([d({type:String,attribute:"spacing-left",reflect:!0})],l.prototype,"spacingLeft",void 0);r([d({type:String,attribute:"spacing-right",reflect:!0})],l.prototype,"spacingRight",void 0);r([k()],l.prototype,"_showDatepicker",void 0);l=r([$("scb-textfield")],l);
890
+ `],y);function D(){const s=b(c,this,v).call(this,this.spacing),e=b(c,this,v).call(this,this.spacingTop)??s,t=b(c,this,v).call(this,this.spacingBottom)??s,i=b(c,this,v).call(this,this.spacingLeft),o=b(c,this,v).call(this,this.spacingRight);e?this.style.setProperty("--scb-textfield-spacing-block-start",e):this.style.removeProperty("--scb-textfield-spacing-block-start"),t?this.style.setProperty("--scb-textfield-spacing-block-end",t):this.style.removeProperty("--scb-textfield-spacing-block-end"),i?this.style.setProperty("--scb-textfield-spacing-inline-start",i):this.style.removeProperty("--scb-textfield-spacing-inline-start"),o?this.style.setProperty("--scb-textfield-spacing-inline-end",o):this.style.removeProperty("--scb-textfield-spacing-inline-end")}function v(s){if(!s)return;const e=String(s).trim();if(e)return/^\d+$/.test(e)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(e,10)))})`:e}function w(s=!1){const e=this.shadowRoot?.querySelector(".scb-textfield");if(!(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement))return!0;const t=this.errorText||"Ogiltig inmatning.";let i="";if(e.setCustomValidity(""),this.required&&!e.value)i=t,e.setCustomValidity(i);else if(this.pattern&&e.value)try{new RegExp(this.pattern).test(e.value)||(i=t,e.setCustomValidity(i))}catch{e.setCustomValidity("")}const o=s?e.reportValidity():e.checkValidity();if(this.error=!o,this._internals)if(o)this._internals.setValidity({});else{const u=i||e.validationMessage||t;this._internals.setValidity({customError:!0},u,e)}return o}function z(){const s=this.shadowRoot?.querySelector(".scb-textfield");s&&(s instanceof HTMLInputElement||s instanceof HTMLTextAreaElement)&&this._boundField!==s&&(b(c,this,F).call(this),this._boundField=s,this.type!=="time"&&s.addEventListener("input",this._onFieldInput),s.addEventListener("change",this._onFieldChange),s.addEventListener("select",this._onFieldSelect),s.addEventListener("focus",this._onFieldFocus),s.addEventListener("blur",this._onFieldBlur))}function F(){const s=this._boundField;s&&(s.removeEventListener("input",this._onFieldInput),s.removeEventListener("change",this._onFieldChange),s.removeEventListener("select",this._onFieldSelect),s.removeEventListener("focus",this._onFieldFocus),s.removeEventListener("blur",this._onFieldBlur),this._boundField=null)}function R(){this._showDatepicker=!1;const s=this.shadowRoot?.querySelector(".scb-textfield");if(s&&(s instanceof HTMLInputElement||s instanceof HTMLTextAreaElement)&&(s.value="",s.setCustomValidity("")),this.value="",this.error=!1,this._internals){const e=this.disabled?null:"";this._internals.setFormValue(e),this._internals.setValidity({})}}function _(){const s=this.renderRoot?.querySelector(".ripple-wrapper");s&&(this._inputFocused&&this._kbShouldShowRing?s.setAttribute("data-kb-focus","true"):s.removeAttribute("data-kb-focus"))}r([p({type:String,reflect:!0})],h.prototype,"type",void 0);r([p({type:String})],h.prototype,"label",void 0);r([p({type:String,attribute:"supporting-text"})],h.prototype,"supportingText",void 0);r([p({type:String,attribute:"error-text"})],h.prototype,"errorText",void 0);r([p({type:String,attribute:"leading-icon"})],h.prototype,"leadingIcon",void 0);r([p({type:String})],h.prototype,"name",void 0);r([p({type:String})],h.prototype,"pattern",void 0);r([p({type:String,attribute:"value"})],h.prototype,"value",void 0);r([p({type:String})],h.prototype,"underLabel",void 0);r([p({type:Boolean,reflect:!0})],h.prototype,"error",void 0);r([p({type:Boolean,reflect:!0})],h.prototype,"disabled",void 0);r([p({type:Boolean,reflect:!0})],h.prototype,"required",void 0);r([p({type:String,reflect:!0})],h.prototype,"size",void 0);r([p({type:String,reflect:!0})],h.prototype,"spacing",void 0);r([p({type:String,attribute:"spacing-top",reflect:!0})],h.prototype,"spacingTop",void 0);r([p({type:String,attribute:"spacing-bottom",reflect:!0})],h.prototype,"spacingBottom",void 0);r([p({type:String,attribute:"spacing-left",reflect:!0})],h.prototype,"spacingLeft",void 0);r([p({type:String,attribute:"spacing-right",reflect:!0})],h.prototype,"spacingRight",void 0);r([m()],h.prototype,"_showDatepicker",void 0);h=r([E("scb-textfield")],h);
@@ -1,4 +1,4 @@
1
- import"../../vendor/vendor-material.js";import{_ as v,b as y,g as f,h as m,y as b}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import{t as l}from"../../vendor/decorate.js";import"../scb-chevron/scb-chevron.js";import"../scb-divider/scb-divider.js";(function(){try{var h=typeof globalThis<"u"?globalThis:window;if(!h.__scb_ce_guard_installed__){h.__scb_ce_guard_installed__=!0;var t=customElements.define.bind(customElements);customElements.define=function(e,o,i){try{customElements.get(e)||t(e,o,i)}catch(r){var s=String(r||"");if(s.indexOf("already been used")===-1&&s.indexOf("NotSupportedError")===-1)throw r}}}}catch{}})();var p,g,c=(p=class extends v{constructor(...t){super(...t),this.expanded=!1,this.size="medium",this.label="",this.supportingText="",this.itemHref="#",this.noDivider=!1,this._unique=g._uid(),this._overflowVisibleTimer=null,this._slotHasContent=!1,this._trailingSlotHasContent=!1,this._onSlotChange=()=>{const e=this.renderRoot.querySelector("slot:not([name])"),o=!!e&&e.assignedElements({flatten:!0}).length>0;this._slotHasContent!==o&&(this._slotHasContent=o,this.requestUpdate()),!this._slotHasContent&&this.expanded&&(this.expanded=!1),this._applyInertByExpanded()},this._toggleAccordion=()=>{if(!this._slotHasContent)return;const e=!this.expanded;this.setExpanded(e)},this._onKeyDown=e=>{const o=this.closest("scb-toc"),i=Array.from(o?.querySelectorAll("scb-toc-item")||[]).map(n=>({host:n,label:n.renderRoot.querySelector(".toc-item-label")||null})).filter(n=>!!n.label),s=i.findIndex(n=>n.host===this);if(s<0)return;const r=e.currentTarget?.classList?.contains("toc-chevron-button")??!1;switch(e.key){case"Enter":case" ":if(!r)return;e.preventDefault(),this._toggleAccordion();break;case"ArrowDown":e.preventDefault(),s<i.length-1&&i[s+1].label.focus();break;case"ArrowUp":e.preventDefault(),s>0&&i[s-1].label.focus();break;case"Home":e.preventDefault(),i.length&&i[0].label.focus();break;case"End":e.preventDefault(),i.length&&i[i.length-1].label.focus();break}}}setExpanded(t){this.expanded!==t&&(this.expanded=t)}static _uid(){return globalThis.crypto?.randomUUID?.()??`${g._uidPrefix}-${++g._uidSeq}`}firstUpdated(){this._applyInertByExpanded(),this._syncOverflowVisibilityByExpanded()}updated(t){t.has("expanded")&&(this._applyInertByExpanded(),this._syncOverflowVisibilityByExpanded(),this.dispatchEvent(new CustomEvent("expanded-changed",{detail:{expanded:this.expanded,label:this.label},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("expandedchanged",{detail:{expanded:this.expanded,label:this.label},bubbles:!0,composed:!0})))}connectedCallback(){super.connectedCallback(),this._slotHasContent=Array.from(this.children).some(t=>{const e=t.getAttribute("slot");return e===null||e===""}),this._trailingSlotHasContent=Array.from(this.children).some(t=>t.getAttribute("slot")==="trailing"),!this._slotHasContent&&this.expanded&&(this.expanded=!1)}disconnectedCallback(){super.disconnectedCallback(),this._overflowVisibleTimer!==null&&(window.clearTimeout(this._overflowVisibleTimer),this._overflowVisibleTimer=null)}_applyInertByExpanded(){const t=this.renderRoot.querySelector(".scb-toc-item-bottom");t&&(this.expanded?(t.removeAttribute("inert"),t.setAttribute("aria-hidden","false"),this._restoreTabIndexesIfNeeded()):(t.setAttribute("inert",""),t.setAttribute("aria-hidden","true"),this._removeTabIndexesIfNeeded()))}_syncOverflowVisibilityByExpanded(){if(this._overflowVisibleTimer!==null&&(window.clearTimeout(this._overflowVisibleTimer),this._overflowVisibleTimer=null),this.removeAttribute("data-expanded-settled"),!this.expanded)return;const t=this.renderRoot.querySelector(".scb-toc-item-bottom");if(!t){this.setAttribute("data-expanded-settled","");return}const e=this._getTransitionMs(t);if(e<=0){this.setAttribute("data-expanded-settled","");return}this._overflowVisibleTimer=window.setTimeout(()=>{this._overflowVisibleTimer=null,this.expanded&&this.setAttribute("data-expanded-settled","")},e)}_getTransitionMs(t){const e=getComputedStyle(t),o=e.transitionDuration.split(",").map(a=>a.trim()),i=e.transitionDelay.split(",").map(a=>a.trim()),s=a=>{const d=parseFloat(a);return Number.isFinite(d)?a.endsWith("ms")?d:a.endsWith("s")?d*1e3:d:0},r=Math.max(o.length,i.length);let n=0;for(let a=0;a<r;a+=1){const d=s(o[a]??o[o.length-1]??"0s"),u=s(i[a]??i[i.length-1]??"0s");n=Math.max(n,d+u)}return Math.ceil(n)}_supportsInert(){return"inert"in HTMLElement.prototype}_collectFocusableFromSlot(){const t=this.renderRoot.querySelector("slot:not([name])");if(!t)return[];const e=t.assignedElements({flatten:!0}),o=[],i=s=>{s instanceof HTMLElement&&s.matches("a,button,input,select,textarea,[tabindex]")&&o.push(s)};return e.forEach(s=>{i(s),s.querySelectorAll?.("a,button,input,select,textarea,[tabindex]").forEach(r=>i(r))}),o}_removeTabIndexesIfNeeded(){this._supportsInert()||this._collectFocusableFromSlot().forEach(t=>{const e=t.getAttribute("tabindex");e!==null&&t.setAttribute("data-scb-prev-tabindex",e),t.setAttribute("tabindex","-1")})}_restoreTabIndexesIfNeeded(){this._supportsInert()||this._collectFocusableFromSlot().forEach(t=>{const e=t.getAttribute("data-scb-prev-tabindex");e!==null?(t.setAttribute("tabindex",e),t.removeAttribute("data-scb-prev-tabindex")):t.removeAttribute("tabindex")})}render(){const t=`bottom-${this._unique}`,e=`toc-label-${this._unique}`,o=`toc-chevron-${this._unique}`,i=this.supportingText.trim().length>0;return b`
1
+ import{_ as v,b as y,g as f,h as m,y as b}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import"../../vendor/md-focus-ring.js";import"../../vendor/icon.js";import"../../vendor/ripple.js";import{t as l}from"../../vendor/decorate.js";import"../../vendor/scb-chevron.js";import"../scb-divider/scb-divider.js";(function(){try{var h=typeof globalThis<"u"?globalThis:window;if(!h.__scb_ce_guard_installed__){h.__scb_ce_guard_installed__=!0;var t=customElements.define.bind(customElements);customElements.define=function(e,o,i){try{customElements.get(e)||t(e,o,i)}catch(r){var s=String(r||"");if(s.indexOf("already been used")===-1&&s.indexOf("NotSupportedError")===-1)throw r}}}}catch{}})();var p,g,c=(p=class extends v{constructor(...t){super(...t),this.expanded=!1,this.size="medium",this.label="",this.supportingText="",this.itemHref="#",this.noDivider=!1,this._unique=g._uid(),this._overflowVisibleTimer=null,this._slotHasContent=!1,this._trailingSlotHasContent=!1,this._onSlotChange=()=>{const e=this.renderRoot.querySelector("slot:not([name])"),o=!!e&&e.assignedElements({flatten:!0}).length>0;this._slotHasContent!==o&&(this._slotHasContent=o,this.requestUpdate()),!this._slotHasContent&&this.expanded&&(this.expanded=!1),this._applyInertByExpanded()},this._toggleAccordion=()=>{if(!this._slotHasContent)return;const e=!this.expanded;this.setExpanded(e)},this._onKeyDown=e=>{const o=this.closest("scb-toc"),i=Array.from(o?.querySelectorAll("scb-toc-item")||[]).map(n=>({host:n,label:n.renderRoot.querySelector(".toc-item-label")||null})).filter(n=>!!n.label),s=i.findIndex(n=>n.host===this);if(s<0)return;const r=e.currentTarget?.classList?.contains("toc-chevron-button")??!1;switch(e.key){case"Enter":case" ":if(!r)return;e.preventDefault(),this._toggleAccordion();break;case"ArrowDown":e.preventDefault(),s<i.length-1&&i[s+1].label.focus();break;case"ArrowUp":e.preventDefault(),s>0&&i[s-1].label.focus();break;case"Home":e.preventDefault(),i.length&&i[0].label.focus();break;case"End":e.preventDefault(),i.length&&i[i.length-1].label.focus();break}}}setExpanded(t){this.expanded!==t&&(this.expanded=t)}static _uid(){return globalThis.crypto?.randomUUID?.()??`${g._uidPrefix}-${++g._uidSeq}`}firstUpdated(){this._applyInertByExpanded(),this._syncOverflowVisibilityByExpanded()}updated(t){t.has("expanded")&&(this._applyInertByExpanded(),this._syncOverflowVisibilityByExpanded(),this.dispatchEvent(new CustomEvent("expanded-changed",{detail:{expanded:this.expanded,label:this.label},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("expandedchanged",{detail:{expanded:this.expanded,label:this.label},bubbles:!0,composed:!0})))}connectedCallback(){super.connectedCallback(),this._slotHasContent=Array.from(this.children).some(t=>{const e=t.getAttribute("slot");return e===null||e===""}),this._trailingSlotHasContent=Array.from(this.children).some(t=>t.getAttribute("slot")==="trailing"),!this._slotHasContent&&this.expanded&&(this.expanded=!1)}disconnectedCallback(){super.disconnectedCallback(),this._overflowVisibleTimer!==null&&(window.clearTimeout(this._overflowVisibleTimer),this._overflowVisibleTimer=null)}_applyInertByExpanded(){const t=this.renderRoot.querySelector(".scb-toc-item-bottom");t&&(this.expanded?(t.removeAttribute("inert"),t.setAttribute("aria-hidden","false"),this._restoreTabIndexesIfNeeded()):(t.setAttribute("inert",""),t.setAttribute("aria-hidden","true"),this._removeTabIndexesIfNeeded()))}_syncOverflowVisibilityByExpanded(){if(this._overflowVisibleTimer!==null&&(window.clearTimeout(this._overflowVisibleTimer),this._overflowVisibleTimer=null),this.removeAttribute("data-expanded-settled"),!this.expanded)return;const t=this.renderRoot.querySelector(".scb-toc-item-bottom");if(!t){this.setAttribute("data-expanded-settled","");return}const e=this._getTransitionMs(t);if(e<=0){this.setAttribute("data-expanded-settled","");return}this._overflowVisibleTimer=window.setTimeout(()=>{this._overflowVisibleTimer=null,this.expanded&&this.setAttribute("data-expanded-settled","")},e)}_getTransitionMs(t){const e=getComputedStyle(t),o=e.transitionDuration.split(",").map(a=>a.trim()),i=e.transitionDelay.split(",").map(a=>a.trim()),s=a=>{const d=parseFloat(a);return Number.isFinite(d)?a.endsWith("ms")?d:a.endsWith("s")?d*1e3:d:0},r=Math.max(o.length,i.length);let n=0;for(let a=0;a<r;a+=1){const d=s(o[a]??o[o.length-1]??"0s"),u=s(i[a]??i[i.length-1]??"0s");n=Math.max(n,d+u)}return Math.ceil(n)}_supportsInert(){return"inert"in HTMLElement.prototype}_collectFocusableFromSlot(){const t=this.renderRoot.querySelector("slot:not([name])");if(!t)return[];const e=t.assignedElements({flatten:!0}),o=[],i=s=>{s instanceof HTMLElement&&s.matches("a,button,input,select,textarea,[tabindex]")&&o.push(s)};return e.forEach(s=>{i(s),s.querySelectorAll?.("a,button,input,select,textarea,[tabindex]").forEach(r=>i(r))}),o}_removeTabIndexesIfNeeded(){this._supportsInert()||this._collectFocusableFromSlot().forEach(t=>{const e=t.getAttribute("tabindex");e!==null&&t.setAttribute("data-scb-prev-tabindex",e),t.setAttribute("tabindex","-1")})}_restoreTabIndexesIfNeeded(){this._supportsInert()||this._collectFocusableFromSlot().forEach(t=>{const e=t.getAttribute("data-scb-prev-tabindex");e!==null?(t.setAttribute("tabindex",e),t.removeAttribute("data-scb-prev-tabindex")):t.removeAttribute("tabindex")})}render(){const t=`bottom-${this._unique}`,e=`toc-label-${this._unique}`,o=`toc-chevron-${this._unique}`,i=this.supportingText.trim().length>0;return b`
2
2
  <div class="scb-toc-item" role="listitem">
3
3
  <div class=${`scb-toc-item-top${i?"":" no-supporting-text"}`}>
4
4
  <div>
@@ -1,4 +1,4 @@
1
- import"../../vendor/vendor-material.js";import{_ as R,b as F,g as I,h as p,o as M,v as V,y as m}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import{t as h}from"../../vendor/decorate.js";import"../scb-button/scb-button.js";(function(){try{var _=typeof globalThis<"u"?globalThis:window;if(!_.__scb_ce_guard_installed__){_.__scb_ce_guard_installed__=!0;var t=customElements.define.bind(customElements);customElements.define=function(e,o,r){try{customElements.get(e)||t(e,o,r)}catch(c){var s=String(c||"");if(s.indexOf("already been used")===-1&&s.indexOf("NotSupportedError")===-1)throw c}}}}catch{}})();var w,q=0,a=(w=class extends R{constructor(...t){super(...t),this.variant="plain",this.arrow=null,this.supportingtext="",this.label="",this.trigger="hover",this.position="top",this.open=!1,this.delay=.25,this.offset=0,this.maxWidth="300px",this._hoverActive=!1,this._clickActive=!1,this._hideTimeout=null,this._triggerEl=null,this._originalPosition="top",this._tooltipId=`scb-tooltip-${++q}`,this._onTriggerMouseEnter=()=>{this._hasTooltipContent()&&(this._hoverActive=!0,this._setOpenState(!0))},this._onTriggerMouseLeave=()=>{this._hoverActive=!1,this._clickActive||this._setOpenState(!1)},this._onTriggerFocus=()=>{this._hasTooltipContent()&&(this._hoverActive=!0,this._setOpenState(!0))},this._onTriggerBlur=()=>{this._hoverActive=!1,this._clickActive||this._setOpenState(!1)},this._onTooltipMouseEnter=()=>{this._hasTooltipContent()&&(this.trigger==="hover"||this.trigger==="hover-click")&&(this._hoverActive=!0,this._setOpenState(!0))},this._onTooltipMouseLeave=()=>{(this.trigger==="hover"||this.trigger==="hover-click")&&(this._hoverActive=!1,this._clickActive||this._setOpenState(!1))},this._onTriggerClick=()=>{this._hasTooltipContent()&&(this._clickActive=!this._clickActive,this._clickActive?this._setOpenState(!0):this._hoverActive||this._setOpenState(!1))}}firstUpdated(){this._originalPosition=this.position,this._updateDelayCss(),this._updateMaxWidthCss(),this._updateTriggerElement(),this._updateTooltipHoverListeners(),this.open&&this._syncOpenState()}updated(t){if(t.has("trigger")&&(this._updateTriggerElement(),this._updateTooltipHoverListeners()),t.has("delay")&&this._updateDelayCss(),t.has("maxWidth")&&this._updateMaxWidthCss(),(t.has("supportingtext")||t.has("label")||t.has("variant"))&&(this._hasTooltipContent()||(this._hoverActive=!1,this._clickActive=!1,this.open=!1),this._updateTriggerElement(),this._updateTooltipHoverListeners()),t.has("open")){if(this.open&&!this._hasTooltipContent()){this.open=!1;return}this._syncOpenState(),this._dispatchOpenChanged()}}disconnectedCallback(){super.disconnectedCallback(),this._detachTriggerListeners();const t=this._getTooltipElement();t&&(t.removeEventListener("mouseenter",this._onTooltipMouseEnter),t.removeEventListener("mouseleave",this._onTooltipMouseLeave)),this._hideTimeout!==null&&(window.clearTimeout(this._hideTimeout),this._hideTimeout=null)}_getTooltipElement(){return this.renderRoot.querySelector(".scb-tooltip")}_syncOpenState(){const t=this._getTooltipElement();t&&(this.open?this._showTooltip(t):this._hideTooltip(t))}_setOpenState(t){if(this.open===t){t&&this._syncOpenState();return}this.open=t}_hasTooltipContent(){const t=(this.supportingtext||"").trim();return this.variant==="rich"?!!((this.label||"").trim()||t):!!t}_updateDelayCss(){const t=Number.isFinite(this.delay)?this.delay:.25;this.style.setProperty("--delay",`${t}s`)}_updateMaxWidthCss(){const t=(this.maxWidth||"").trim(),e=t.toLowerCase()==="none",o=e?"none":t||"300px";this.style.setProperty("--max-width",o),this.style.setProperty("--wrap",e?"nowrap":"normal")}_dispatchOpenChanged(){const t={open:this.open};this.dispatchEvent(new CustomEvent("open-changed",{detail:t,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("openchanged",{detail:t,bubbles:!0,composed:!0}))}_findTriggerElement(){const t=this.querySelector("[scb-tooltip-anchor]:not([slot])");return t||(Array.from(this.children).find(e=>e.nodeType===Node.ELEMENT_NODE)??null)}_updateTriggerElement(){const t=this._triggerEl;t&&(this._detachTriggerListeners(),t.removeAttribute("aria-describedby"));const e=this._findTriggerElement();this._triggerEl=e,e&&this._hasTooltipContent()&&(e.setAttribute("aria-describedby",this._tooltipId),(this.trigger==="click"||this.trigger==="hover-click")&&e.addEventListener("click",this._onTriggerClick),(this.trigger==="hover"||this.trigger==="hover-click")&&(e.addEventListener("mouseenter",this._onTriggerMouseEnter),e.addEventListener("mouseleave",this._onTriggerMouseLeave),e.addEventListener("focus",this._onTriggerFocus),e.addEventListener("blur",this._onTriggerBlur)))}_updateTooltipHoverListeners(){const t=this._getTooltipElement();t&&(t.removeEventListener("mouseenter",this._onTooltipMouseEnter),t.removeEventListener("mouseleave",this._onTooltipMouseLeave),(this.trigger==="hover"||this.trigger==="hover-click")&&(t.addEventListener("mouseenter",this._onTooltipMouseEnter),t.addEventListener("mouseleave",this._onTooltipMouseLeave)))}_detachTriggerListeners(){const t=this._triggerEl;t&&(t.removeEventListener("click",this._onTriggerClick),t.removeEventListener("mouseenter",this._onTriggerMouseEnter),t.removeEventListener("mouseleave",this._onTriggerMouseLeave),t.removeEventListener("focus",this._onTriggerFocus),t.removeEventListener("blur",this._onTriggerBlur))}_showTooltip(t){if(!this._hasTooltipContent()){this.open=!1;return}this._hideTimeout!==null&&(window.clearTimeout(this._hideTimeout),this._hideTimeout=null);const e=this._triggerEl;this._resetPosition(),t.classList.remove("hidden"),t.setAttribute("aria-hidden","false"),requestAnimationFrame(()=>{e&&this._positionTooltip(t,e),t.setAttribute("open","")})}_hideTooltip(t){t.removeAttribute("open"),t.setAttribute("aria-hidden","true"),this._scheduleHidden(t)}_scheduleHidden(t){const e=(Number.isFinite(this.delay)?this.delay:.25)*1e3;if(e<=0){t.classList.add("hidden");return}this._hideTimeout=window.setTimeout(()=>{t.classList.add("hidden"),this._hideTimeout=null},e)}_resetPosition(){this.position=this._originalPosition}_positionTooltip(t,e){const o=e.getBoundingClientRect(),r=t.getBoundingClientRect(),s=this.getBoundingClientRect(),c=(this.offset??0)+8,u=8,b=u,y=window.innerHeight-u,T=u,x=window.innerWidth-u,O=i=>i>=b&&i+r.height<=y,A=i=>i>=T&&i+r.width<=x,E=(i,n,l,g)=>{let d=0;i<l&&(d+=l-i);const f=i+n;return f>g&&(d+=f-g),d},$=i=>{let n=0,l=0;switch(i){case"top":n=o.top-s.top-r.height-c,l=o.left-s.left+(o.width-r.width)/2;break;case"bottom":n=o.bottom-s.top+c,l=o.left-s.left+(o.width-r.width)/2;break;case"left":l=o.left-s.left-r.width-c,n=o.top-s.top+(o.height-r.height)/2;break;case"right":l=o.right-s.left+c,n=o.top-s.top+(o.height-r.height)/2;break}const g=n+s.top,d=l+s.left,f=E(g,r.height,b,y),D=E(d,r.width,T,x);return{pos:i,top:n,left:l,fitsV:O(g),fitsH:A(d),totalOverflow:f+D}},L=this.position==="top"||this.position==="bottom",C=this.position,S=[C,this._getOppositePosition(C),L?"left":"top",L?"right":"bottom"].map($);let v=S.find(i=>i.fitsV&&i.fitsH)??S.reduce((i,n)=>n.totalOverflow<i.totalOverflow?n:i);const k=(i,n,l)=>Math.min(Math.max(i,n),l),H=b-s.top,P=y-r.height-s.top,B=T-s.left,W=x-r.width-s.left,z=k(v.top,H,P),N=k(v.left,B,W);t.style.top=`${z}px`,t.style.left=`${N}px`,this.position!==v.pos&&(this.position=v.pos)}_getOppositePosition(t){switch(t){case"top":return"bottom";case"bottom":return"top";case"left":return"right";case"right":return"left"}}_onDefaultSlotChange(){this._updateTriggerElement(),this.open&&this._syncOpenState()}render(){const t=this._hasTooltipContent(),e=this.arrow?m`<svg
1
+ import{_ as R,b as F,g as I,h as p,o as M,v as V,y as m}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import"../../vendor/icon.js";import{t as h}from"../../vendor/decorate.js";import"../scb-button/scb-button.js";(function(){try{var _=typeof globalThis<"u"?globalThis:window;if(!_.__scb_ce_guard_installed__){_.__scb_ce_guard_installed__=!0;var t=customElements.define.bind(customElements);customElements.define=function(e,o,r){try{customElements.get(e)||t(e,o,r)}catch(c){var s=String(c||"");if(s.indexOf("already been used")===-1&&s.indexOf("NotSupportedError")===-1)throw c}}}}catch{}})();var w,q=0,a=(w=class extends R{constructor(...t){super(...t),this.variant="plain",this.arrow=null,this.supportingtext="",this.label="",this.trigger="hover",this.position="top",this.open=!1,this.delay=.25,this.offset=0,this.maxWidth="300px",this._hoverActive=!1,this._clickActive=!1,this._hideTimeout=null,this._triggerEl=null,this._originalPosition="top",this._tooltipId=`scb-tooltip-${++q}`,this._onTriggerMouseEnter=()=>{this._hasTooltipContent()&&(this._hoverActive=!0,this._setOpenState(!0))},this._onTriggerMouseLeave=()=>{this._hoverActive=!1,this._clickActive||this._setOpenState(!1)},this._onTriggerFocus=()=>{this._hasTooltipContent()&&(this._hoverActive=!0,this._setOpenState(!0))},this._onTriggerBlur=()=>{this._hoverActive=!1,this._clickActive||this._setOpenState(!1)},this._onTooltipMouseEnter=()=>{this._hasTooltipContent()&&(this.trigger==="hover"||this.trigger==="hover-click")&&(this._hoverActive=!0,this._setOpenState(!0))},this._onTooltipMouseLeave=()=>{(this.trigger==="hover"||this.trigger==="hover-click")&&(this._hoverActive=!1,this._clickActive||this._setOpenState(!1))},this._onTriggerClick=()=>{this._hasTooltipContent()&&(this._clickActive=!this._clickActive,this._clickActive?this._setOpenState(!0):this._hoverActive||this._setOpenState(!1))}}firstUpdated(){this._originalPosition=this.position,this._updateDelayCss(),this._updateMaxWidthCss(),this._updateTriggerElement(),this._updateTooltipHoverListeners(),this.open&&this._syncOpenState()}updated(t){if(t.has("trigger")&&(this._updateTriggerElement(),this._updateTooltipHoverListeners()),t.has("delay")&&this._updateDelayCss(),t.has("maxWidth")&&this._updateMaxWidthCss(),(t.has("supportingtext")||t.has("label")||t.has("variant"))&&(this._hasTooltipContent()||(this._hoverActive=!1,this._clickActive=!1,this.open=!1),this._updateTriggerElement(),this._updateTooltipHoverListeners()),t.has("open")){if(this.open&&!this._hasTooltipContent()){this.open=!1;return}this._syncOpenState(),this._dispatchOpenChanged()}}disconnectedCallback(){super.disconnectedCallback(),this._detachTriggerListeners();const t=this._getTooltipElement();t&&(t.removeEventListener("mouseenter",this._onTooltipMouseEnter),t.removeEventListener("mouseleave",this._onTooltipMouseLeave)),this._hideTimeout!==null&&(window.clearTimeout(this._hideTimeout),this._hideTimeout=null)}_getTooltipElement(){return this.renderRoot.querySelector(".scb-tooltip")}_syncOpenState(){const t=this._getTooltipElement();t&&(this.open?this._showTooltip(t):this._hideTooltip(t))}_setOpenState(t){if(this.open===t){t&&this._syncOpenState();return}this.open=t}_hasTooltipContent(){const t=(this.supportingtext||"").trim();return this.variant==="rich"?!!((this.label||"").trim()||t):!!t}_updateDelayCss(){const t=Number.isFinite(this.delay)?this.delay:.25;this.style.setProperty("--delay",`${t}s`)}_updateMaxWidthCss(){const t=(this.maxWidth||"").trim(),e=t.toLowerCase()==="none",o=e?"none":t||"300px";this.style.setProperty("--max-width",o),this.style.setProperty("--wrap",e?"nowrap":"normal")}_dispatchOpenChanged(){const t={open:this.open};this.dispatchEvent(new CustomEvent("open-changed",{detail:t,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("openchanged",{detail:t,bubbles:!0,composed:!0}))}_findTriggerElement(){const t=this.querySelector("[scb-tooltip-anchor]:not([slot])");return t||(Array.from(this.children).find(e=>e.nodeType===Node.ELEMENT_NODE)??null)}_updateTriggerElement(){const t=this._triggerEl;t&&(this._detachTriggerListeners(),t.removeAttribute("aria-describedby"));const e=this._findTriggerElement();this._triggerEl=e,e&&this._hasTooltipContent()&&(e.setAttribute("aria-describedby",this._tooltipId),(this.trigger==="click"||this.trigger==="hover-click")&&e.addEventListener("click",this._onTriggerClick),(this.trigger==="hover"||this.trigger==="hover-click")&&(e.addEventListener("mouseenter",this._onTriggerMouseEnter),e.addEventListener("mouseleave",this._onTriggerMouseLeave),e.addEventListener("focus",this._onTriggerFocus),e.addEventListener("blur",this._onTriggerBlur)))}_updateTooltipHoverListeners(){const t=this._getTooltipElement();t&&(t.removeEventListener("mouseenter",this._onTooltipMouseEnter),t.removeEventListener("mouseleave",this._onTooltipMouseLeave),(this.trigger==="hover"||this.trigger==="hover-click")&&(t.addEventListener("mouseenter",this._onTooltipMouseEnter),t.addEventListener("mouseleave",this._onTooltipMouseLeave)))}_detachTriggerListeners(){const t=this._triggerEl;t&&(t.removeEventListener("click",this._onTriggerClick),t.removeEventListener("mouseenter",this._onTriggerMouseEnter),t.removeEventListener("mouseleave",this._onTriggerMouseLeave),t.removeEventListener("focus",this._onTriggerFocus),t.removeEventListener("blur",this._onTriggerBlur))}_showTooltip(t){if(!this._hasTooltipContent()){this.open=!1;return}this._hideTimeout!==null&&(window.clearTimeout(this._hideTimeout),this._hideTimeout=null);const e=this._triggerEl;this._resetPosition(),t.classList.remove("hidden"),t.setAttribute("aria-hidden","false"),requestAnimationFrame(()=>{e&&this._positionTooltip(t,e),t.setAttribute("open","")})}_hideTooltip(t){t.removeAttribute("open"),t.setAttribute("aria-hidden","true"),this._scheduleHidden(t)}_scheduleHidden(t){const e=(Number.isFinite(this.delay)?this.delay:.25)*1e3;if(e<=0){t.classList.add("hidden");return}this._hideTimeout=window.setTimeout(()=>{t.classList.add("hidden"),this._hideTimeout=null},e)}_resetPosition(){this.position=this._originalPosition}_positionTooltip(t,e){const o=e.getBoundingClientRect(),r=t.getBoundingClientRect(),s=this.getBoundingClientRect(),c=(this.offset??0)+8,u=8,b=u,y=window.innerHeight-u,T=u,x=window.innerWidth-u,O=i=>i>=b&&i+r.height<=y,A=i=>i>=T&&i+r.width<=x,E=(i,n,l,g)=>{let d=0;i<l&&(d+=l-i);const f=i+n;return f>g&&(d+=f-g),d},$=i=>{let n=0,l=0;switch(i){case"top":n=o.top-s.top-r.height-c,l=o.left-s.left+(o.width-r.width)/2;break;case"bottom":n=o.bottom-s.top+c,l=o.left-s.left+(o.width-r.width)/2;break;case"left":l=o.left-s.left-r.width-c,n=o.top-s.top+(o.height-r.height)/2;break;case"right":l=o.right-s.left+c,n=o.top-s.top+(o.height-r.height)/2;break}const g=n+s.top,d=l+s.left,f=E(g,r.height,b,y),D=E(d,r.width,T,x);return{pos:i,top:n,left:l,fitsV:O(g),fitsH:A(d),totalOverflow:f+D}},L=this.position==="top"||this.position==="bottom",C=this.position,S=[C,this._getOppositePosition(C),L?"left":"top",L?"right":"bottom"].map($);let v=S.find(i=>i.fitsV&&i.fitsH)??S.reduce((i,n)=>n.totalOverflow<i.totalOverflow?n:i);const k=(i,n,l)=>Math.min(Math.max(i,n),l),H=b-s.top,P=y-r.height-s.top,B=T-s.left,W=x-r.width-s.left,z=k(v.top,H,P),N=k(v.left,B,W);t.style.top=`${z}px`,t.style.left=`${N}px`,this.position!==v.pos&&(this.position=v.pos)}_getOppositePosition(t){switch(t){case"top":return"bottom";case"bottom":return"top";case"left":return"right";case"right":return"left"}}_onDefaultSlotChange(){this._updateTriggerElement(),this.open&&this._syncOpenState()}render(){const t=this._hasTooltipContent(),e=this.arrow?m`<svg
2
2
  class="scb-tooltip-arrow"
3
3
  xmlns="http://www.w3.org/2000/svg"
4
4
  width="13"