scb-wc 0.1.181 → 0.1.183

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import{f as m,h as z,m as C,p as k,v as c,y as P}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import"../../vendor/icon.js";import"../../vendor/ripple.js";import{addLazyFocusRingListeners as Y}from"../shared/lazy-focus-ring.js";import{componentSizeToken as f}from"../shared/component-size-token.js";import{t as l}from"../../vendor/decorate.js";import"../scb-button/scb-button.js";import"../scb-icon-button/scb-icon-button.js";import{closeManualPopover as x,isManualPopoverOpen as S,openManualPopover as O}from"../shared/manual-popover.js";import"../scb-divider/scb-divider.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,i,d){try{customElements.get(e)||t(e,i,d)}catch(a){var o=String(a||"");if(o.indexOf("already been used")===-1&&o.indexOf("NotSupportedError")===-1)throw a}}}}catch{}})();var D,p=(D=class extends z{constructor(...t){super(...t),this._currentDate=new Date,this._selectedDate=null,this._showMonthDropdown=!1,this._showYearDropdown=!1,this.variant="date",this.lang="sv",this.selectedValue="",this.open=!0,this._selectedHour=0,this._selectedMinute=0,this._viewportMargin=8,this._popupOffset=4,this._onWindowReposition=()=>{this._positionPopupWithinViewport()},this._monthNames=[this.lang=="sv"?"Januari":"January",this.lang=="sv"?"Februari":"February",this.lang=="sv"?"Mars":"March",(this.lang=="sv","April"),this.lang=="sv"?"Maj":"May",this.lang=="sv"?"Juni":"June",this.lang=="sv"?"Juli":"July",this.lang=="sv"?"Augusti":"August",(this.lang=="sv","September"),this.lang=="sv"?"Oktober":"October",(this.lang=="sv","November"),(this.lang=="sv","December")],this._onPopupKeydown=e=>{e.key==="Escape"&&(e.preventDefault(),e.stopPropagation(),!this._closeOpenDropdowns()&&this._close())},this._outsideClickHandler=e=>{this.open&&(e.composedPath().includes(this)||this._close())},this._prevMonth=()=>{const e=this._currentDate.getFullYear(),i=this._currentDate.getMonth();i===0?this._currentDate=new Date(e-1,11,1):this._currentDate=new Date(e,i-1,1)},this._prevYear=()=>{const e=this._currentDate.getFullYear(),i=this._currentDate.getMonth();this._currentDate=new Date(e-1,i,1)},this._nextMonth=()=>{const e=this._currentDate.getFullYear(),i=this._currentDate.getMonth();i===11?this._currentDate=new Date(e+1,0,1):this._currentDate=new Date(e,i+1,1)},this._nextYear=()=>{const e=this._currentDate.getFullYear(),i=this._currentDate.getMonth();this._currentDate=new Date(e+1,i,1)},this._onTimeChange=e=>{const[i,d]=e.target.value.split(":"),o=parseInt(i,10),a=parseInt(d,10);this._selectedHour=isNaN(o)?0:Math.max(0,Math.min(23,o)),this._selectedMinute=isNaN(a)?0:Math.max(0,Math.min(59,a)),this._fireDateTimeChange()},this._close=()=>{this.open=!1,this.dispatchEvent(new CustomEvent("datepicker-closed",{bubbles:!0,composed:!0}))}}_isRenderedInsideDialog(){const t=this.getRootNode(),e=t instanceof ShadowRoot?t.host:null;return e instanceof HTMLElement&&e.closest("scb-dialog")?!0:!!this.closest("scb-dialog")}_usesInPlaceLayout(){const t=getComputedStyle(this).position;return t==="relative"||t==="static"}connectedCallback(){super.connectedCallback(),this._removeLazyFocusRingListeners=Y(this,this.renderRoot)}_positionPopupWithinViewport(){if(!this.open)return;const t=this.renderRoot.querySelector(".datepicker-popup");if(!t)return;if(this._usesInPlaceLayout()){x(t);return}const e=this.parentElement?.getBoundingClientRect();if(!e)return;const i=window.innerWidth,d=window.innerHeight,o=Math.max(220,i-this._viewportMargin*2);if(S(t)){const u=Math.min(this.getBoundingClientRect().width||t.offsetWidth||380,o),v=t.offsetHeight||420,w=Math.min(Math.max(e.left,this._viewportMargin),i-this._viewportMargin-u),h=d-e.bottom-this._viewportMargin,g=e.top-this._viewportMargin,y=h<v+this._popupOffset&&g>h;this._isRenderedInsideDialog()?(this.style.setProperty("--scb-datepicker-position","absolute"),this.style.setProperty("--scb-datepicker-left","0px"),this.style.setProperty("--scb-datepicker-top",`${e.height+this._popupOffset}px`)):(this.style.setProperty("--scb-datepicker-position","fixed"),this.style.setProperty("--scb-datepicker-left",`${w}px`),this.style.setProperty("--scb-datepicker-top",`${e.bottom+this._popupOffset}px`)),this.style.setProperty("--scb-datepicker-computed-width",`${u}px`),this.style.setProperty("--scb-datepicker-transform","none"),this.style.setProperty("--scb-datepicker-bottom","auto"),t.style.position="fixed",t.style.left=`${Math.round(w)}px`,t.style.width=`${Math.round(u)}px`,t.style.right="auto",t.style.bottom="auto",t.style.maxHeight=`${Math.max(0,(y?g:h)-this._popupOffset)}px`,t.style.top=y?`${Math.max(this._viewportMargin,e.top-v-this._popupOffset)}px`:`${e.bottom+this._popupOffset}px`;return}if(this._isRenderedInsideDialog()){const u=Math.min(t.offsetWidth||380,o),v=t.offsetHeight||420,w=Math.min(Math.max(e.left,this._viewportMargin),i-this._viewportMargin-u),h=d-e.bottom-this._viewportMargin,g=e.top-this._viewportMargin,y=h<v+this._popupOffset&&g>h;if(this.style.setProperty("--scb-datepicker-position","absolute"),this.style.setProperty("--scb-datepicker-computed-width",`${u}px`),this.style.setProperty("--scb-datepicker-left",`${w-e.left}px`),this.style.setProperty("--scb-datepicker-transform","none"),this.style.setProperty("--scb-datepicker-bottom","auto"),y){const M=Math.max(this._viewportMargin,e.top-v-this._popupOffset)-e.top;this.style.setProperty("--scb-datepicker-top",`${M}px`),this.style.setProperty("--scb-datepicker-max-height",`${Math.max(0,g-this._popupOffset)}px`)}else this.style.setProperty("--scb-datepicker-top",`${e.height+this._popupOffset}px`),this.style.setProperty("--scb-datepicker-max-height",`${Math.max(0,h-this._popupOffset)}px`);return}const a=Math.min(t.offsetWidth||380,o),s=t.offsetHeight||420,r=Math.min(Math.max(e.left,this._viewportMargin),i-this._viewportMargin-a),n=d-e.bottom-this._viewportMargin,b=e.top-this._viewportMargin,$=n<s+this._popupOffset&&b>n;this.style.setProperty("--scb-datepicker-position","fixed"),this.style.setProperty("--scb-datepicker-computed-width",`${a}px`),this.style.setProperty("--scb-datepicker-left",`${r}px`),this.style.setProperty("--scb-datepicker-transform","none"),$?(this.style.setProperty("--scb-datepicker-top",`${Math.max(this._viewportMargin,e.top-s-this._popupOffset)}px`),this.style.setProperty("--scb-datepicker-bottom","auto"),this.style.setProperty("--scb-datepicker-max-height",`${Math.max(0,b-this._popupOffset)}px`)):(this.style.setProperty("--scb-datepicker-top",`${e.bottom+this._popupOffset}px`),this.style.setProperty("--scb-datepicker-bottom","auto"),this.style.setProperty("--scb-datepicker-max-height",`${Math.max(0,n-this._popupOffset)}px`))}updated(t){if(super.updated(t),this.open?(window.addEventListener("mousedown",this._outsideClickHandler),window.addEventListener("resize",this._onWindowReposition,{passive:!0}),window.addEventListener("scroll",this._onWindowReposition,{passive:!0,capture:!0}),requestAnimationFrame(()=>this._positionPopupWithinViewport())):(window.removeEventListener("mousedown",this._outsideClickHandler),window.removeEventListener("resize",this._onWindowReposition),window.removeEventListener("scroll",this._onWindowReposition,!0)),t.has("selectedValue")&&this.selectedValue){const e=new Date(this.selectedValue);isNaN(e.getTime())||(this._selectedDate=e,this._currentDate=new Date(e.getFullYear(),e.getMonth(),1),this.variant==="datetime-local"&&(this._selectedHour=e.getHours(),this._selectedMinute=e.getMinutes()))}if(this.open){const e=this.renderRoot.querySelector(".datepicker-popup");this._usesInPlaceLayout()?x(e):O(e),requestAnimationFrame(()=>this._positionPopupWithinViewport())}}disconnectedCallback(){this._removeLazyFocusRingListeners?.(),this._removeLazyFocusRingListeners=void 0,window.removeEventListener("mousedown",this._outsideClickHandler),window.removeEventListener("resize",this._onWindowReposition),window.removeEventListener("scroll",this._onWindowReposition,!0),x(this.renderRoot.querySelector(".datepicker-popup")),super.disconnectedCallback()}_locale(){return this.lang==="sv"?"sv-SE":"en-GB"}_formatDateLabel(t){return new Intl.DateTimeFormat(this._locale(),{day:"numeric",month:"long",year:"numeric"}).format(t)}_closeOpenDropdowns(){return!this._showMonthDropdown&&!this._showYearDropdown?!1:(this._showMonthDropdown=!1,this._showYearDropdown=!1,!0)}render(){if(!this.open)return c``;const t=this._currentDate.getFullYear(),e=this._currentDate.getMonth(),i=new Date,d=this._getMonthDays(t,e),o=Array.from({length:101},(s,r)=>i.getFullYear()-50+r),a=this.variant==="datetime-local"&&!this._showMonthDropdown&&!this._showYearDropdown;return c`
1
+ import{f as m,h as z,m as C,p as k,v as c,y as P}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import"../../vendor/icon.js";import"../../vendor/ripple.js";import{addLazyFocusRingListeners as Y}from"../shared/lazy-focus-ring.js";import{componentSizeToken as f}from"../shared/component-size-token.js";import{t as l}from"../../vendor/decorate.js";import"../scb-button/scb-button.js";import"../scb-icon-button/scb-icon-button.js";import{closeManualPopover as x,isManualPopoverOpen as S,openManualPopover as O}from"../shared/manual-popover.js";import"../scb-divider/scb-divider.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,i,d){try{customElements.get(e)||t(e,i,d)}catch(a){var o=String(a||"");if(o.indexOf("already been used")===-1&&o.indexOf("NotSupportedError")===-1)throw a}}}}catch{}})();var D,p=(D=class extends z{constructor(...t){super(...t),this._currentDate=new Date,this._selectedDate=null,this._showMonthDropdown=!1,this._showYearDropdown=!1,this.variant="date",this.lang="sv",this.selectedValue="",this.open=!0,this._selectedHour=0,this._selectedMinute=0,this._viewportMargin=8,this._popupOffset=4,this._onWindowReposition=()=>{this._positionPopupWithinViewport()},this._monthNames=[this.lang=="sv"?"Januari":"January",this.lang=="sv"?"Februari":"February",this.lang=="sv"?"Mars":"March",(this.lang=="sv","April"),this.lang=="sv"?"Maj":"May",this.lang=="sv"?"Juni":"June",this.lang=="sv"?"Juli":"July",this.lang=="sv"?"Augusti":"August",(this.lang=="sv","September"),this.lang=="sv"?"Oktober":"October",(this.lang=="sv","November"),(this.lang=="sv","December")],this._onPopupKeydown=e=>{e.key==="Escape"&&(e.preventDefault(),e.stopPropagation(),!this._closeOpenDropdowns()&&this._close())},this._outsideClickHandler=e=>{this.open&&(e.composedPath().includes(this)||this._close())},this._prevMonth=()=>{const e=this._currentDate.getFullYear(),i=this._currentDate.getMonth();i===0?this._currentDate=new Date(e-1,11,1):this._currentDate=new Date(e,i-1,1)},this._prevYear=()=>{const e=this._currentDate.getFullYear(),i=this._currentDate.getMonth();this._currentDate=new Date(e-1,i,1)},this._nextMonth=()=>{const e=this._currentDate.getFullYear(),i=this._currentDate.getMonth();i===11?this._currentDate=new Date(e+1,0,1):this._currentDate=new Date(e,i+1,1)},this._nextYear=()=>{const e=this._currentDate.getFullYear(),i=this._currentDate.getMonth();this._currentDate=new Date(e+1,i,1)},this._onTimeChange=e=>{const[i,d]=e.target.value.split(":"),o=parseInt(i,10),a=parseInt(d,10);this._selectedHour=isNaN(o)?0:Math.max(0,Math.min(23,o)),this._selectedMinute=isNaN(a)?0:Math.max(0,Math.min(59,a)),this._fireDateTimeChange()},this._close=()=>{this.open=!1,this.dispatchEvent(new CustomEvent("datepicker-closed",{bubbles:!0,composed:!0}))}}_isRenderedInsideDialog(){const t=this.getRootNode(),e=t instanceof ShadowRoot?t.host:null;return e instanceof HTMLElement&&e.closest("scb-dialog")?!0:!!this.closest("scb-dialog")}_usesInPlaceLayout(){const t=getComputedStyle(this).position;return t==="relative"||t==="static"}connectedCallback(){super.connectedCallback(),this._removeLazyFocusRingListeners=Y(this,this.renderRoot)}_positionPopupWithinViewport(){if(!this.open)return;const t=this.renderRoot.querySelector(".datepicker-popup");if(!t)return;if(this._usesInPlaceLayout()){x(t);return}const e=this.parentElement?.getBoundingClientRect();if(!e)return;const i=window.innerWidth,d=window.innerHeight,o=Math.max(220,i-this._viewportMargin*2);if(S(t)){const u=Math.min(this.getBoundingClientRect().width||t.offsetWidth||380,o),v=t.offsetHeight||420,w=Math.min(Math.max(e.left,this._viewportMargin),i-this._viewportMargin-u),h=d-e.bottom-this._viewportMargin,g=e.top-this._viewportMargin,y=h<v+this._popupOffset&&g>h;this._isRenderedInsideDialog()?(this.style.setProperty("--scb-datepicker-position","absolute"),this.style.setProperty("--scb-datepicker-left","0px"),this.style.setProperty("--scb-datepicker-top",`${e.height+this._popupOffset}px`)):(this.style.setProperty("--scb-datepicker-position","fixed"),this.style.setProperty("--scb-datepicker-left",`${w}px`),this.style.setProperty("--scb-datepicker-top",`${e.bottom+this._popupOffset}px`)),this.style.setProperty("--scb-datepicker-computed-width",`${u}px`),this.style.setProperty("--scb-datepicker-transform","none"),this.style.setProperty("--scb-datepicker-bottom","auto"),t.style.position="fixed",t.style.left=`${Math.round(w)}px`,t.style.width=`${Math.round(u)}px`,t.style.right="auto",t.style.bottom="auto",t.style.maxHeight=`${Math.max(0,(y?g:h)-this._popupOffset)}px`,t.style.top=y?`${Math.max(this._viewportMargin,e.top-v-this._popupOffset)}px`:`${e.bottom+this._popupOffset}px`;return}if(this._isRenderedInsideDialog()){const u=Math.min(t.offsetWidth||380,o),v=t.offsetHeight||420,w=Math.min(Math.max(e.left,this._viewportMargin),i-this._viewportMargin-u),h=d-e.bottom-this._viewportMargin,g=e.top-this._viewportMargin,y=h<v+this._popupOffset&&g>h;if(this.style.setProperty("--scb-datepicker-position","absolute"),this.style.setProperty("--scb-datepicker-computed-width",`${u}px`),this.style.setProperty("--scb-datepicker-left",`${w-e.left}px`),this.style.setProperty("--scb-datepicker-transform","none"),this.style.setProperty("--scb-datepicker-bottom","auto"),y){const M=Math.max(this._viewportMargin,e.top-v-this._popupOffset)-e.top;this.style.setProperty("--scb-datepicker-top",`${M}px`),this.style.setProperty("--scb-datepicker-max-height",`${Math.max(0,g-this._popupOffset)}px`)}else this.style.setProperty("--scb-datepicker-top",`${e.height+this._popupOffset}px`),this.style.setProperty("--scb-datepicker-max-height",`${Math.max(0,h-this._popupOffset)}px`);return}const a=Math.min(t.offsetWidth||380,o),s=t.offsetHeight||420,r=Math.min(Math.max(e.left,this._viewportMargin),i-this._viewportMargin-a),n=d-e.bottom-this._viewportMargin,b=e.top-this._viewportMargin,$=n<s+this._popupOffset&&b>n;this.style.setProperty("--scb-datepicker-position","fixed"),this.style.setProperty("--scb-datepicker-computed-width",`${a}px`),this.style.setProperty("--scb-datepicker-left",`${r}px`),this.style.setProperty("--scb-datepicker-transform","none"),$?(this.style.setProperty("--scb-datepicker-top",`${Math.max(this._viewportMargin,e.top-s-this._popupOffset)}px`),this.style.setProperty("--scb-datepicker-bottom","auto"),this.style.setProperty("--scb-datepicker-max-height",`${Math.max(0,b-this._popupOffset)}px`)):(this.style.setProperty("--scb-datepicker-top",`${e.bottom+this._popupOffset}px`),this.style.setProperty("--scb-datepicker-bottom","auto"),this.style.setProperty("--scb-datepicker-max-height",`${Math.max(0,n-this._popupOffset)}px`))}updated(t){if(super.updated(t),this.open?(window.addEventListener("mousedown",this._outsideClickHandler),window.addEventListener("resize",this._onWindowReposition,{passive:!0}),window.addEventListener("scroll",this._onWindowReposition,{passive:!0,capture:!0})):(window.removeEventListener("mousedown",this._outsideClickHandler),window.removeEventListener("resize",this._onWindowReposition),window.removeEventListener("scroll",this._onWindowReposition,!0)),t.has("selectedValue")&&this.selectedValue){const e=new Date(this.selectedValue);isNaN(e.getTime())||(this._selectedDate=e,this._currentDate=new Date(e.getFullYear(),e.getMonth(),1),this.variant==="datetime-local"&&(this._selectedHour=e.getHours(),this._selectedMinute=e.getMinutes()))}if(this.open){const e=this.renderRoot.querySelector(".datepicker-popup");this._usesInPlaceLayout()?x(e):O(e),this._positionPopupWithinViewport(),requestAnimationFrame(()=>this._positionPopupWithinViewport())}}disconnectedCallback(){this._removeLazyFocusRingListeners?.(),this._removeLazyFocusRingListeners=void 0,window.removeEventListener("mousedown",this._outsideClickHandler),window.removeEventListener("resize",this._onWindowReposition),window.removeEventListener("scroll",this._onWindowReposition,!0),x(this.renderRoot.querySelector(".datepicker-popup")),super.disconnectedCallback()}_locale(){return this.lang==="sv"?"sv-SE":"en-GB"}_formatDateLabel(t){return new Intl.DateTimeFormat(this._locale(),{day:"numeric",month:"long",year:"numeric"}).format(t)}_closeOpenDropdowns(){return!this._showMonthDropdown&&!this._showYearDropdown?!1:(this._showMonthDropdown=!1,this._showYearDropdown=!1,!0)}render(){if(!this.open)return c``;const t=this._currentDate.getFullYear(),e=this._currentDate.getMonth(),i=new Date,d=this._getMonthDays(t,e),o=Array.from({length:101},(s,r)=>i.getFullYear()-50+r),a=this.variant==="datetime-local"&&!this._showMonthDropdown&&!this._showYearDropdown;return c`
2
2
  <div class="datepicker-popup popup" @keydown=${this._onPopupKeydown}>
