PageSourceSearch

https://www.lidl.es/p/fragment/fragment-OverlayTrigger.78586cad.mjs

js lidl.es collected 2026-10-01 10:25:19 UTC 5,874 bytes, 1 lines download raw bytes

1import{E as r,F as C,a as O,b as $,T as F,_ as v,B as w,c as k}from"./fragment.c3ddee34.mjs";import{e as h,Q as m,d as L,o as i,g as d,i as n,n as u,t as S,j as y,J as c,M as T,a5 as E,D as B,I as g,h as N}from"./fragment-vendors.19bdba54.mjs";function A(e){return{all:e=e||new Map,on:function(t,o){var s=e.get(t);s?s.push(o):e.set(t,[o])},off:function(t,o){var s=e.get(t);s&&(o?s.splice(s.indexOf(o)>>>0,1):e.set(t,[]))},emit:function(t,o){var s=e.get(t);s&&s.slice().map(function(l){l(o)}),(s=e.get("*"))&&s.slice().map(function(l){l(t,o)})}}}const f=A(),R=h({props:{overlayTitle:{type:String,default:""},overlayFormat:{type:String,default:""}},data:()=>({overlayOpen:!0,activeElement:null,sourceElement:null}),computed:{overlayContainerClass(){return this.overlayFormat?`overlay__container--${this.overlayFormat}`:""},overlayContentClass(){return this.overlayFormat?`overlay__content--${this.overlayFormat}`:""},overlayTitleClass(){return this.overlayFormat?`overlay__title--${this.overlayFormat}`:""}},mounted(){this.overlayOpen=!0,this.activeElement=document.activeElement,m(()=>this.onOpen()),window.addEventListener("mousedown",this.setSourceElement),f.on(r.CLOSE_OVERLAY,this.close)},methods:{handleResize(){L(()=>{this.cssVhProperty()},400)},cssVhProperty(){const e=window.innerHeight*.01;this.$refs.overlay?.style.setProperty("--vh",`${e}px`)},getFocusableNodes(){const e=this.$refs.overlay.querySelectorAll(C);return Object.keys(e).map(t=>e[+t])},setFocusToFirstNode(){const e=this.getFocusableNodes();e.length&&e[0].focus()},setFocusToFallback(){const e=document.getElementById("product-multimediabox-gallery");if(e){const t=e.querySelector(O);t&&t.focus()}},trapFocus(e){const t=this.getFocusableNodes();if(!this.$refs.overlay.contains(document.activeElement))t[0].focus();else{const o=t.indexOf(document.activeElement);e.shiftKey&&o===0&&(t[t.length-1].focus(),e.preventDefault()),!e.shiftKey&&o===t.length-1&&(t[0].focus(),e.preventDefault())}},resetFocus(){this.activeElement=null,m(()=>this.setFocusToFirstNode())},onKeyDown(e){e.keyCode===$&&this.close(),e.keyCode===F&&this.trapFocus(e)},onOpen(){window.addEventListener("keydown",this.onKeyDown),document.body.style.overflow="hidden",this.setFocusToFirstNode(),this.cssVhProperty(),window.addEventListener("resize",this.handleResize)},onClose(){document.body.style.overflow="",this.activeElement?this.activeElement.focus():this.setFocusToFallback(),window.removeEventListener("keydown",this.onKeyDown),window.removeEventListener("resize",this.handleResize),this.$emit(r.CLOSE_OVERLAY)},close(){this.overlayOpen=!1,this.onClose()},closeOnBackground(e){e.target===this.sourceElement&&(e.target===this.$refs.overlay||e.target===this.$refs.overlay__container)&&this.close()},beforeDestroy(){this.close(),window.removeEventListener("mousedown",this.setSourceElement),f.off(r.CLOSE_OVERLAY,this.close)},setSourceElement(e){this.sourceElement=e.target}}});const V={class:"overlay__wrapper"},D=["title","aria-label"];function P(e,t,o,s,l,p){return e.overlayOpen?(i(),d("dialog",{key:0,ref:"overlay","aria-labelledby":"product-overlay-title","aria-describedby":"product-overlay-content",class:"overlay",open:"","aria-modal":"true","data-qa-label":"overlay",onClick:t[1]||(t[1]=(...a)=>e.closeOnBackground&&e.closeOnBackground(...a)),onTouchstart:t[2]||(t[2]=(...a)=>e.closeOnBackground&&e.closeOnBackground(...a))},[n("div",{ref:"overlay__container",class:u(["overlay__container",e.overlayContainerClass])},[n("div",V,[e.overlayTitle?(i(),d("h2",{key:0,id:"product-overlay-title",class:u(["overlay__title",e.overlayTitleClass]),"data-qa-label":"overlay-title"},S(e.overlayTitle),3)):y("",!0),n("button",{title:e.$t("Product.Global_CloseButton"),"aria-label":e.$t("Product.Global_CloseButton"),type:"button",class:"overlay__close","data-qa-label":"overlay-close",onClick:t[0]||(t[0]=(...a)=>e.close&&e.close(...a))},[...t[3]||(t[3]=[n("span",{class:"close"},null,-1)])],8,D),n("div",{id:"product-overlay-content",class:u([e.overlayContentClass,"overlay__content"])},[c(e.$slots,"default",{},void 0,!0)],2)])],2)],544)):y("",!0)}const z=v(R,[["render",P],["__scopeId","data-v-24d70bbc"]]),K=h({setup(){const{value:e}=T(null);return{portal:e}},mounted(){document.body.appendChild(this.$el)},beforeUnmount(){this.portal?.remove()}}),Y={ref:"portal"};function I(e,t,o,s,l,p){return i(),d("div",Y,[c(e.$slots,"default")],512)}const M=v(K,[["render",I]]),q=h({components:{Overlay:z,Portal:M},props:{href:{type:String,default:"#"},overlayTitle:{type:String,default:void 0},overlayFormat:{type:String,default:void 0},component:{type:String,default:void 0},showFallbackForMobile:{type:Boolean,default:!1},enabled:{type:Boolean,default:!0}},data:()=>({lazyLoading:!1,open:!1}),computed:{target(){return this.href!=="#"?"_blank":"_self"}},methods:{async handleClick(e){if(this.enabled){if(this.lazyLoading){e.preventDefault();return}try{this.lazyLoading=!0,await this.openDialog(e)}catch(t){console.error("Error while opening dialog",t),f.emit(r.ERROR_OVERLAY)}finally{this.lazyLoading=!1}}},resetFocus(){this.$refs.overlay&&this.$refs.overlay?.resetFocus?.()}
1,async openDialog(e){this.showFallbackForMobile&&window.innerWidth<w["md-lg"]||(e.preventDefault(),this.open=!0,k(this,r.OPEN_OVERLAY))},closeOverlay(){this.open=!1,this.$emit(r.CLOSE_OVERLAY)}}}),G=["href","target","tabindex"];function U(e,t,o,s,l,p){const a=E("Overlay"),b=E("Portal");return i(),d("a",{href:e.href,target:e.target,tabindex:e.enabled?0:-1,onClick:t[0]||(t[0]=(..._)=>e.handleClick&&e.handleClick(..._))},[c(e.$slots,"default"),e.open?(i(),B(b,{key:0},{default:g(()=>[N(a,{ref:"overlay",overlayTitle:e.overlayTitle,overlayFormat:e.overlayFormat,onCloseOverlay:e.closeOverlay},{default:g(()=>[c(e.$slots,"content")]),_:3},8,["overlayTitle","overlayFormat","onCloseOverlay"])]),_:3})):y("",!0)],8,G)}const J=v(q,[["render",U]]);export{J as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.