UNPKG

primevue

Version:

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![npm version](https://badge.fury.io/js/primevue.svg)](https://badge.fury.io/js/primevue) [![Discord Chat](https://img.shields.io/discord/55794023

2 lines (1 loc) 30.7 kB
import e from"primevue/focustrap";import t from"primevue/portal";import{DomHandler as i,UniqueComponentId as a,ZIndexUtils as n}from"primevue/utils";import l from"primevue/ripple";import{resolveDirective as s,openBlock as r,createElementBlock as o,createElementVNode as d,withDirectives as c,normalizeClass as h,createCommentVNode as p,createBlock as u,resolveDynamicComponent as m,Fragment as v,renderList as g,mergeProps as b,normalizeStyle as f,resolveComponent as I,createVNode as y,withCtx as x,Transition as w}from"vue";var S={name:"GalleriaItem",emits:["start-slideshow","stop-slideshow","update:activeIndex"],props:{circular:{type:Boolean,default:!1},activeIndex:{type:Number,default:0},value:{type:Array,default:null},showItemNavigators:{type:Boolean,default:!0},showIndicators:{type:Boolean,default:!0},slideShowActive:{type:Boolean,default:!0},changeItemOnIndicatorHover:{type:Boolean,default:!0},autoPlay:{type:Boolean,default:!1},templates:{type:null,default:null},id:{type:String,default:null}},mounted(){this.autoPlay&&this.$emit("start-slideshow")},methods:{next(){let e=this.activeIndex+1,t=this.circular&&this.value.length-1===this.activeIndex?0:e;this.$emit("update:activeIndex",t)},prev(){let e=0!==this.activeIndex?this.activeIndex-1:0,t=this.circular&&0===this.activeIndex?this.value.length-1:e;this.$emit("update:activeIndex",t)},stopSlideShow(){this.slideShowActive&&this.stopSlideShow&&this.$emit("stop-slideshow")},navBackward(e){this.stopSlideShow(),this.prev(),e&&e.cancelable&&e.preventDefault()},navForward(e){this.stopSlideShow(),this.next(),e&&e.cancelable&&e.preventDefault()},onIndicatorClick(e){this.stopSlideShow(),this.$emit("update:activeIndex",e)},onIndicatorMouseEnter(e){this.changeItemOnIndicatorHover&&(this.stopSlideShow(),this.$emit("update:activeIndex",e))},onIndicatorKeyDown(e,t){switch(e.code){case"Enter":case"Space":this.stopSlideShow(),this.$emit("update:activeIndex",t),e.preventDefault();break;case"ArrowDown":case"ArrowUp":e.preventDefault()}},isIndicatorItemActive(e){return this.activeIndex===e},isNavBackwardDisabled(){return!this.circular&&0===this.activeIndex},isNavForwardDisabled(){return!this.circular&&this.activeIndex===this.value.length-1},ariaSlideNumber(e){return this.$primevue.config.locale.aria?this.$primevue.config.locale.aria.slideNumber.replace(/{slideNumber}/g,e):void 0},ariaPageLabel(e){return this.$primevue.config.locale.aria?this.$primevue.config.locale.aria.pageLabel.replace(/{page}/g,e):void 0}},computed:{activeItem(){return this.value[this.activeIndex]},navBackwardClass(){return["p-galleria-item-prev p-galleria-item-nav p-link",{"p-disabled":this.isNavBackwardDisabled()}]},navForwardClass(){return["p-galleria-item-next p-galleria-item-nav p-link",{"p-disabled":this.isNavForwardDisabled()}]},ariaSlideLabel(){return this.$primevue.config.locale.aria?this.$primevue.config.locale.aria.slide:void 0}},directives:{ripple:l}};const $={class:"p-galleria-item-wrapper"},k={class:"p-galleria-item-container"},C=["disabled"],V=[d("span",{class:"p-galleria-item-prev-icon pi pi-chevron-left"},null,-1)],_=["id","aria-label","aria-roledescription"],A=["disabled"],B=[d("span",{class:"p-galleria-item-next-icon pi pi-chevron-right"},null,-1)],P={key:2,class:"p-galleria-caption"},N={key:0,class:"p-galleria-indicators p-reset"},T=["aria-label","aria-selected","aria-controls","onClick","onMouseenter","onKeydown"],L={key:0,type:"button",tabindex:"-1",class:"p-link"};S.render=function(e,t,i,a,n,l){const b=s("ripple");return r(),o("div",$,[d("div",k,[i.showItemNavigators?c((r(),o("button",{key:0,type:"button",class:h(l.navBackwardClass),onClick:t[0]||(t[0]=e=>l.navBackward(e)),disabled:l.isNavBackwardDisabled()},V,10,C)),[[b]]):p("",!0),d("div",{id:i.id+"_item_"+i.activeIndex,class:"p-galleria-item",role:"group","aria-label":l.ariaSlideNumber(i.activeIndex+1),"aria-roledescription":l.ariaSlideLabel},[i.templates.item?(r(),u(m(i.templates.item),{key:0,item:l.activeItem},null,8,["item"])):p("",!0)],8,_),i.showItemNavigators?c((r(),o("button",{key:1,type:"button",class:h(l.navForwardClass),onClick:t[1]||(t[1]=e=>l.navForward(e)),disabled:l.isNavForwardDisabled()},B,10,A)),[[b]]):p("",!0),i.templates.caption?(r(),o("div",P,[i.templates.caption?(r(),u(m(i.templates.caption),{key:0,item:l.activeItem},null,8,["item"])):p("",!0)])):p("",!0)]),i.showIndicators?(r(),o("ul",N,[(r(!0),o(v,null,g(i.value,((e,t)=>(r(),o("li",{key:`p-galleria-indicator-${t}`,class:h(["p-galleria-indicator",{"p-highlight":l.isIndicatorItemActive(t)}]),tabindex:"0","aria-label":l.ariaPageLabel(t+1),"aria-selected":i.activeIndex===t,"aria-controls":i.id+"_item_"+t,onClick:e=>l.onIndicatorClick(t),onMouseenter:e=>l.onIndicatorMouseEnter(t),onKeydown:e=>l.onIndicatorKeyDown(e,t)},[i.templates.indicator?p("",!0):(r(),o("button",L)),i.templates.indicator?(r(),u(m(i.templates.indicator),{key:1,index:t},null,8,["index"])):p("",!0)],42,T)))),128))])):p("",!0)])};var D={name:"GalleriaThumbnails",emits:["stop-slideshow","update:activeIndex"],props:{containerId:{type:String,default:null},value:{type:Array,default:null},numVisible:{type:Number,default:3},activeIndex:{type:Number,default:0},isVertical:{type:Boolean,default:!1},slideShowActive:{type:Boolean,default:!1},circular:{type:Boolean,default:!1},responsiveOptions:{type:Array,default:null},contentHeight:{type:String,default:"300px"},showThumbnailNavigators:{type:Boolean,default:!0},templates:{type:null,default:null},prevButtonProps:{type:null,default:null},nextButtonProps:{type:null,default:null}},startPos:null,thumbnailsStyle:null,sortedResponsiveOptions:null,data(){return{d_numVisible:this.numVisible,d_oldNumVisible:this.numVisible,d_activeIndex:this.activeIndex,d_oldActiveItemIndex:this.activeIndex,totalShiftedItems:0,page:0}},watch:{numVisible(e,t){this.d_numVisible=e,this.d_oldNumVisible=t},activeIndex(e,t){this.d_activeIndex=e,this.d_oldActiveItemIndex=t}},mounted(){this.createStyle(),this.calculatePosition(),this.responsiveOptions&&this.bindDocumentListeners()},updated(){let e=this.totalShiftedItems;this.d_oldNumVisible===this.d_numVisible&&this.d_oldActiveItemIndex===this.d_activeIndex||(e=this.d_activeIndex<=this.getMedianItemIndex()?0:this.value.length-this.d_numVisible+this.getMedianItemIndex()<this.d_activeIndex?this.d_numVisible-this.value.length:this.value.length-this.d_numVisible<this.d_activeIndex&&this.d_numVisible%2==0?-1*this.d_activeIndex+this.getMedianItemIndex()+1:-1*this.d_activeIndex+this.getMedianItemIndex(),e!==this.totalShiftedItems&&(this.totalShiftedItems=e),this.$refs.itemsContainer.style.transform=this.isVertical?`translate3d(0, ${e*(100/this.d_numVisible)}%, 0)`:`translate3d(${e*(100/this.d_numVisible)}%, 0, 0)`,this.d_oldActiveItemIndex!==this.d_activeIndex&&(i.removeClass(this.$refs.itemsContainer,"p-items-hidden"),this.$refs.itemsContainer.style.transition="transform 500ms ease 0s"),this.d_oldActiveItemIndex=this.d_activeIndex,this.d_oldNumVisible=this.d_numVisible)},beforeUnmount(){this.responsiveOptions&&this.unbindDocumentListeners(),this.thumbnailsStyle&&this.thumbnailsStyle.parentNode.removeChild(this.thumbnailsStyle)},methods:{step(e){let t=this.totalShiftedItems+e;e<0&&-1*t+this.d_numVisible>this.value.length-1?t=this.d_numVisible-this.value.length:e>0&&t>0&&(t=0),this.circular&&(e<0&&this.value.length-1===this.d_activeIndex?t=0:e>0&&0===this.d_activeIndex&&(t=this.d_numVisible-this.value.length)),this.$refs.itemsContainer&&(i.removeClass(this.$refs.itemsContainer,"p-items-hidden"),this.$refs.itemsContainer.style.transform=this.isVertical?`translate3d(0, ${t*(100/this.d_numVisible)}%, 0)`:`translate3d(${t*(100/this.d_numVisible)}%, 0, 0)`,this.$refs.itemsContainer.style.transition="transform 500ms ease 0s"),this.totalShiftedItems=t},stopSlideShow(){this.slideShowActive&&this.stopSlideShow&&this.$emit("stop-slideshow")},getMedianItemIndex(){let e=Math.floor(this.d_numVisible/2);return this.d_numVisible%2?e:e-1},navBackward(e){this.stopSlideShow();let t=0!==this.d_activeIndex?this.d_activeIndex-1:0,i=t+this.totalShiftedItems;this.d_numVisible-i-1>this.getMedianItemIndex()&&(-1*this.totalShiftedItems!=0||this.circular)&&this.step(1);let a=this.circular&&0===this.d_activeIndex?this.value.length-1:t;this.$emit("update:activeIndex",a),e.cancelable&&e.preventDefault()},navForward(e){this.stopSlideShow();let t=this.d_activeIndex===this.value.length-1?this.value.length-1:this.d_activeIndex+1;t+this.totalShiftedItems>this.getMedianItemIndex()&&(-1*this.totalShiftedItems<this.getTotalPageNumber()-1||this.circular)&&this.step(-1);let i=this.circular&&this.value.length-1===this.d_activeIndex?0:t;this.$emit("update:activeIndex",i),e.cancelable&&e.preventDefault()},onItemClick(e){this.stopSlideShow();let t=e;if(t!==this.d_activeIndex){const e=t+this.totalShiftedItems;let i=0;t<this.d_activeIndex?(i=this.d_numVisible-e-1-this.getMedianItemIndex(),i>0&&-1*this.totalShiftedItems!=0&&this.step(i)):(i=this.getMedianItemIndex()-e,i<0&&-1*this.totalShiftedItems<this.getTotalPageNumber()-1&&this.step(i)),this.$emit("update:activeIndex",t)}},onThumbnailKeydown(e,t){switch("Enter"!==e.code&&"Space"!==e.code||(this.onItemClick(t),e.preventDefault()),e.code){case"ArrowRight":this.onRightKey();break;case"ArrowLeft":this.onLeftKey();break;case"Home":this.onHomeKey(),e.preventDefault();break;case"End":this.onEndKey(),e.preventDefault();break;case"ArrowUp":case"ArrowDown":e.preventDefault();break;case"Tab":this.onTabKey()}},onRightKey(){const e=i.find(this.$refs.itemsContainer,".p-galleria-thumbnail-item"),t=this.findFocusedIndicatorIndex();this.changedFocusedIndicator(t,t+1===e.length?e.length-1:t+1)},onLeftKey(){const e=this.findFocusedIndicatorIndex();this.changedFocusedIndicator(e,e-1<=0?0:e-1)},onHomeKey(){const e=this.findFocusedIndicatorIndex();this.changedFocusedIndicator(e,0)},onEndKey(){const e=i.find(this.$refs.itemsContainer,".p-galleria-thumbnail-item"),t=this.findFocusedIndicatorIndex();this.changedFocusedIndicator(t,e.length-1)},onTabKey(){const e=[...i.find(this.$refs.itemsContainer,".p-galleria-thumbnail-item")],t=e.findIndex((e=>i.hasClass(e,"p-galleria-thumbnail-item-current"))),a=i.findSingle(this.$refs.itemsContainer,'.p-galleria-thumbnail-item > [tabindex="0"'),n=e.findIndex((e=>e===a.parentElement));e[n].children[0].tabIndex="-1",e[t].children[0].tabIndex="0"},findFocusedIndicatorIndex(){const e=[...i.find(this.$refs.itemsContainer,".p-galleria-thumbnail-item")],t=i.findSingle(this.$refs.itemsContainer,'.p-galleria-thumbnail-item > [tabindex="0"]');return e.findIndex((e=>e===t.parentElement))},changedFocusedIndicator(e,t){const a=i.find(this.$refs.itemsContainer,".p-galleria-thumbnail-item");a[e].children[0].tabIndex="-1",a[t].children[0].tabIndex="0",a[t].children[0].focus()},onTransitionEnd(){this.$refs.itemsContainer&&(i.addClass(this.$refs.itemsContainer,"p-items-hidden"),this.$refs.itemsContainer.style.transition="")},onTouchStart(e){let t=e.changedTouches[0];this.startPos={x:t.pageX,y:t.pageY}},onTouchMove(e){e.cancelable&&e.preventDefault()},onTouchEnd(e){let t=e.changedTouches[0];this.isVertical?this.changePageOnTouch(e,t.pageY-this.startPos.y):this.changePageOnTouch(e,t.pageX-this.startPos.x)},changePageOnTouch(e,t){t<0?this.navForward(e):this.navBackward(e)},getTotalPageNumber(){return this.value.length>this.d_numVisible?this.value.length-this.d_numVisible+1:0},createStyle(){this.thumbnailsStyle||(this.thumbnailsStyle=document.createElement("style"),this.thumbnailsStyle.type="text/css",document.body.appendChild(this.thumbnailsStyle));let e=`\n #${this.containerId} .p-galleria-thumbnail-item {\n flex: 1 0 ${100/this.d_numVisible}%\n }\n `;if(this.responsiveOptions){this.sortedResponsiveOptions=[...this.responsiveOptions],this.sortedResponsiveOptions.sort(((e,t)=>{const i=e.breakpoint,a=t.breakpoint;let n=null;return n=null==i&&null!=a?-1:null!=i&&null==a?1:null==i&&null==a?0:"string"==typeof i&&"string"==typeof a?i.localeCompare(a,void 0,{numeric:!0}):i<a?-1:i>a?1:0,-1*n}));for(let t=0;t<this.sortedResponsiveOptions.length;t++){let i=this.sortedResponsiveOptions[t];e+=`\n @media screen and (max-width: ${i.breakpoint}) {\n #${this.containerId} .p-galleria-thumbnail-item {\n flex: 1 0 ${100/i.numVisible}%\n }\n }\n `}}this.thumbnailsStyle.innerHTML=e},calculatePosition(){if(this.$refs.itemsContainer&&this.sortedResponsiveOptions){let e=window.innerWidth,t={numVisible:this.numVisible};for(let i=0;i<this.sortedResponsiveOptions.length;i++){let a=this.sortedResponsiveOptions[i];parseInt(a.breakpoint,10)>=e&&(t=a)}this.d_numVisible!==t.numVisible&&(this.d_numVisible=t.numVisible)}},bindDocumentListeners(){this.documentResizeListener||(this.documentResizeListener=()=>{this.calculatePosition()},window.addEventListener("resize",this.documentResizeListener))},unbindDocumentListeners(){this.documentResizeListener&&(window.removeEventListener("resize",this.documentResizeListener),this.documentResizeListener=null)},isNavBackwardDisabled(){return!this.circular&&0===this.d_activeIndex||this.value.length<=this.d_numVisible},isNavForwardDisabled(){return!this.circular&&this.d_activeIndex===this.value.length-1||this.value.length<=this.d_numVisible},firstItemAciveIndex(){return-1*this.totalShiftedItems},lastItemActiveIndex(){return this.firstItemAciveIndex()+this.d_numVisible-1},isItemActive(e){return this.firstItemAciveIndex()<=e&&this.lastItemActiveIndex()>=e},ariaPageLabel(e){return this.$primevue.config.locale.aria?this.$primevue.config.locale.aria.pageLabel.replace(/{page}/g,e):void 0}},computed:{navBackwardClass(){return["p-galleria-thumbnail-prev p-link",{"p-disabled":this.isNavBackwardDisabled()}]},navForwardClass(){return["p-galleria-thumbnail-next p-link",{"p-disabled":this.isNavForwardDisabled()}]},navBackwardIconClass(){return["p-galleria-thumbnail-prev-icon pi",{"pi-chevron-left":!this.isVertical,"pi-chevron-up":this.isVertical}]},navForwardIconClass(){return["p-galleria-thumbnail-next-icon pi",{"pi-chevron-right":!this.isVertical,"pi-chevron-down":this.isVertical}]},ariaPrevButtonLabel(){return this.$primevue.config.locale.aria?this.$primevue.config.locale.aria.prevPageLabel:void 0},ariaNextButtonLabel(){return this.$primevue.config.locale.aria?this.$primevue.config.locale.aria.nextPageLabel:void 0}},directives:{ripple:l}};const O={class:"p-galleria-thumbnail-wrapper"},F={class:"p-galleria-thumbnail-container"},E=["disabled","aria-label"],H=["aria-selected","aria-controls","onKeydown"],R=["tabindex","aria-label","aria-current","onClick"],K=["disabled","aria-label"];D.render=function(e,t,i,a,n,l){const I=s("ripple");return r(),o("div",O,[d("div",F,[i.showThumbnailNavigators?c((r(),o("button",b({key:0,class:l.navBackwardClass,disabled:l.isNavBackwardDisabled(),type:"button","aria-label":l.ariaPrevButtonLabel,onClick:t[0]||(t[0]=e=>l.navBackward(e))},i.prevButtonProps),[d("span",{class:h(l.navBackwardIconClass)},null,2)],16,E)),[[I]]):p("",!0),d("div",{class:"p-galleria-thumbnail-items-container",style:f({height:i.isVertical?i.contentHeight:""})},[d("div",{ref:"itemsContainer",class:"p-galleria-thumbnail-items",role:"tablist",onTransitionend:t[1]||(t[1]=(...e)=>l.onTransitionEnd&&l.onTransitionEnd(...e)),onTouchstart:t[2]||(t[2]=e=>l.onTouchStart(e)),onTouchmove:t[3]||(t[3]=e=>l.onTouchMove(e)),onTouchend:t[4]||(t[4]=e=>l.onTouchEnd(e))},[(r(!0),o(v,null,g(i.value,((e,t)=>(r(),o("div",{key:`p-galleria-thumbnail-item-${t}`,class:h(["p-galleria-thumbnail-item",{"p-galleria-thumbnail-item-current":i.activeIndex===t,"p-galleria-thumbnail-item-active":l.isItemActive(t),"p-galleria-thumbnail-item-start":l.firstItemAciveIndex()===t,"p-galleria-thumbnail-item-end":l.lastItemActiveIndex()===t}]),role:"tab","aria-selected":i.activeIndex===t,"aria-controls":i.containerId+"_item_"+t,onKeydown:e=>l.onThumbnailKeydown(e,t)},[d("div",{class:"p-galleria-thumbnail-item-content",tabindex:i.activeIndex===t?"0":"-1","aria-label":l.ariaPageLabel(t+1),"aria-current":i.activeIndex===t?"page":void 0,onClick:e=>l.onItemClick(t)},[i.templates.thumbnail?(r(),u(m(i.templates.thumbnail),{key:0,item:e},null,8,["item"])):p("",!0)],8,R)],42,H)))),128))],544)],4),i.showThumbnailNavigators?c((r(),o("button",b({key:1,class:l.navForwardClass,disabled:l.isNavForwardDisabled(),type:"button","aria-label":l.ariaNextButtonLabel,onClick:t[5]||(t[5]=e=>l.navForward(e))},i.nextButtonProps),[d("span",{class:h(l.navForwardIconClass)},null,2)],16,K)),[[I]]):p("",!0)])])};var M={name:"GalleriaContent",inheritAttrs:!1,interval:null,emits:["activeitem-change","mask-hide"],data(){return{id:this.$attrs.id||a(),activeIndex:this.$attrs.activeIndex,numVisible:this.$attrs.numVisible,slideShowActive:!1}},watch:{"$attrs.value":function(e){e&&e.length<this.numVisible&&(this.numVisible=e.length)},"$attrs.activeIndex":function(e){this.activeIndex=e},"$attrs.numVisible":function(e){this.numVisible=e}},updated(){this.$emit("activeitem-change",this.activeIndex)},beforeUnmount(){this.slideShowActive&&this.stopSlideShow()},methods:{isAutoPlayActive(){return this.slideShowActive},startSlideShow(){this.interval=setInterval((()=>{let e=this.$attrs.circular&&this.$attrs.value.length-1===this.activeIndex?0:this.activeIndex+1;this.activeIndex=e}),this.$attrs.transitionInterval),this.slideShowActive=!0},stopSlideShow(){this.interval&&clearInterval(this.interval),this.slideShowActive=!1},getPositionClass(e,t){const i=["top","left","bottom","right"].find((e=>e===t));return i?`${e}-${i}`:""},isVertical(){return"left"===this.$attrs.thumbnailsPosition||"right"===this.$attrs.thumbnailsPosition}},computed:{galleriaClass(){const e=this.$attrs.showThumbnails&&this.getPositionClass("p-galleria-thumbnails",this.$attrs.thumbnailsPosition),t=this.$attrs.showIndicators&&this.getPositionClass("p-galleria-indicators",this.$attrs.indicatorsPosition);return["p-galleria p-component",{"p-galleria-fullscreen":this.$attrs.fullScreen,"p-galleria-indicator-onitem":this.$attrs.showIndicatorsOnItem,"p-galleria-item-nav-onhover":this.$attrs.showItemNavigatorsOnHover&&!this.$attrs.fullScreen},e,t,this.$attrs.containerClass]},closeAriaLabel(){return this.$primevue.config.locale.aria?this.$primevue.config.locale.aria.close:void 0}},components:{GalleriaItem:S,GalleriaThumbnails:D},directives:{ripple:l}};const z=["id"],G=["aria-label"],U=[d("span",{class:"p-galleria-close-icon pi pi-times"},null,-1)],j={key:1,class:"p-galleria-header"},X=["aria-live"],Y={key:2,class:"p-galleria-footer"};M.render=function(e,t,i,a,n,l){const h=I("GalleriaItem"),v=I("GalleriaThumbnails"),g=s("ripple");return e.$attrs.value&&e.$attrs.value.length>0?(r(),o("div",b({key:0,id:n.id,class:l.galleriaClass,style:e.$attrs.containerStyle},e.$attrs.containerProps),[e.$attrs.fullScreen?c((r(),o("button",{key:0,autofocus:"",type:"button",class:"p-galleria-close p-link","aria-label":l.closeAriaLabel,onClick:t[0]||(t[0]=t=>e.$emit("mask-hide"))},U,8,G)),[[g]]):p("",!0),e.$attrs.templates&&e.$attrs.templates.header?(r(),o("div",j,[(r(),u(m(e.$attrs.templates.header)))])):p("",!0),d("div",{class:"p-galleria-content","aria-live":e.$attrs.autoPlay?"polite":"off"},[y(h,{id:n.id,activeIndex:n.activeIndex,"onUpdate:activeIndex":t[1]||(t[1]=e=>n.activeIndex=e),slideShowActive:n.slideShowActive,"onUpdate:slideShowActive":t[2]||(t[2]=e=>n.slideShowActive=e),value:e.$attrs.value,circular:e.$attrs.circular,templates:e.$attrs.templates,showIndicators:e.$attrs.showIndicators,changeItemOnIndicatorHover:e.$attrs.changeItemOnIndicatorHover,showItemNavigators:e.$attrs.showItemNavigators,autoPlay:e.$attrs.autoPlay,onStartSlideshow:l.startSlideShow,onStopSlideshow:l.stopSlideShow},null,8,["id","activeIndex","slideShowActive","value","circular","templates","showIndicators","changeItemOnIndicatorHover","showItemNavigators","autoPlay","onStartSlideshow","onStopSlideshow"]),e.$attrs.showThumbnails?(r(),u(v,{key:0,activeIndex:n.activeIndex,"onUpdate:activeIndex":t[3]||(t[3]=e=>n.activeIndex=e),slideShowActive:n.slideShowActive,"onUpdate:slideShowActive":t[4]||(t[4]=e=>n.slideShowActive=e),containerId:n.id,value:e.$attrs.value,templates:e.$attrs.templates,numVisible:n.numVisible,responsiveOptions:e.$attrs.responsiveOptions,circular:e.$attrs.circular,isVertical:l.isVertical(),contentHeight:e.$attrs.verticalThumbnailViewPortHeight,showThumbnailNavigators:e.$attrs.showThumbnailNavigators,prevButtonProps:e.$attrs.prevButtonProps,nextButtonProps:e.$attrs.nextButtonProps,onStopSlideshow:l.stopSlideShow},null,8,["activeIndex","slideShowActive","containerId","value","templates","numVisible","responsiveOptions","circular","isVertical","contentHeight","showThumbnailNavigators","prevButtonProps","nextButtonProps","onStopSlideshow"])):p("",!0)],8,X),e.$attrs.templates&&e.$attrs.templates.footer?(r(),o("div",Y,[(r(),u(m(e.$attrs.templates.footer)))])):p("",!0)],16,z)):p("",!0)};var Z={name:"Galleria",inheritAttrs:!1,emits:["update:activeIndex","update:visible"],props:{id:{type:String,default:null},value:{type:Array,default:null},activeIndex:{type:Number,default:0},fullScreen:{type:Boolean,default:!1},visible:{type:Boolean,default:!1},numVisible:{type:Number,default:3},responsiveOptions:{type:Array,default:null},showItemNavigators:{type:Boolean,default:!1},showThumbnailNavigators:{type:Boolean,default:!0},showItemNavigatorsOnHover:{type:Boolean,default:!1},changeItemOnIndicatorHover:{type:Boolean,default:!1},circular:{type:Boolean,default:!1},autoPlay:{type:Boolean,default:!1},transitionInterval:{type:Number,default:4e3},showThumbnails:{type:Boolean,default:!0},thumbnailsPosition:{type:String,default:"bottom"},verticalThumbnailViewPortHeight:{type:String,default:"300px"},showIndicators:{type:Boolean,default:!1},showIndicatorsOnItem:{type:Boolean,default:!1},indicatorsPosition:{type:String,default:"bottom"},baseZIndex:{type:Number,default:0},maskClass:{type:String,default:null},containerStyle:{type:null,default:null},containerClass:{type:null,default:null},containerProps:{type:null,default:null},prevButtonProps:{type:null,default:null},nextButtonProps:{type:null,default:null}},container:null,mask:null,data(){return{containerVisible:this.visible}},updated(){this.fullScreen&&this.visible&&(this.containerVisible=this.visible)},beforeUnmount(){this.fullScreen&&i.removeClass(document.body,"p-overflow-hidden"),this.mask=null,this.container&&(n.clear(this.container),this.container=null)},methods:{onBeforeEnter(e){n.set("modal",e,this.baseZIndex||this.$primevue.config.zIndex.modal)},onEnter(e){this.mask.style.zIndex=String(parseInt(e.style.zIndex,10)-1),i.addClass(document.body,"p-overflow-hidden"),this.focus()},onBeforeLeave(){i.addClass(this.mask,"p-component-overlay-leave")},onAfterLeave(e){n.clear(e),this.containerVisible=!1,i.removeClass(document.body,"p-overflow-hidden")},onActiveItemChange(e){this.activeIndex!==e&&this.$emit("update:activeIndex",e)},maskHide(){this.$emit("update:visible",!1)},containerRef(e){this.container=e},maskRef(e){this.mask=e},focus(){let e=this.container.$el.querySelector("[autofocus]");e&&e.focus()}},computed:{maskContentClass(){return["p-galleria-mask p-component-overlay p-component-overlay-enter",this.maskClass,{"p-input-filled":"filled"===this.$primevue.config.inputStyle,"p-ripple-disabled":!1===this.$primevue.config.ripple}]}},components:{GalleriaContent:M,Portal:t},directives:{focustrap:e}};const q=["role","aria-modal"];!function(e,t){void 0===t&&(t={});var i=t.insertAt;if(e&&"undefined"!=typeof document){var a=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css","top"===i&&a.firstChild?a.insertBefore(n,a.firstChild):a.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}}("\n.p-galleria-content {\n display: flex;\n flex-direction: column;\n}\n.p-galleria-item-wrapper {\n display: flex;\n flex-direction: column;\n position: relative;\n}\n.p-galleria-item-container {\n position: relative;\n display: flex;\n height: 100%;\n}\n.p-galleria-item-nav {\n position: absolute;\n top: 50%;\n margin-top: -0.5rem;\n display: inline-flex;\n justify-content: center;\n align-items: center;\n overflow: hidden;\n}\n.p-galleria-item-prev {\n left: 0;\n border-top-left-radius: 0;\n border-bottom-left-radius: 0;\n}\n.p-galleria-item-next {\n right: 0;\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n}\n.p-galleria-item {\n display: flex;\n justify-content: center;\n align-items: center;\n height: 100%;\n width: 100%;\n}\n.p-galleria-item-nav-onhover .p-galleria-item-nav {\n pointer-events: none;\n opacity: 0;\n transition: opacity 0.2s ease-in-out;\n}\n.p-galleria-item-nav-onhover .p-galleria-item-wrapper:hover .p-galleria-item-nav {\n pointer-events: all;\n opacity: 1;\n}\n.p-galleria-item-nav-onhover .p-galleria-item-wrapper:hover .p-galleria-item-nav.p-disabled {\n pointer-events: none;\n}\n.p-galleria-caption {\n position: absolute;\n bottom: 0;\n left: 0;\n width: 100%;\n}\n\n/* Thumbnails */\n.p-galleria-thumbnail-wrapper {\n display: flex;\n flex-direction: column;\n overflow: auto;\n flex-shrink: 0;\n}\n.p-galleria-thumbnail-prev,\n.p-galleria-thumbnail-next {\n align-self: center;\n flex: 0 0 auto;\n display: flex;\n justify-content: center;\n align-items: center;\n overflow: hidden;\n position: relative;\n}\n.p-galleria-thumbnail-prev span,\n.p-galleria-thumbnail-next span {\n display: flex;\n justify-content: center;\n align-items: center;\n}\n.p-galleria-thumbnail-container {\n display: flex;\n flex-direction: row;\n}\n.p-galleria-thumbnail-items-container {\n overflow: hidden;\n width: 100%;\n}\n.p-galleria-thumbnail-items {\n display: flex;\n}\n.p-galleria-thumbnail-item {\n overflow: auto;\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n opacity: 0.5;\n}\n.p-galleria-thumbnail-item:hover {\n opacity: 1;\n transition: opacity 0.3s;\n}\n.p-galleria-thumbnail-item-current {\n opacity: 1;\n}\n\n/* Positions */\n/* Thumbnails */\n.p-galleria-thumbnails-left .p-galleria-content,\n.p-galleria-thumbnails-right .p-galleria-content {\n flex-direction: row;\n}\n.p-galleria-thumbnails-left .p-galleria-item-wrapper,\n.p-galleria-thumbnails-right .p-galleria-item-wrapper {\n flex-direction: row;\n}\n.p-galleria-thumbnails-left .p-galleria-item-wrapper,\n.p-galleria-thumbnails-top .p-galleria-item-wrapper {\n order: 2;\n}\n.p-galleria-thumbnails-left .p-galleria-thumbnail-wrapper,\n.p-galleria-thumbnails-top .p-galleria-thumbnail-wrapper {\n order: 1;\n}\n.p-galleria-thumbnails-left .p-galleria-thumbnail-container,\n.p-galleria-thumbnails-right .p-galleria-thumbnail-container {\n flex-direction: column;\n flex-grow: 1;\n}\n.p-galleria-thumbnails-left .p-galleria-thumbnail-items,\n.p-galleria-thumbnails-right .p-galleria-thumbnail-items {\n flex-direction: column;\n height: 100%;\n}\n\n/* Indicators */\n.p-galleria-indicators {\n display: flex;\n align-items: center;\n justify-content: center;\n}\n.p-galleria-indicator > button {\n display: inline-flex;\n align-items: center;\n}\n.p-galleria-indicators-left .p-galleria-item-wrapper,\n.p-galleria-indicators-right .p-galleria-item-wrapper {\n flex-direction: row;\n align-items: center;\n}\n.p-galleria-indicators-left .p-galleria-item-container,\n.p-galleria-indicators-top .p-galleria-item-container {\n order: 2;\n}\n.p-galleria-indicators-left .p-galleria-indicators,\n.p-galleria-indicators-top .p-galleria-indicators {\n order: 1;\n}\n.p-galleria-indicators-left .p-galleria-indicators,\n.p-galleria-indicators-right .p-galleria-indicators {\n flex-direction: column;\n}\n.p-galleria-indicator-onitem .p-galleria-indicators {\n position: absolute;\n display: flex;\n}\n.p-galleria-indicator-onitem.p-galleria-indicators-top .p-galleria-indicators {\n top: 0;\n left: 0;\n width: 100%;\n align-items: flex-start;\n}\n.p-galleria-indicator-onitem.p-galleria-indicators-right .p-galleria-indicators {\n right: 0;\n top: 0;\n height: 100%;\n align-items: flex-end;\n}\n.p-galleria-indicator-onitem.p-galleria-indicators-bottom .p-galleria-indicators {\n bottom: 0;\n left: 0;\n width: 100%;\n align-items: flex-end;\n}\n.p-galleria-indicator-onitem.p-galleria-indicators-left .p-galleria-indicators {\n left: 0;\n top: 0;\n height: 100%;\n align-items: flex-start;\n}\n\n/* FullScreen */\n.p-galleria-mask {\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n.p-galleria-close {\n position: absolute;\n top: 0;\n right: 0;\n display: flex;\n justify-content: center;\n align-items: center;\n overflow: hidden;\n}\n.p-galleria-mask .p-galleria-item-nav {\n position: fixed;\n top: 50%;\n margin-top: -0.5rem;\n}\n\n/* Animation */\n.p-galleria-enter-active {\n transition: all 150ms cubic-bezier(0, 0, 0.2, 1);\n}\n.p-galleria-leave-active {\n transition: all 150ms cubic-bezier(0.4, 0, 0.2, 1);\n}\n.p-galleria-enter-from,\n.p-galleria-leave-to {\n opacity: 0;\n transform: scale(0.7);\n}\n.p-galleria-enter-active .p-galleria-item-nav {\n opacity: 0;\n}\n\n/* Keyboard Support */\n.p-items-hidden .p-galleria-thumbnail-item {\n visibility: hidden;\n}\n.p-items-hidden .p-galleria-thumbnail-item.p-galleria-thumbnail-item-active {\n visibility: visible;\n}\n"),Z.render=function(e,t,i,a,n,l){const d=I("GalleriaContent"),m=I("Portal"),v=s("focustrap");return i.fullScreen?(r(),u(m,{key:0},{default:x((()=>[n.containerVisible?(r(),o("div",{key:0,ref:l.maskRef,class:h(l.maskContentClass),role:i.fullScreen?"dialog":"region","aria-modal":i.fullScreen?"true":void 0},[y(w,{name:"p-galleria",onBeforeEnter:l.onBeforeEnter,onEnter:l.onEnter,onBeforeLeave:l.onBeforeLeave,onAfterLeave:l.onAfterLeave,appear:""},{default:x((()=>[i.visible?c((r(),u(d,b({key:0,ref:l.containerRef},e.$props,{onMaskHide:l.maskHide,templates:e.$slots,onActiveitemChange:l.onActiveItemChange}),null,16,["onMaskHide","templates","onActiveitemChange"])),[[v]]):p("",!0)])),_:1},8,["onBeforeEnter","onEnter","onBeforeLeave","onAfterLeave"])],10,q)):p("",!0)])),_:1})):(r(),u(d,b({key:1},e.$props,{templates:e.$slots,onActiveitemChange:l.onActiveItemChange}),null,16,["templates","onActiveitemChange"]))};export{Z as default};