3
3
  <div class="header">
4
4
  <div class="month-selector ${this._showMonthDropdown?"open":""} ${this._showYearDropdown?"disable":""}">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "scb-wc",
3
- "version": "0.1.181",
3
+ "version": "0.1.183",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "module": "index.js",
@@ -474,5 +474,5 @@
474
474
  },
475
475
  "./mvc/*": "./mvc/*"
476
476
  },
477
- "buildHash": "5B636D5768FB31AB8F224B93348326B96D581B54B7E510C1349FD3A57E0C8FF5"
477
+ "buildHash": "F9488AA38FA5054521137102469E24F19A47CD96962AC9E98AA8326F1C6FC9AB"
478
478
  }
@@ -308,13 +308,13 @@ var f = class extends o {
308
308
  if (super.updated(e), this.open ? (window.addEventListener("mousedown", this._outsideClickHandler), window.addEventListener("resize", this._onWindowReposition, { passive: !0 }), window.addEventListener("scroll", this._onWindowReposition, {
309
309
  passive: !0,
310
310
  capture: !0
311
- }), requestAnimationFrame(() => this._positionPopupWithinViewport())) : (window.removeEventListener("mousedown", this._outsideClickHandler), window.removeEventListener("resize", this._onWindowReposition), window.removeEventListener("scroll", this._onWindowReposition, !0)), e.has("selectedValue") && this.selectedValue) {
311
+ })) : (window.removeEventListener("mousedown", this._outsideClickHandler), window.removeEventListener("resize", this._onWindowReposition), window.removeEventListener("scroll", this._onWindowReposition, !0)), e.has("selectedValue") && this.selectedValue) {
312
312
  let e = new Date(this.selectedValue);
313
313
  isNaN(e.getTime()) || (this._selectedDate = e, this._currentDate = new Date(e.getFullYear(), e.getMonth(), 1), this.variant === "datetime-local" && (this._selectedHour = e.getHours(), this._selectedMinute = e.getMinutes()));
314
314
  }
315
315
  if (this.open) {
316
316
  let e = this.renderRoot.querySelector(".datepicker-popup");
317
- this._usesInPlaceLayout() ? r(e) : a(e), requestAnimationFrame(() => this._positionPopupWithinViewport());
317
+ this._usesInPlaceLayout() ? r(e) : a(e), this._positionPopupWithinViewport(), requestAnimationFrame(() => this._positionPopupWithinViewport());
318
318
  }
319
319
  }
320
320
  disconnectedCallback() {
package/scb-wc.bundle.js CHANGED
@@ -5771,7 +5771,7 @@
5771
5771
  font-weight: var(--scb-datepicker-time-label-weight, var(--scb-typography-body-large-weight, var(--md-sys-typescale-body-large-weight, var(--weight-regular, 400))));
5772
5772
  letter-spacing: var(--scb-datepicker-time-label-tracking, var(--scb-typography-body-large-tracking, var(--md-sys-typescale-body-large-tracking, 0)));
5773
5773
  }
5774
- `]}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){let e=new Date(this.selectedValue);isNaN(e.getTime())||(this._selectedDate=e,this._currentDate=new Date(e.getFullYear(),e.getMonth(),1),this.variant===`datetime-local`&&(this._selectedHour=e.getHours(),this._selectedMinute=e.getMinutes()))}if(this.open){let e=this.renderRoot.querySelector(`.datepicker-popup`);this._usesInPlaceLayout()?z(e):vl(e),requestAnimationFrame(()=>this._positionPopupWithinViewport())}}disconnectedCallback(){this._removeLazyFocusRingListeners?.(),this._removeLazyFocusRingListeners=void 0,window.removeEventListener(`mousedown`,this._outsideClickHandler),window.removeEventListener(`resize`,this._onWindowReposition),window.removeEventListener(`scroll`,this._onWindowReposition,!0),z(this.renderRoot.querySelector(`.datepicker-popup`)),super.disconnectedCallback()}_locale(){return this.lang===`sv`?`sv-SE`:`en-GB`}_formatDateLabel(e){return new Intl.DateTimeFormat(this._locale(),{day:`numeric`,month:`long`,year:`numeric`}).format(e)}_closeOpenDropdowns(){return!this._showMonthDropdown&&!this._showYearDropdown?!1:(this._showMonthDropdown=!1,this._showYearDropdown=!1,!0)}render(){if(!this.open)return x``;let e=this._currentDate.getFullYear(),t=this._currentDate.getMonth(),n=new Date,r=this._getMonthDays(e,t),i=Array.from({length:101},(e,t)=>n.getFullYear()-50+t),a=this.variant===`datetime-local`&&!this._showMonthDropdown&&!this._showYearDropdown;return x`
5774
+ `]}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})):(window.removeEventListener(`mousedown`,this._outsideClickHandler),window.removeEventListener(`resize`,this._onWindowReposition),window.removeEventListener(`scroll`,this._onWindowReposition,!0)),e.has(`selectedValue`)&&this.selectedValue){let e=new Date(this.selectedValue);isNaN(e.getTime())||(this._selectedDate=e,this._currentDate=new Date(e.getFullYear(),e.getMonth(),1),this.variant===`datetime-local`&&(this._selectedHour=e.getHours(),this._selectedMinute=e.getMinutes()))}if(this.open){let e=this.renderRoot.querySelector(`.datepicker-popup`);this._usesInPlaceLayout()?z(e):vl(e),this._positionPopupWithinViewport(),requestAnimationFrame(()=>this._positionPopupWithinViewport())}}disconnectedCallback(){this._removeLazyFocusRingListeners?.(),this._removeLazyFocusRingListeners=void 0,window.removeEventListener(`mousedown`,this._outsideClickHandler),window.removeEventListener(`resize`,this._onWindowReposition),window.removeEventListener(`scroll`,this._onWindowReposition,!0),z(this.renderRoot.querySelector(`.datepicker-popup`)),super.disconnectedCallback()}_locale(){return this.lang===`sv`?`sv-SE`:`en-GB`}_formatDateLabel(e){return new Intl.DateTimeFormat(this._locale(),{day:`numeric`,month:`long`,year:`numeric`}).format(e)}_closeOpenDropdowns(){return!this._showMonthDropdown&&!this._showYearDropdown?!1:(this._showMonthDropdown=!1,this._showYearDropdown=!1,!0)}render(){if(!this.open)return x``;let e=this._currentDate.getFullYear(),t=this._currentDate.getMonth(),n=new Date,r=this._getMonthDays(e,t),i=Array.from({length:101},(e,t)=>n.getFullYear()-50+t),a=this.variant===`datetime-local`&&!this._showMonthDropdown&&!this._showYearDropdown;return x`
5775
5775
  <div class="datepicker-popup popup" @keydown=${this._onPopupKeydown}>
5776
5776
  <div class="header">
5777
5777
  <div class="month-selector ${this._showMonthDropdown?`open`:``} ${this._showYearDropdown?`disable`:``}">