@cntrl-site/components 1.0.116 → 1.0.117
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.
- package/dist/{ChroniclesComponent-D4_6w8f7.js → ChroniclesComponent-CoOgQZx2.js} +1 -1
- package/dist/{ChroniclesComponent-0ZWBPdbh.mjs → ChroniclesComponent-Szt0H-op.mjs} +3 -3
- package/dist/{Grid-OvzWvUW9.js → Grid-C4hO8KCr.js} +14 -9
- package/dist/{Grid-t07NDMzY.mjs → Grid-Dud7PLS9.mjs} +201 -196
- package/dist/{LightboxJournal-gePVKQJ4.mjs → LightboxJournal-BDUs6T0B.mjs} +340 -334
- package/dist/{LightboxJournal-Bmw2zm4t.js → LightboxJournal-Bf_rZzmz.js} +14 -8
- package/dist/{LightboxStrip-BPQiQhd3.mjs → LightboxStrip-Cuhb2fIR.mjs} +258 -252
- package/dist/{LightboxStrip-CTxRwLYk.js → LightboxStrip-RA4ABUC-.js} +14 -8
- package/dist/{components-BQjon_-7.mjs → components-DSHc15vW.mjs} +1 -1
- package/dist/{components-B8MjlzLL.js → components-iORMB3kt.js} +1 -1
- package/dist/elements.js +1 -1
- package/dist/elements.mjs +3 -3
- package/dist/elements.node.js +1 -1
- package/dist/elements.node.mjs +1 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +2 -2
- package/dist/sources.js +30 -16
- package/dist/sources.mjs +30 -16
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),o=require("react"),Lt=require("react-dom"),fi=require("./useScopedStyles-Bf6yohVQ.js"),G=require("./useLightboxSwipeDismiss-Br9uE5G0.js"),ct=require("./scalingValue-CSHYgTZl.js"),mi=require("./SvgImage-DFlmxAoL.js"),gi=require("./useLightboxScrollLock-Hf16Eq4g.js"),l=require("./utils-033j3qNL.js"),xi=({prefix:e,entries:E,settings:I,isEditor:w,isEditMode:f,isPreviewMode:ee,initialSlideIndex:U=0,enableUrlSync:j=!1,journalItemId:k=null,onBeforeClose:V,onClose:q})=>{const{type:C,coverFit:te,backgroundColor:Ae,imageGap:Ee,maxWidth:Je,maxHeight:H,textTransition:J,title1Width:ie,title2Width:re,title3Width:X,title1MarginLeft:R=0,title2MarginLeft:L=0,title3MarginLeft:pe=0,titleRowMarginBottom:$=0,titleHeaderLayout:Fe="single-row",countCloseGap:ze=0,closeIcon:ve,closeIconMaxWidth:b,closeIconColor:_,closeIconHoverColor:F,contentMarginTop:we=0,iconMarginRight:_t=0}=I,m=o.useCallback(t=>ct.scalingValue(t,w??!1),[w]),Oe=m(Ee??0),Mt=`${Je}%`,Dt=`${H}%`,ye=m(ze),At=m(we),dt=m(_t),ne=l.journalTextFieldsToCss("title1",l.resolveJournalTextFields(I,"title1"),w),ae=l.journalTextFieldsToCss("title2",l.resolveJournalTextFields(I,"title2"),w),ce=l.journalTextFieldsToCss("title3",l.resolveJournalTextFields(I,"title3"),w),Et=l.journalTextFieldsToCss("count",l.resolveJournalTextFields(I,"count"),w),p=Fe==="mobile",z=!w||!!ee,Jt=!f&&(!w||!!ee),u=o.useMemo(()=>l.buildJournalSlides(E,C),[E,C]),[y,Be]=o.useState(U),de=u[y],h=de==null?void 0:de.entry,[ut,ht]=o.useState(!1),[ft,ue]=o.useState(null),[T,he]=o.useState(!1),[mt,Ke]=o.useState(null),[gt,Ge]=o.useState(!1),[Ue,xt]=o.useState(0),[oe,fe]=o.useState(),[be,me]=o.useState(),[$e,Te]=o.useState(null),Z=o.useRef(null),Se=o.useRef(0),Ie=o.useRef(0),pt=o.useRef(0),vt=o.useRef(!1),Ve=o.useRef(null),qe=o.useRef(null),O=o.useRef(null),B=o.useRef(null),Xe=o.useRef(null),wt=o.useRef(null),je=o.useRef(null),yt=o.useCallback(()=>{const t=qe.current;if(!t)return;const n=t.closest(`.${e}-lightbox-content-area`);if(!n)return t.getBoundingClientRect().width;const a=Array.from(n.children).reduce((s,r)=>!(r instanceof HTMLElement)||r.contains(t)?s:s+r.getBoundingClientRect().width,0);return n.getBoundingClientRect().width-a},[e]),Y=o.useCallback(()=>{Z.current&&(clearTimeout(Z.current),Z.current=null)},[]),Ft=o.useCallback(t=>{t===Se.current&&(Ke(null),Ge(!1))},[]),ge=o.useCallback(()=>{f||vt.current||(vt.current=!0,V==null||V(),ht(!1),Ve.current=setTimeout(()=>{q()},300))},[f,V,q]),zt=o.useCallback(t=>!!(t.closest("[data-controls]")||t.closest(`.${e}-close-icon`)),[e]),{isSwipeDragging:Ze,backdropStyle:Ot,mediaAreaStyle:Bt,overlayContentStyle:Kt,swipeHandlers:Gt,dismissAreaStyle:Ut}=G.useLightboxSwipeDismiss({enabled:Jt,onClose:ge,animMs:300,isBlockedTarget:zt}),bt=o.useCallback(t=>{j&&l.setJournalUrlParam(t+1,k,!0)},[j,k]),Ye=o.useCallback(t=>{if(t)return t.getBoundingClientRect().height},[]),le=o.useCallback(t=>{if(u.length===0)return;const n=(t%u.length+u.length)%u.length;if(n===y)return;const a=u[y],s=u[n];Se.current+=1;const r=Se.current,d=J==="fade"&&l.getEntryTitleKey(a==null?void 0:a.entry)!==l.getEntryTitleKey(s==null?void 0:s.entry),x=Ye(O.current),c=d?(()=>{const N=yt();Lt.flushSync(()=>{Te(s.entry)}),O.current&&N&&(O.current.style.width=`${N}px`);const _e=Ye(O.current);return O.current&&(O.current.style.width=""),{measuredIncomingTitlesHeight:_e,incomingTitlesMeasureWidth:N}})():void 0,S=Math.max(x??0,(c==null?void 0:c.measuredIncomingTitlesHeight)??0)||void 0;xt(r),Ke(y),Ge(!0),Be(n),bt(n),pt.current=n,d?(Y(),S&&fe(S),c!=null&&c.incomingTitlesMeasureWidth&&me(c.incomingTitlesMeasureWidth),ue((a==null?void 0:a.entryIndex)??null),he(!0),Ie.current=s.entryIndex,Z.current=setTimeout(()=>{ue(null),he(!1),fe(void 0),me(void 0),Te(null),Z.current=null},400)):(Y(),ue(null),he(!1),fe(void 0),me(void 0),Te(null),Ie.current=s.entryIndex)},[y,Y,yt,Ye,u,bt,J]),xe=o.useCallback(()=>{je.current=null},[]),Vt=o.useCallback(t=>{!z||u.length<=1||t.pointerType==="mouse"&&t.button!==0||t.target.closest("[data-controls]")||(je.current={startX:t.clientX,startY:t.clientY,pointerId:t.pointerId})},[z,u.length]),qt=o.useCallback(t=>{var N;if(!z||u.length<=1||t.pointerType==="mouse"&&t.button!==0)return;if(Ze){xe();return}const n=je.current;if(!n||n.pointerId!==t.pointerId||(xe(),t.target.closest("[data-controls]")))return;const s=t.clientX-n.startX,r=t.clientY-n.startY,d=Math.abs(s),x=Math.abs(r);if(d>=l.STRIP_NAV_SWIPE_MIN_PX&&d>x){le(s>0?y-1:y+1);return}if(d>l.STRIP_NAV_TAP_MAX_PX||x>l.STRIP_NAV_TAP_MAX_PX)return;const c=(N=B.current)==null?void 0:N.getBoundingClientRect(),S=c?c.left+c.width/2:window.innerWidth/2;le(t.clientX<S?y-1:y+1)},[y,z,le,Ze,xe,u.length]),Xt=o.useCallback(t=>{const n=je.current;(n==null?void 0:n.pointerId)===t.pointerId&&xe()},[xe]);gi.useLightboxScrollLock(),o.useEffect(()=>{wt.current=document.activeElement instanceof HTMLElement?document.activeElement:null;const t=requestAnimationFrame(()=>{ht(!0),requestAnimationFrame(()=>{Xe.current?Xe.current.focus():B.current&&B.current.focus()})});return()=>{cancelAnimationFrame(t),Ve.current&&clearTimeout(Ve.current),Z.current&&clearTimeout(Z.current);const n=wt.current;n&&document.contains(n)&&n.focus({preventScroll:!0})}},[]),o.useEffect(()=>{var t;J!=="fade"&&(Ie.current=((t=u[y])==null?void 0:t.entryIndex)??0,Y(),ue(null),he(!1),fe(void 0),me(void 0))},[y,Y,u,J]),o.useEffect(()=>{const t=n=>{if(n.key==="Escape"){ge();return}if(n.key==="ArrowLeft"&&u.length>1){le(y-1);return}if(n.key==="ArrowRight"&&u.length>1){le(y+1);return}if(n.key==="Tab"&&B.current){const a=B.current.querySelectorAll('button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])'),s=Array.from(a).filter(c=>!c.closest('[aria-hidden="true"]'));if(s.length===0)return;const r=s[0],d=s[s.length-1],x=document.activeElement;n.shiftKey?(x===r||!B.current.contains(x))&&(n.preventDefault(),d.focus()):(x===d||!B.current.contains(x))&&(n.preventDefault(),r.focus())}};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[le,ge,y,u.length]),o.useLayoutEffect(()=>{Y(),Se.current=0,xt(0),Ke(null),Ge(!1),ue(null),he(!1),fe(void 0),me(void 0),Te(null),Be(t=>{const n=Math.max(0,u.length-1);return Math.min(t,n)})},[Y,E.length,C,u.length]),o.useLayoutEffect(()=>{var a;const t=Math.max(0,u.length-1),n=Math.min(Math.max(0,U),t);pt.current=n,Ie.current=((a=u[n])==null?void 0:a.entryIndex)??0,Be(n)},[U]);const g=ft!==null?E[ft]:null,$t=mt!==null?u[mt]:null,Re=(h==null?void 0:h.title1)||(h==null?void 0:h.title2)||(h==null?void 0:h.title3)||(g==null?void 0:g.title1)||(g==null?void 0:g.title2)||(g==null?void 0:g.title3),Q=l.shouldShowCounter(C,u,E),se=ve!==null,Zt=Re||Q||se,Yt=Q&&se?{gap:ye}:void 0,We=`${e}-titles-stack${p?` ${e}-titles-stack-stacked`:""}`,Tt=`${e}-titles-layer-out${p?` ${e}-titles-layer-out-stacked`:""}`,Qt=`${e}-titles-layer-out`,Qe=(R??0)>0||f,Pt=m($),W=o.useMemo(()=>({title1Width:ie??l.DEFAULT_JOURNAL_TITLE_WIDTHS.title1Width,title2Width:re??l.DEFAULT_JOURNAL_TITLE_WIDTHS.title2Width,title3Width:X??l.DEFAULT_JOURNAL_TITLE_WIDTHS.title3Width}),[ie,re,X]),M=o.useMemo(()=>({title2MarginLeft:L,title3MarginLeft:pe}),[L,pe]),v=o.useMemo(()=>h?l.buildJournalTitleSlots(e,h,ne,ae,ce):[],[e,h,ne,ae,ce]),Ne=o.useMemo(()=>v.map(t=>W[t.widthKey]),[v,W]),D=o.useMemo(()=>l.resolveJournalTitleWidths(v.length,Ne),[v.length,Ne]),St=o.useMemo(()=>l.getEffectiveJournalTitleWidths(v.length,Ne),[v.length,Ne]),ke=o.useMemo(()=>v.filter(t=>t.prefix==="title1"),[v]),A=o.useMemo(()=>v.filter(t=>t.prefix==="title2"||t.prefix==="title3"),[v]),Ce=o.useMemo(()=>l.getRowScopedJournalTitleWidths(ke,W),[ke,W]),K=o.useMemo(()=>l.getRowScopedJournalTitleWidths(A,W),[A,W]),Pe=o.useCallback((t,n)=>{const a=v.findIndex(r=>r.prefix===t.prefix);if(!p||n==="single-row")return{effectiveWidth:St[a]??0,resolvedWidth:D[a]??0,maxWidth:l.getJournalTitleMaxWidth(a,D)};if(n==="two-row-top"){const r=ke.findIndex(d=>d.prefix===t.prefix);return{effectiveWidth:Ce.effective[r]??0,resolvedWidth:Ce.resolved[r]??0,maxWidth:l.getJournalTitleMaxWidth(r,Ce.resolved)}}const s=A.findIndex(r=>r.prefix===t.prefix);return{effectiveWidth:K.effective[s]??0,resolvedWidth:K.resolved[s]??0,maxWidth:l.getJournalTitleMaxWidth(s,K.resolved)}},[v,A,K,St,D,ke,Ce,p]),ei=o.useCallback(t=>l.getJournalTitleBoundaryOffset(v,D,M,t)+(p?0:R??0),[v,D,M,p,R]),ti=o.useCallback(()=>p?0:R??0,[p,R]),et=o.useCallback(t=>A.slice(0,t).reduce((n,a,s)=>n+(a.marginLeftKey?M[a.marginLeftKey]??0:0)+(K.resolved[s]??0),0),[A,K.resolved,M]),ii=o.useCallback(t=>{const n=A[t];return et(t)+(n.marginLeftKey?M[n.marginLeftKey]??0:0)+(K.resolved[t]??0)},[A,K.resolved,et,M]),tt=o.useCallback((t,n,a)=>{if(!p||a==="single-row"){const c=t.findIndex(P=>P.prefix===n.prefix),S=t.map(P=>W[P.widthKey]),N=l.resolveJournalTitleWidths(t.length,S);return{effectiveWidth:l.getEffectiveJournalTitleWidths(t.length,S)[c]??0,resolvedWidth:N[c]??0,maxWidth:l.getJournalTitleMaxWidth(c,N)}}if(a==="two-row-top"){const c=t.filter(P=>P.prefix==="title1"),S=c.findIndex(P=>P.prefix===n.prefix),{resolved:N,effective:_e}=l.getRowScopedJournalTitleWidths(c,W);return{effectiveWidth:_e[S]??0,resolvedWidth:N[S]??0,maxWidth:l.getJournalTitleMaxWidth(S,N)}}const s=t.filter(c=>c.prefix==="title2"||c.prefix==="title3"),r=s.findIndex(c=>c.prefix===n.prefix),{resolved:d,effective:x}=l.getRowScopedJournalTitleWidths(s,W);return{effectiveWidth:x[r]??0,resolvedWidth:d[r]??0,maxWidth:l.getJournalTitleMaxWidth(r,d)}},[W,p]),it=(t,n,a)=>{const s=t.marginLeftKey?M[t.marginLeftKey]??0:0,{effectiveWidth:r,resolvedWidth:d,maxWidth:x}=a??Pe(t,n),c=Math.max(s,l.TITLE_PADDING_HANDLE_WIDTH),S=f&&n==="two-row-top";return i.jsxs("div",{className:`${e}-title-cell`,"data-title":t.prefix,style:{width:m(r),...s>0?{marginLeft:m(s)}:{}},children:[i.jsx("p",{className:t.className,style:t.style,children:t.text}),S&&t.marginLeftKey?i.jsx("div",{"data-controls":t.marginLeftKey,"data-controls-axis":"x","data-controls-min":"0","data-controls-max-fraction":String(d),style:{position:"absolute",top:0,left:m(-s),width:m(c),height:"100%",pointerEvents:"auto"}}):null,S?i.jsx("div",{"data-controls":t.widthKey,"data-controls-axis":"x","data-controls-max-fraction":String(x),"data-controls-variant":"column-width",className:`${e}-title-resize-handle`,style:{position:"absolute",top:0,right:m(-l.TITLE_RESIZE_HANDLE_WIDTH/2),width:m(l.TITLE_RESIZE_HANDLE_WIDTH),height:"100%",pointerEvents:"auto"}}):null]},t.className)},nt=(t="two-row")=>{const n=v.findIndex(r=>r.prefix==="title1"),a=n>=0?D[n]:W.title1Width,s=t==="two-row"&&f;return i.jsx("div",{...s?{"data-controls":"title1MarginLeft","data-controls-axis":"x","data-controls-min":"0","data-controls-max-fraction":String(a)}:{},style:{width:m(R??0),flexShrink:0,alignSelf:"stretch",...s?{pointerEvents:"auto"}:{}}})},ot=()=>i.jsx("span",{className:`${e}-titles-baseline-strut`,style:ne,"aria-hidden":"true",children:" "}),It=()=>i.jsx("span",{className:`${e}-entry-counter`,style:Et,"aria-live":"polite","aria-atomic":"true",children:l.formatSlideCounter(u,y,C,E)}),ni=()=>Q?f&&se?i.jsxs("div",{className:`${e}-text-bar-cell`,style:{flexShrink:0},children:[It(),i.jsx("div",{"data-controls":"countCloseGap","data-controls-axis":"x","data-controls-reverse":"true",style:{position:"absolute",top:0,right:`calc(-0.5 * (${l.getGapControlSize(ye)} + ${ye}))`,width:l.getGapControlSize(ye),height:"100%",pointerEvents:"auto",zIndex:3}})]}):It():null,lt=()=>!Q&&!se?null:i.jsxs("div",{className:`${e}-titles-row-header-controls`,style:Yt,children:[ni(),se?si():null]}),oi=()=>i.jsxs("div",{className:`${e}-titles-row ${e}-titles-row-header`,style:{width:"100%",position:"relative"},children:[Q||Re?ot():null,Qe?nt("single-row"):null,Rt(h),i.jsx("div",{style:{flex:1,minWidth:0},"aria-hidden":"true"}),lt(),at()]}),li=()=>i.jsxs("div",{className:`${e}-titles-row ${e}-titles-row-header`,style:{width:"100%",position:"relative"},children:[Q||Re?ot():null,Qe?nt("single-row"):null,i.jsxs("div",{className:`${e}-titles-row-titles`,style:T&&oe?{minHeight:oe}:void 0,children:[i.jsx("div",{ref:O,className:We,style:{position:"absolute",visibility:"hidden",pointerEvents:"none",left:0,right:0,top:0,width:"100%",height:"auto"},"aria-hidden":"true",children:He($e||h)}),i.jsxs("div",{ref:qe,className:We,style:{position:T?"absolute":"relative",inset:T?0:void 0,width:"100%",...T&&be?{width:be,maxWidth:"100%"}:void 0},children:[g&&T?i.jsx("div",{className:`${Tt} ${e}-titles-fade-out`,children:He(g)}):null,i.jsx("div",{className:`${e}-titles-layer-in${T?` ${e}-titles-layer-in-fading ${e}-titles-fade-in`:""}`,children:He(h)})]})]}),lt(),at()]}),si=()=>i.jsxs("div",{className:`${e}-close-icon`,style:{width:ct.scalingValue(b??0,w),height:ct.scalingValue(b??0,w),marginRight:dt,"--close-icon-hover-color":F},children:[i.jsx("button",{ref:Xe,type:"button",className:`${e}-close-icon-inner`,onClick:ge,"aria-label":"Close",children:i.jsx(mi.SvgImage,{url:ve??"",fill:_,hoverFill:w&&!ee?_:F,className:`${e}-close-icon-img`})}),f&&i.jsx("div",{"data-controls":"iconMarginRight","data-controls-axis":"x","data-controls-reverse":"",className:`${e}-control`,style:{position:"absolute",top:0,left:"100%",width:dt,height:"100%",pointerEvents:"auto"}})]}),jt=(t,n)=>i.jsxs("div",{className:`${e}-titles-row-top`,children:[Q||Re?ot():null,Qe?nt("two-row"):null,n!==void 0?i.jsx("div",{className:`${e}-titles-row-titles`,style:{position:"relative",flex:1,minWidth:0,minHeight:n},children:t}):i.jsxs(i.Fragment,{children:[t,i.jsx("div",{style:{flex:1,minWidth:0},"aria-hidden":"true"})]}),lt()]}),Rt=t=>{if(!t)return null;const n=l.buildJournalTitleSlots(e,t,ne,ae,ce);return i.jsx(i.Fragment,{children:n.map(a=>it(a,"single-row",tt(n,a,"single-row")))})},st=t=>{if(!t)return null;const n=l.buildJournalTitleSlots(e,t,ne,ae,ce),a=n.find(s=>s.prefix==="title1");return a?it(a,"two-row-top",tt(n,a,"two-row-top")):null},rt=(t,n=!1)=>{const a=t?l.buildJournalTitleSlots(e,t,ne,ae,ce):[],s=a.filter(x=>x.prefix==="title2"||x.prefix==="title3"),r=f&&n;return s.length>0||r||($??0)>0?i.jsxs("div",{className:`${e}-titles-row-bottom-wrap`,children:[s.length>0?i.jsxs("div",{className:`${e}-titles-row-bottom`,children:[s.map(x=>it(x,"two-row-bottom",tt(a,x,"two-row-bottom"))),n&&f?i.jsxs(i.Fragment,{children:[ci(),di()]}):null]}):null,($??0)>0||r?i.jsx("div",{"data-controls":r?"titleRowMarginBottom":void 0,"data-controls-axis":r?"y":void 0,"data-controls-reverse":r?"":void 0,className:r?`${e}-control`:void 0,style:{height:Pt,width:"100%",flexShrink:0,pointerEvents:r?"auto":"none"}}):null]}):null},Le=(t,n=!1)=>i.jsxs(i.Fragment,{children:[jt(st(t)),rt(t,n)]}),He=t=>p?i.jsx("div",{className:`${e}-titles-row-two-row`,children:Le(t)}):t?i.jsx("div",{className:`${e}-titles-row`,style:{width:"100%"},children:Rt(t)}):null,ri=()=>{const t=p?-1:v.findIndex(s=>s.prefix==="title1"),n=!p&&(f||(R??0)>0)?(()=>{const s=R??0,r=t>=0?D[t]:W.title1Width,d=Math.max(s,l.TITLE_PADDING_HANDLE_WIDTH);return i.jsx("div",{"data-controls":"title1MarginLeft","data-controls-axis":"x","data-controls-min":"0","data-controls-max-fraction":String(r),style:{position:"absolute",top:0,left:0,width:m(d),height:"100%",pointerEvents:"auto"}},"title1MarginLeft")})():null,a=v.flatMap((s,r)=>{if(!s.marginLeftKey)return[];const d=M[s.marginLeftKey]??0,x=l.getJournalTitleOffsetBeforeSlot(v,D,M,r)+ti(),c=Math.max(d,l.TITLE_PADDING_HANDLE_WIDTH);return i.jsx("div",{"data-controls":s.marginLeftKey,"data-controls-axis":"x","data-controls-min":"0","data-controls-max-fraction":String(D[r]),style:{position:"absolute",top:0,left:m(x),width:m(c),height:"100%",pointerEvents:"auto"}},s.marginLeftKey)});return n?[n,...a]:a},ai=()=>v.map((t,n)=>{const a=l.getJournalTitleMaxWidth(n,D),r=ei(n)-l.TITLE_RESIZE_HANDLE_WIDTH/2;return i.jsx("div",{style:{position:"absolute",inset:0,pointerEvents:"none"},children:i.jsx("div",{"data-controls":t.widthKey,"data-controls-axis":"x","data-controls-max-fraction":String(a),"data-controls-variant":"column-width",className:`${e}-title-resize-handle`,style:{position:"absolute",top:0,left:m(r),width:m(l.TITLE_RESIZE_HANDLE_WIDTH),height:"100%",pointerEvents:"auto"}})},`${t.widthKey}-junction`)}),ci=()=>A.flatMap((t,n)=>{if(!t.marginLeftKey)return[];const a=M[t.marginLeftKey]??0,s=et(n),r=Math.max(a,l.TITLE_PADDING_HANDLE_WIDTH),{resolvedWidth:d}=Pe(t,"two-row-bottom");return i.jsx("div",{"data-controls":t.marginLeftKey,"data-controls-axis":"x","data-controls-min":"0","data-controls-max-fraction":String(d),style:{position:"absolute",top:0,left:m(s),width:m(r),height:"100%",pointerEvents:"auto"}},t.marginLeftKey)}),di=()=>A.map((t,n)=>{const{maxWidth:a}=Pe(t,"two-row-bottom"),r=ii(n)-l.TITLE_RESIZE_HANDLE_WIDTH/2;return i.jsx("div",{style:{position:"absolute",inset:0,pointerEvents:"none"},children:i.jsx("div",{"data-controls":t.widthKey,"data-controls-axis":"x","data-controls-max-fraction":String(a),"data-controls-variant":"column-width",className:`${e}-title-resize-handle`,style:{position:"absolute",top:0,left:m(r),width:m(l.TITLE_RESIZE_HANDLE_WIDTH),height:"100%",pointerEvents:"auto"}})},`${t.widthKey}-junction`)}),at=()=>!f||p?null:i.jsxs(i.Fragment,{children:[ri(),ai()]}),Wt=t=>{const n=!t.objectFit&&G.isImageRatioCover(te);return{className:`${e}-slide-image-cell${n?` ${e}-slide-image-cell-cover`:""}`,style:{maxWidth:Mt,maxHeight:Dt,...n?{"--image-aspect-ratio":G.getAspectRatio(te)}:{}}}},Nt=t=>t.objectFit?{className:`${e}-slide-image ${e}-slide-image-custom`,style:{"--image-object-fit":t.objectFit}}:G.isImageRatioCover(te)?{className:`${e}-slide-image ${e}-slide-image-cover`}:{className:`${e}-slide-image ${e}-slide-image-fit`},kt=t=>{if(t.length===0)return null;const n=t.length>1,a=l.getGapControlSize(Oe),s=`calc(-0.5 * (${a} + ${Oe}))`;if(t.length===1){const r=t[0];return i.jsx("div",{...Wt(r),children:i.jsx("img",{...Nt(r),src:r.assetId,alt:r.name??"",draggable:!1})})}return i.jsx("div",{className:`${e}-slide-inner`,style:n?{gap:Oe}:void 0,children:t.map((r,d)=>i.jsxs("div",{...Wt(r),children:[i.jsx("img",{...Nt(r),src:r.assetId,alt:r.name??"",draggable:!1}),f&&n&&d<t.length-1&&i.jsx("div",{"data-controls":"imageGap","data-controls-axis":"x",style:{position:"absolute",top:0,right:s,width:a,height:"100%",pointerEvents:"auto",zIndex:3}})]},`${r.assetId}-${d}`))})},Ct=!!(h!=null&&h.title2||h!=null&&h.title3||g!=null&&g.title2||g!=null&&g.title3||($??0)>0||f),ui=()=>i.jsxs("div",{style:{position:"relative",width:"100%",flex:1,alignSelf:"stretch",display:"flex",flexDirection:"column",minHeight:0,height:"100%"},children:[i.jsx("div",{ref:O,className:We,style:{position:"absolute",visibility:"hidden",pointerEvents:"none",left:0,right:0,top:0,width:"100%",height:"auto"},"aria-hidden":"true",children:Le($e||h)}),i.jsxs("div",{ref:qe,className:`${e}-titles-row-two-row`,style:{...T&&oe?{minHeight:oe}:void 0,...T&&be?{width:be,maxWidth:"100%"}:void 0},children:[jt(i.jsxs("div",{className:We,style:{position:T?"absolute":"relative",inset:T?0:void 0,width:"100%"},children:[g&&T?i.jsx("div",{className:`${Qt} ${e}-titles-fade-out`,children:st(g)}):null,i.jsx("div",{className:`${e}-titles-layer-in${T?` ${e}-titles-layer-in-fading ${e}-titles-fade-in`:""}`,children:st(h)})]}),T&&oe?oe:void 0),Ct?i.jsxs("div",{className:`${e}-titles-row-bottom-area`,children:[g&&T?i.jsx("div",{className:`${Tt} ${e}-titles-layer-out-bottom ${e}-titles-fade-out`,children:rt(g)}):null,i.jsx("div",{className:`${e}-titles-layer-in${T?` ${e}-titles-layer-in-fading ${e}-titles-fade-in`:""}${p?` ${e}-titles-layer-in-stacked`:""}`,children:rt(h,!0)})]}):null]})]}),hi=()=>{const t=Ct;return i.jsxs("div",{style:{position:"relative",width:"100%",alignSelf:"stretch",display:"flex",flexDirection:"column",minHeight:0,...t?{flex:1,height:"100%"}:{}},children:[i.jsx("div",{className:`${e}-titles-row-two-row`,style:t?void 0:{flex:"0 0 auto",height:"auto"},children:Le(h,!0)}),at()]})};return i.jsxs("div",{ref:B,"data-selection":"none",className:`${e}-lightbox${w?` ${e}-lightbox-editor`:""}${f?` ${e}-lightbox-edit-mode`:""}`,onClick:()=>{Ze||ge()},role:"dialog","aria-modal":"true","aria-label":"Journal gallery",tabIndex:se?void 0:-1,style:{opacity:ut?1:0,transition:"opacity 300ms ease",pointerEvents:ut?"auto":"none"},children:[i.jsx("div",{className:`${e}-lightbox-backdrop`,style:{backgroundColor:Ae,...Ot}}),i.jsxs("div",{className:`${e}-lightbox-dismiss-area`,style:Ut,...Gt,children:[i.jsx("div",{className:`${e}-lightbox-content`,style:Bt,onClick:t=>t.stopPropagation(),children:i.jsx("div",{className:`${e}-lightbox-strip`,"data-desktop-nav":z&&u.length>1?"true":"false",onPointerDown:z?Vt:void 0,onPointerUp:z?qt:void 0,onPointerCancel:z?Xt:void 0,children:i.jsxs("div",{className:`${e}-slide-stack`,children:[$t&>?i.jsx("div",{className:`${e}-slide-layer-out ${e}-slide-fade-out`,onAnimationEnd:t=>{t.target===t.currentTarget&&Ft(Ue)},children:i.jsx("div",{className:`${e}-slide-area`,children:kt($t.images)})},`slide-out-${Ue}`):null,i.jsx("div",{className:`${e}-slide-layer-in${gt?` ${e}-slide-fade-in`:""}`,children:i.jsx("div",{className:`${e}-slide-area`,children:de?kt(de.images):null})},`slide-in-${Ue}-${y}`)]})})}),i.jsxs("div",{className:`${e}-lightbox-overlay-content`,style:Kt,children:[i.jsx("div",{"data-controls":f?"contentMarginTop":void 0,className:f?`${e}-control`:void 0,style:{height:At,width:"100%"}}),i.jsx("div",{style:{display:"flex",flexDirection:"row",width:"100%",...p?{flex:1,minHeight:0}:{}},children:i.jsx("div",{className:`${e}-lightbox-content-area${p?` ${e}-lightbox-content-area-stacked`:""}`,children:Zt&&i.jsx("div",{className:`${e}-text-bar-cell${p?` ${e}-text-bar-cell-stacked`:""}`,style:p?void 0:{flex:1,minWidth:0,width:"100%"},children:p?J==="fade"?ui():hi():J==="fade"?li():oi()})})})]})]})]})},Me=400,De="cubic-bezier(0.25, 0.1, 0.25, 1)",Ht=1.1,pi=`${((1-1/Ht)/2*100).toFixed(4)}%`;function vi(e){return`
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),o=require("react"),Lt=require("react-dom"),hi=require("./useScopedStyles-Bf6yohVQ.js"),G=require("./useLightboxSwipeDismiss-Br9uE5G0.js"),rt=require("./scalingValue-CSHYgTZl.js"),fi=require("./SvgImage-DFlmxAoL.js"),mi=require("./useLightboxScrollLock-Hf16Eq4g.js"),l=require("./utils-033j3qNL.js"),gi=({prefix:e,entries:z,settings:I,isEditor:w,isEditMode:f,isPreviewMode:ee,initialSlideIndex:U=0,enableUrlSync:j=!1,journalItemId:k=null,onBeforeClose:V,onClose:q})=>{const{type:C,coverFit:te,backgroundColor:_e,imageGap:De,maxWidth:Ae,maxHeight:H,textTransition:E,title1Width:ie,title2Width:re,title3Width:X,title1MarginLeft:R=0,title2MarginLeft:L=0,title3MarginLeft:pe=0,titleRowMarginBottom:$=0,titleHeaderLayout:ze="single-row",countCloseGap:Ee=0,closeIcon:ve,closeIconMaxWidth:b,closeIconColor:M,closeIconHoverColor:J,contentMarginTop:we=0,iconMarginRight:Ht=0}=I,m=o.useCallback(t=>rt.scalingValue(t,w??!1),[w]),Je=m(De??0),Mt=`${Ae}%`,_t=`${H}%`,ye=m(Ee),Dt=m(we),dt=m(Ht),ne=l.journalTextFieldsToCss("title1",l.resolveJournalTextFields(I,"title1"),w),ae=l.journalTextFieldsToCss("title2",l.resolveJournalTextFields(I,"title2"),w),ce=l.journalTextFieldsToCss("title3",l.resolveJournalTextFields(I,"title3"),w),At=l.journalTextFieldsToCss("count",l.resolveJournalTextFields(I,"count"),w),p=ze==="mobile",F=!w||!!ee,zt=!f&&(!w||!!ee),u=o.useMemo(()=>l.buildJournalSlides(z,C),[z,C]),[y,Fe]=o.useState(U),de=u[y],h=de==null?void 0:de.entry,[ut,ht]=o.useState(!1),[ft,ue]=o.useState(null),[T,he]=o.useState(!1),[mt,Be]=o.useState(null),[gt,Ke]=o.useState(!1),[Oe,xt]=o.useState(0),[oe,fe]=o.useState(),[be,me]=o.useState(),[$e,Te]=o.useState(null),Z=o.useRef(null),Se=o.useRef(0),Ie=o.useRef(0),pt=o.useRef(0),vt=o.useRef(!1),Ge=o.useRef(null),Ue=o.useRef(null),B=o.useRef(null),K=o.useRef(null),Ve=o.useRef(null),wt=o.useRef(null),je=o.useRef(null),yt=o.useCallback(()=>{const t=Ue.current;if(!t)return;const n=t.closest(`.${e}-lightbox-content-area`);if(!n)return t.getBoundingClientRect().width;const a=Array.from(n.children).reduce((s,r)=>!(r instanceof HTMLElement)||r.contains(t)?s:s+r.getBoundingClientRect().width,0);return n.getBoundingClientRect().width-a},[e]),Y=o.useCallback(()=>{Z.current&&(clearTimeout(Z.current),Z.current=null)},[]),Et=o.useCallback(t=>{t===Se.current&&(Be(null),Ke(!1))},[]),ge=o.useCallback(()=>{f||vt.current||(vt.current=!0,V==null||V(),ht(!1),Ge.current=setTimeout(()=>{q()},300))},[f,V,q]),Jt=o.useCallback(t=>!!(t.closest("[data-controls]")||t.closest(`.${e}-close-icon`)),[e]),{isSwipeDragging:qe,backdropStyle:Ft,mediaAreaStyle:Bt,overlayContentStyle:Kt,swipeHandlers:Ot,dismissAreaStyle:Gt}=G.useLightboxSwipeDismiss({enabled:zt,onClose:ge,animMs:300,isBlockedTarget:Jt}),bt=o.useCallback(t=>{j&&l.setJournalUrlParam(t+1,k,!0)},[j,k]),Xe=o.useCallback(t=>{if(t)return t.getBoundingClientRect().height},[]),le=o.useCallback(t=>{if(u.length===0)return;const n=(t%u.length+u.length)%u.length;if(n===y)return;const a=u[y],s=u[n];Se.current+=1;const r=Se.current,d=E==="fade"&&l.getEntryTitleKey(a==null?void 0:a.entry)!==l.getEntryTitleKey(s==null?void 0:s.entry),x=Xe(B.current),c=d?(()=>{const N=yt();Lt.flushSync(()=>{Te(s.entry)}),B.current&&N&&(B.current.style.width=`${N}px`);const Me=Xe(B.current);return B.current&&(B.current.style.width=""),{measuredIncomingTitlesHeight:Me,incomingTitlesMeasureWidth:N}})():void 0,S=Math.max(x??0,(c==null?void 0:c.measuredIncomingTitlesHeight)??0)||void 0;xt(r),Be(y),Ke(!0),Fe(n),bt(n),pt.current=n,d?(Y(),S&&fe(S),c!=null&&c.incomingTitlesMeasureWidth&&me(c.incomingTitlesMeasureWidth),ue((a==null?void 0:a.entryIndex)??null),he(!0),Ie.current=s.entryIndex,Z.current=setTimeout(()=>{ue(null),he(!1),fe(void 0),me(void 0),Te(null),Z.current=null},400)):(Y(),ue(null),he(!1),fe(void 0),me(void 0),Te(null),Ie.current=s.entryIndex)},[y,Y,yt,Xe,u,bt,E]),xe=o.useCallback(()=>{je.current=null},[]),Ut=o.useCallback(t=>{!F||u.length<=1||t.pointerType==="mouse"&&t.button!==0||t.target.closest("[data-controls]")||(je.current={startX:t.clientX,startY:t.clientY,pointerId:t.pointerId})},[F,u.length]),Vt=o.useCallback(t=>{var N;if(!F||u.length<=1||t.pointerType==="mouse"&&t.button!==0)return;if(qe){xe();return}const n=je.current;if(!n||n.pointerId!==t.pointerId||(xe(),t.target.closest("[data-controls]")))return;const s=t.clientX-n.startX,r=t.clientY-n.startY,d=Math.abs(s),x=Math.abs(r);if(d>=l.STRIP_NAV_SWIPE_MIN_PX&&d>x){le(s>0?y-1:y+1);return}if(d>l.STRIP_NAV_TAP_MAX_PX||x>l.STRIP_NAV_TAP_MAX_PX)return;const c=(N=K.current)==null?void 0:N.getBoundingClientRect(),S=c?c.left+c.width/2:window.innerWidth/2;le(t.clientX<S?y-1:y+1)},[y,F,le,qe,xe,u.length]),qt=o.useCallback(t=>{const n=je.current;(n==null?void 0:n.pointerId)===t.pointerId&&xe()},[xe]);mi.useLightboxScrollLock(),o.useEffect(()=>{wt.current=document.activeElement instanceof HTMLElement?document.activeElement:null;const t=requestAnimationFrame(()=>{ht(!0),requestAnimationFrame(()=>{Ve.current?Ve.current.focus():K.current&&K.current.focus()})});return()=>{cancelAnimationFrame(t),Ge.current&&clearTimeout(Ge.current),Z.current&&clearTimeout(Z.current);const n=wt.current;n&&document.contains(n)&&n.focus({preventScroll:!0})}},[]),o.useEffect(()=>{var t;E!=="fade"&&(Ie.current=((t=u[y])==null?void 0:t.entryIndex)??0,Y(),ue(null),he(!1),fe(void 0),me(void 0))},[y,Y,u,E]),o.useEffect(()=>{const t=n=>{if(n.key==="Escape"){ge();return}if(n.key==="ArrowLeft"&&u.length>1){le(y-1);return}if(n.key==="ArrowRight"&&u.length>1){le(y+1);return}if(n.key==="Tab"&&K.current){const a=K.current.querySelectorAll('button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])'),s=Array.from(a).filter(c=>!c.closest('[aria-hidden="true"]'));if(s.length===0)return;const r=s[0],d=s[s.length-1],x=document.activeElement;n.shiftKey?(x===r||!K.current.contains(x))&&(n.preventDefault(),d.focus()):(x===d||!K.current.contains(x))&&(n.preventDefault(),r.focus())}};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[le,ge,y,u.length]),o.useLayoutEffect(()=>{Y(),Se.current=0,xt(0),Be(null),Ke(!1),ue(null),he(!1),fe(void 0),me(void 0),Te(null),Fe(t=>{const n=Math.max(0,u.length-1);return Math.min(t,n)})},[Y,z.length,C,u.length]),o.useLayoutEffect(()=>{var a;const t=Math.max(0,u.length-1),n=Math.min(Math.max(0,U),t);pt.current=n,Ie.current=((a=u[n])==null?void 0:a.entryIndex)??0,Fe(n)},[U]);const g=ft!==null?z[ft]:null,$t=mt!==null?u[mt]:null,Re=(h==null?void 0:h.title1)||(h==null?void 0:h.title2)||(h==null?void 0:h.title3)||(g==null?void 0:g.title1)||(g==null?void 0:g.title2)||(g==null?void 0:g.title3),Q=l.shouldShowCounter(C,u,z),se=ve!==null,Xt=Re||Q||se,Zt=Q&&se?{gap:ye}:void 0,We=`${e}-titles-stack${p?` ${e}-titles-stack-stacked`:""}`,Tt=`${e}-titles-layer-out${p?` ${e}-titles-layer-out-stacked`:""}`,Yt=`${e}-titles-layer-out`,Ze=(R??0)>0||f,Qt=m($),W=o.useMemo(()=>({title1Width:ie??l.DEFAULT_JOURNAL_TITLE_WIDTHS.title1Width,title2Width:re??l.DEFAULT_JOURNAL_TITLE_WIDTHS.title2Width,title3Width:X??l.DEFAULT_JOURNAL_TITLE_WIDTHS.title3Width}),[ie,re,X]),_=o.useMemo(()=>({title2MarginLeft:L,title3MarginLeft:pe}),[L,pe]),v=o.useMemo(()=>h?l.buildJournalTitleSlots(e,h,ne,ae,ce):[],[e,h,ne,ae,ce]),Ne=o.useMemo(()=>v.map(t=>W[t.widthKey]),[v,W]),D=o.useMemo(()=>l.resolveJournalTitleWidths(v.length,Ne),[v.length,Ne]),St=o.useMemo(()=>l.getEffectiveJournalTitleWidths(v.length,Ne),[v.length,Ne]),ke=o.useMemo(()=>v.filter(t=>t.prefix==="title1"),[v]),A=o.useMemo(()=>v.filter(t=>t.prefix==="title2"||t.prefix==="title3"),[v]),Ce=o.useMemo(()=>l.getRowScopedJournalTitleWidths(ke,W),[ke,W]),O=o.useMemo(()=>l.getRowScopedJournalTitleWidths(A,W),[A,W]),Ye=o.useCallback((t,n)=>{const a=v.findIndex(r=>r.prefix===t.prefix);if(!p||n==="single-row")return{effectiveWidth:St[a]??0,resolvedWidth:D[a]??0,maxWidth:l.getJournalTitleMaxWidth(a,D)};if(n==="two-row-top"){const r=ke.findIndex(d=>d.prefix===t.prefix);return{effectiveWidth:Ce.effective[r]??0,resolvedWidth:Ce.resolved[r]??0,maxWidth:l.getJournalTitleMaxWidth(r,Ce.resolved)}}const s=A.findIndex(r=>r.prefix===t.prefix);return{effectiveWidth:O.effective[s]??0,resolvedWidth:O.resolved[s]??0,maxWidth:l.getJournalTitleMaxWidth(s,O.resolved)}},[v,A,O,St,D,ke,Ce,p]),Pt=o.useCallback(t=>l.getJournalTitleBoundaryOffset(v,D,_,t)+(p?0:R??0),[v,D,_,p,R]),ei=o.useCallback(()=>p?0:R??0,[p,R]),Qe=o.useCallback(t=>A.slice(0,t).reduce((n,a,s)=>n+(a.marginLeftKey?_[a.marginLeftKey]??0:0)+(O.resolved[s]??0),0),[A,O.resolved,_]),ti=o.useCallback(t=>{const n=A[t];return Qe(t)+(n.marginLeftKey?_[n.marginLeftKey]??0:0)+(O.resolved[t]??0)},[A,O.resolved,Qe,_]),Pe=o.useCallback((t,n,a)=>{if(!p||a==="single-row"){const c=t.findIndex(P=>P.prefix===n.prefix),S=t.map(P=>W[P.widthKey]),N=l.resolveJournalTitleWidths(t.length,S);return{effectiveWidth:l.getEffectiveJournalTitleWidths(t.length,S)[c]??0,resolvedWidth:N[c]??0,maxWidth:l.getJournalTitleMaxWidth(c,N)}}if(a==="two-row-top"){const c=t.filter(P=>P.prefix==="title1"),S=c.findIndex(P=>P.prefix===n.prefix),{resolved:N,effective:Me}=l.getRowScopedJournalTitleWidths(c,W);return{effectiveWidth:Me[S]??0,resolvedWidth:N[S]??0,maxWidth:l.getJournalTitleMaxWidth(S,N)}}const s=t.filter(c=>c.prefix==="title2"||c.prefix==="title3"),r=s.findIndex(c=>c.prefix===n.prefix),{resolved:d,effective:x}=l.getRowScopedJournalTitleWidths(s,W);return{effectiveWidth:x[r]??0,resolvedWidth:d[r]??0,maxWidth:l.getJournalTitleMaxWidth(r,d)}},[W,p]),et=(t,n,a)=>{const s=t.marginLeftKey?_[t.marginLeftKey]??0:0,{effectiveWidth:r,resolvedWidth:d,maxWidth:x}=a??Ye(t,n),c=Math.max(s,l.TITLE_PADDING_HANDLE_WIDTH),S=f&&n==="two-row-top";return i.jsxs("div",{className:`${e}-title-cell`,"data-title":t.prefix,style:{width:m(r),...s>0?{marginLeft:m(s)}:{}},children:[i.jsx("p",{className:t.className,style:t.style,children:t.text}),S&&t.marginLeftKey?i.jsx("div",{"data-controls":t.marginLeftKey,"data-controls-axis":"x","data-controls-min":"0","data-controls-max-fraction":String(d),style:{position:"absolute",top:0,left:m(-s),width:m(c),height:"100%",pointerEvents:"auto"}}):null,S?i.jsx("div",{"data-controls":t.widthKey,"data-controls-axis":"x","data-controls-max-fraction":String(x),"data-controls-variant":"column-width",className:`${e}-title-resize-handle`,style:{position:"absolute",top:0,right:m(-l.TITLE_RESIZE_HANDLE_WIDTH/2),width:m(l.TITLE_RESIZE_HANDLE_WIDTH),height:"100%",pointerEvents:"auto"}}):null]},t.className)},tt=(t="two-row")=>{const n=v.findIndex(r=>r.prefix==="title1"),a=n>=0?D[n]:W.title1Width,s=t==="two-row"&&f;return i.jsx("div",{...s?{"data-controls":"title1MarginLeft","data-controls-axis":"x","data-controls-min":"0","data-controls-max-fraction":String(a)}:{},style:{width:m(R??0),flexShrink:0,alignSelf:"stretch",...s?{pointerEvents:"auto"}:{}}})},it=()=>i.jsx("span",{className:`${e}-titles-baseline-strut`,style:ne,"aria-hidden":"true",children:" "}),It=()=>i.jsx("span",{className:`${e}-entry-counter`,style:At,"aria-live":"polite","aria-atomic":"true",children:l.formatSlideCounter(u,y,C,z)}),ii=()=>Q?f&&se?i.jsxs("div",{className:`${e}-text-bar-cell`,style:{flexShrink:0},children:[It(),i.jsx("div",{"data-controls":"countCloseGap","data-controls-axis":"x","data-controls-reverse":"true",style:{position:"absolute",top:0,right:`calc(-0.5 * (${l.getGapControlSize(ye)} + ${ye}))`,width:l.getGapControlSize(ye),height:"100%",pointerEvents:"auto",zIndex:3}})]}):It():null,nt=()=>!Q&&!se?null:i.jsxs("div",{className:`${e}-titles-row-header-controls`,style:Zt,children:[ii(),se?li():null]}),ni=()=>i.jsxs("div",{className:`${e}-titles-row ${e}-titles-row-header`,style:{width:"100%",position:"relative"},children:[Q||Re?it():null,Ze?tt("single-row"):null,Rt(h),i.jsx("div",{style:{flex:1,minWidth:0},"aria-hidden":"true"}),nt(),st()]}),oi=()=>i.jsxs("div",{className:`${e}-titles-row ${e}-titles-row-header`,style:{width:"100%",position:"relative"},children:[Q||Re?it():null,Ze?tt("single-row"):null,i.jsxs("div",{className:`${e}-titles-row-titles`,style:T&&oe?{minHeight:oe}:void 0,children:[i.jsx("div",{ref:B,className:We,style:{position:"absolute",visibility:"hidden",pointerEvents:"none",left:0,right:0,top:0,width:"100%",height:"auto"},"aria-hidden":"true",children:He($e||h)}),i.jsxs("div",{ref:Ue,className:We,style:{position:T?"absolute":"relative",inset:T?0:void 0,width:"100%",...T&&be?{width:be,maxWidth:"100%"}:void 0},children:[g&&T?i.jsx("div",{className:`${Tt} ${e}-titles-fade-out`,children:He(g)}):null,i.jsx("div",{className:`${e}-titles-layer-in${T?` ${e}-titles-layer-in-fading ${e}-titles-fade-in`:""}`,children:He(h)})]})]}),nt(),st()]}),li=()=>i.jsxs("div",{className:`${e}-close-icon`,style:{width:rt.scalingValue(b??0,w),height:rt.scalingValue(b??0,w),marginRight:dt,"--close-icon-hover-color":J},children:[i.jsx("button",{ref:Ve,type:"button",className:`${e}-close-icon-inner`,onClick:ge,"aria-label":"Close",children:i.jsx(fi.SvgImage,{url:ve??"",fill:M,hoverFill:w&&!ee?M:J,className:`${e}-close-icon-img`})}),f&&i.jsx("div",{"data-controls":"iconMarginRight","data-controls-axis":"x","data-controls-reverse":"",className:`${e}-control`,style:{position:"absolute",top:0,left:"100%",width:dt,height:"100%",pointerEvents:"auto"}})]}),jt=(t,n)=>i.jsxs("div",{className:`${e}-titles-row-top`,children:[Q||Re?it():null,Ze?tt("two-row"):null,n!==void 0?i.jsx("div",{className:`${e}-titles-row-titles`,style:{position:"relative",flex:1,minWidth:0,minHeight:n},children:t}):i.jsxs(i.Fragment,{children:[t,i.jsx("div",{style:{flex:1,minWidth:0},"aria-hidden":"true"})]}),nt()]}),Rt=t=>{if(!t)return null;const n=l.buildJournalTitleSlots(e,t,ne,ae,ce);return i.jsx(i.Fragment,{children:n.map(a=>et(a,"single-row",Pe(n,a,"single-row")))})},ot=t=>{if(!t)return null;const n=l.buildJournalTitleSlots(e,t,ne,ae,ce),a=n.find(s=>s.prefix==="title1");return a?et(a,"two-row-top",Pe(n,a,"two-row-top")):null},lt=(t,n=!1)=>{const a=t?l.buildJournalTitleSlots(e,t,ne,ae,ce):[],s=a.filter(x=>x.prefix==="title2"||x.prefix==="title3"),r=f&&n;return s.length>0||r||($??0)>0?i.jsxs("div",{className:`${e}-titles-row-bottom-wrap`,children:[s.length>0?i.jsxs("div",{className:`${e}-titles-row-bottom`,children:[s.map(x=>et(x,"two-row-bottom",Pe(a,x,"two-row-bottom"))),n&&f?i.jsxs(i.Fragment,{children:[ai(),ci()]}):null]}):null,($??0)>0||r?i.jsx("div",{"data-controls":r?"titleRowMarginBottom":void 0,"data-controls-axis":r?"y":void 0,"data-controls-reverse":r?"":void 0,className:r?`${e}-control`:void 0,style:{height:Qt,width:"100%",flexShrink:0,pointerEvents:r?"auto":"none"}}):null]}):null},Le=(t,n=!1)=>i.jsxs(i.Fragment,{children:[jt(ot(t)),lt(t,n)]}),He=t=>p?i.jsx("div",{className:`${e}-titles-row-two-row`,children:Le(t)}):t?i.jsx("div",{className:`${e}-titles-row`,style:{width:"100%"},children:Rt(t)}):null,si=()=>{const t=p?-1:v.findIndex(s=>s.prefix==="title1"),n=!p&&(f||(R??0)>0)?(()=>{const s=R??0,r=t>=0?D[t]:W.title1Width,d=Math.max(s,l.TITLE_PADDING_HANDLE_WIDTH);return i.jsx("div",{"data-controls":"title1MarginLeft","data-controls-axis":"x","data-controls-min":"0","data-controls-max-fraction":String(r),style:{position:"absolute",top:0,left:0,width:m(d),height:"100%",pointerEvents:"auto"}},"title1MarginLeft")})():null,a=v.flatMap((s,r)=>{if(!s.marginLeftKey)return[];const d=_[s.marginLeftKey]??0,x=l.getJournalTitleOffsetBeforeSlot(v,D,_,r)+ei(),c=Math.max(d,l.TITLE_PADDING_HANDLE_WIDTH);return i.jsx("div",{"data-controls":s.marginLeftKey,"data-controls-axis":"x","data-controls-min":"0","data-controls-max-fraction":String(D[r]),style:{position:"absolute",top:0,left:m(x),width:m(c),height:"100%",pointerEvents:"auto"}},s.marginLeftKey)});return n?[n,...a]:a},ri=()=>v.map((t,n)=>{const a=l.getJournalTitleMaxWidth(n,D),r=Pt(n)-l.TITLE_RESIZE_HANDLE_WIDTH/2;return i.jsx("div",{style:{position:"absolute",inset:0,pointerEvents:"none"},children:i.jsx("div",{"data-controls":t.widthKey,"data-controls-axis":"x","data-controls-max-fraction":String(a),"data-controls-variant":"column-width",className:`${e}-title-resize-handle`,style:{position:"absolute",top:0,left:m(r),width:m(l.TITLE_RESIZE_HANDLE_WIDTH),height:"100%",pointerEvents:"auto"}})},`${t.widthKey}-junction`)}),ai=()=>A.flatMap((t,n)=>{if(!t.marginLeftKey)return[];const a=_[t.marginLeftKey]??0,s=Qe(n),r=Math.max(a,l.TITLE_PADDING_HANDLE_WIDTH),{resolvedWidth:d}=Ye(t,"two-row-bottom");return i.jsx("div",{"data-controls":t.marginLeftKey,"data-controls-axis":"x","data-controls-min":"0","data-controls-max-fraction":String(d),style:{position:"absolute",top:0,left:m(s),width:m(r),height:"100%",pointerEvents:"auto"}},t.marginLeftKey)}),ci=()=>A.map((t,n)=>{const{maxWidth:a}=Ye(t,"two-row-bottom"),r=ti(n)-l.TITLE_RESIZE_HANDLE_WIDTH/2;return i.jsx("div",{style:{position:"absolute",inset:0,pointerEvents:"none"},children:i.jsx("div",{"data-controls":t.widthKey,"data-controls-axis":"x","data-controls-max-fraction":String(a),"data-controls-variant":"column-width",className:`${e}-title-resize-handle`,style:{position:"absolute",top:0,left:m(r),width:m(l.TITLE_RESIZE_HANDLE_WIDTH),height:"100%",pointerEvents:"auto"}})},`${t.widthKey}-junction`)}),st=()=>!f||p?null:i.jsxs(i.Fragment,{children:[si(),ri()]}),Wt=t=>{const n=!t.objectFit&&G.isImageRatioCover(te);return{className:`${e}-slide-image-cell${n?` ${e}-slide-image-cell-cover`:""}`,style:{maxWidth:Mt,maxHeight:_t,...n?{"--image-aspect-ratio":G.getAspectRatio(te)}:{}}}},Nt=t=>t.objectFit?{className:`${e}-slide-image ${e}-slide-image-custom`,style:{"--image-object-fit":t.objectFit}}:G.isImageRatioCover(te)?{className:`${e}-slide-image ${e}-slide-image-cover`}:{className:`${e}-slide-image ${e}-slide-image-fit`},kt=t=>{if(t.length===0)return null;const n=t.length>1,a=l.getGapControlSize(Je),s=`calc(-0.5 * (${a} + ${Je}))`;if(t.length===1){const r=t[0];return i.jsx("div",{...Wt(r),children:i.jsx("img",{...Nt(r),src:r.assetId,alt:r.name??"",draggable:!1})})}return i.jsx("div",{className:`${e}-slide-inner`,style:n?{gap:Je}:void 0,children:t.map((r,d)=>i.jsxs("div",{...Wt(r),children:[i.jsx("img",{...Nt(r),src:r.assetId,alt:r.name??"",draggable:!1}),f&&n&&d<t.length-1&&i.jsx("div",{"data-controls":"imageGap","data-controls-axis":"x",style:{position:"absolute",top:0,right:s,width:a,height:"100%",pointerEvents:"auto",zIndex:3}})]},`${r.assetId}-${d}`))})},Ct=!!(h!=null&&h.title2||h!=null&&h.title3||g!=null&&g.title2||g!=null&&g.title3||($??0)>0||f),di=()=>i.jsxs("div",{style:{position:"relative",width:"100%",flex:1,alignSelf:"stretch",display:"flex",flexDirection:"column",minHeight:0,height:"100%"},children:[i.jsx("div",{ref:B,className:We,style:{position:"absolute",visibility:"hidden",pointerEvents:"none",left:0,right:0,top:0,width:"100%",height:"auto"},"aria-hidden":"true",children:Le($e||h)}),i.jsxs("div",{ref:Ue,className:`${e}-titles-row-two-row`,style:{...T&&oe?{minHeight:oe}:void 0,...T&&be?{width:be,maxWidth:"100%"}:void 0},children:[jt(i.jsxs("div",{className:We,style:{position:T?"absolute":"relative",inset:T?0:void 0,width:"100%"},children:[g&&T?i.jsx("div",{className:`${Yt} ${e}-titles-fade-out`,children:ot(g)}):null,i.jsx("div",{className:`${e}-titles-layer-in${T?` ${e}-titles-layer-in-fading ${e}-titles-fade-in`:""}`,children:ot(h)})]}),T&&oe?oe:void 0),Ct?i.jsxs("div",{className:`${e}-titles-row-bottom-area`,children:[g&&T?i.jsx("div",{className:`${Tt} ${e}-titles-layer-out-bottom ${e}-titles-fade-out`,children:lt(g)}):null,i.jsx("div",{className:`${e}-titles-layer-in${T?` ${e}-titles-layer-in-fading ${e}-titles-fade-in`:""}${p?` ${e}-titles-layer-in-stacked`:""}`,children:lt(h,!0)})]}):null]})]}),ui=()=>{const t=Ct;return i.jsxs("div",{style:{position:"relative",width:"100%",alignSelf:"stretch",display:"flex",flexDirection:"column",minHeight:0,...t?{flex:1,height:"100%"}:{}},children:[i.jsx("div",{className:`${e}-titles-row-two-row`,style:t?void 0:{flex:"0 0 auto",height:"auto"},children:Le(h,!0)}),st()]})};return i.jsxs("div",{ref:K,"data-selection":"none",className:`${e}-lightbox${w?` ${e}-lightbox-editor`:""}${f?` ${e}-lightbox-edit-mode`:""}`,onClick:()=>{qe||ge()},role:"dialog","aria-modal":"true","aria-label":"Journal gallery",tabIndex:se?void 0:-1,style:{opacity:ut?1:0,transition:"opacity 300ms ease",pointerEvents:ut?"auto":"none"},children:[i.jsx("div",{className:`${e}-lightbox-backdrop`,style:{backgroundColor:_e,...Ft}}),i.jsxs("div",{className:`${e}-lightbox-dismiss-area`,style:Gt,...Ot,children:[i.jsx("div",{className:`${e}-lightbox-content`,style:Bt,onClick:t=>t.stopPropagation(),children:i.jsx("div",{className:`${e}-lightbox-strip`,"data-desktop-nav":F&&u.length>1?"true":"false",onPointerDown:F?Ut:void 0,onPointerUp:F?Vt:void 0,onPointerCancel:F?qt:void 0,children:i.jsxs("div",{className:`${e}-slide-stack`,children:[$t&>?i.jsx("div",{className:`${e}-slide-layer-out ${e}-slide-fade-out`,onAnimationEnd:t=>{t.target===t.currentTarget&&Et(Oe)},children:i.jsx("div",{className:`${e}-slide-area`,children:kt($t.images)})},`slide-out-${Oe}`):null,i.jsx("div",{className:`${e}-slide-layer-in${gt?` ${e}-slide-fade-in`:""}`,children:i.jsx("div",{className:`${e}-slide-area`,children:de?kt(de.images):null})},`slide-in-${Oe}-${y}`)]})})}),i.jsxs("div",{className:`${e}-lightbox-overlay-content`,style:Kt,children:[i.jsx("div",{"data-controls":f?"contentMarginTop":void 0,className:f?`${e}-control`:void 0,style:{height:Dt,width:"100%"}}),i.jsx("div",{style:{display:"flex",flexDirection:"row",width:"100%",...p?{flex:1,minHeight:0}:{}},children:i.jsx("div",{className:`${e}-lightbox-content-area${p?` ${e}-lightbox-content-area-stacked`:""}`,children:Xt&&i.jsx("div",{className:`${e}-text-bar-cell${p?` ${e}-text-bar-cell-stacked`:""}`,style:p?void 0:{flex:1,minWidth:0,width:"100%"},children:p?E==="fade"?di():ui():E==="fade"?oi():ni()})})})]})]})]})},at=400,ct="cubic-bezier(0.25, 0.1, 0.25, 1)",xi=1.1;function pi(e){return`
|
|
2
2
|
.${e}-wrapper {
|
|
3
3
|
position: relative;
|
|
4
4
|
width: 100%;
|
|
@@ -43,23 +43,29 @@
|
|
|
43
43
|
max-width: 100%;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
+
@property --${e}-hover-zoom {
|
|
47
|
+
syntax: '<number>';
|
|
48
|
+
inherits: false;
|
|
49
|
+
initial-value: 1;
|
|
50
|
+
}
|
|
51
|
+
|
|
46
52
|
.${e}-hover-zoom-in .${e}-cover-image {
|
|
47
|
-
|
|
48
|
-
|
|
53
|
+
transform: scale(var(--${e}-hover-zoom));
|
|
54
|
+
clip-path: inset(calc(50% - 50% / var(--${e}-hover-zoom)));
|
|
55
|
+
transition: --${e}-hover-zoom ${at}ms ${ct};
|
|
49
56
|
}
|
|
50
57
|
|
|
51
58
|
.${e}-hover-scale-down .${e}-cover-image {
|
|
52
|
-
transition: transform ${
|
|
59
|
+
transition: transform ${at}ms ${ct};
|
|
53
60
|
}
|
|
54
61
|
|
|
55
62
|
.${e}-hover-greyscale .${e}-cover-image {
|
|
56
|
-
transition: filter ${
|
|
63
|
+
transition: filter ${at}ms ${ct};
|
|
57
64
|
}
|
|
58
65
|
|
|
59
66
|
@media (hover: hover) {
|
|
60
67
|
.${e}-hover-zoom-in .${e}-cover:hover .${e}-cover-image {
|
|
61
|
-
|
|
62
|
-
clip-path: inset(${pi});
|
|
68
|
+
--${e}-hover-zoom: ${xi};
|
|
63
69
|
}
|
|
64
70
|
.${e}-hover-scale-down .${e}-cover:hover .${e}-cover-image {
|
|
65
71
|
transform: scale(0.9);
|
|
@@ -546,4 +552,4 @@
|
|
|
546
552
|
pointer-events: auto;
|
|
547
553
|
z-index: 10;
|
|
548
554
|
}
|
|
549
|
-
`}const
|
|
555
|
+
`}const vi=({settings:e,content:z,isEditor:I,isEditMode:w,isPreviewMode:f,portalId:ee,metadata:U})=>{const{prefix:j}=hi.useScopedStyles(),k=(U==null?void 0:U.itemId)??null,{cover:V,coverFit:q,type:C,hover:te="none"}=e,_e=te!=="none"&&(!I||f)?` ${j}-hover-${te}`:"",De=o.useRef(null),[Ae,H]=o.useState(!1),[E,ie]=o.useState(0),re=o.useRef(!1),X=o.useRef(!1),R=o.useRef(!1),L=o.useMemo(()=>(z??[]).filter(b=>l.getEntryImages(b).length>0),[z]),pe=Ae&&L.length>0,$=!I,ze=o.useCallback(()=>{$&&(R.current=!0,l.removeJournalUrlParam(X.current,k),X.current=!1)},[$,k]),Ee=(b=0)=>{if(L.length===0||I&&!w&&!f)return;const M=l.buildJournalSlides(L,C),J=Math.max(0,Math.min(b,M.length-1));if(ie(J),$){const we=l.hasJournalUrlParam();l.setJournalUrlParam(J+1,k,we),X.current=!we}H(!0)},ve=o.useCallback(()=>{H(!1),R.current=!1},[]);return o.useEffect(()=>{!I||w||f||H(!1)},[I,w,f]),o.useEffect(()=>{if(!$||typeof window>"u")return;const b=window.history.scrollRestoration;return window.history.scrollRestoration="manual",()=>{window.history.scrollRestoration=b}},[$]),o.useEffect(()=>{if(!$||re.current)return;re.current=!0;const b=l.findJournalUrlSlideNumber(k);if(!b)return;const M=l.slideNumberToIndex(b,l.buildJournalSlides(L,C).length);M<0||(ie(M),H(!0))},[L,k,$,C]),o.useEffect(()=>{if(!$)return;const b=()=>{if(R.current){R.current=!1,H(!1);return}const M=l.findJournalUrlSlideNumber(k);if(!M){H(!1);return}const J=l.slideNumberToIndex(M,l.buildJournalSlides(L,C).length);if(J<0){H(!1);return}X.current=!1,ie(J),H(!0)};return window.addEventListener("popstate",b),()=>window.removeEventListener("popstate",b)},[L,k,$,C]),i.jsxs(i.Fragment,{children:[i.jsxs("div",{ref:De,className:`${j}-wrapper${_e}`,children:[i.jsx("style",{dangerouslySetInnerHTML:{__html:pi(j)}}),V?i.jsx("button",{type:"button",className:`${j}-cover ${G.isImageRatioCover(q)?`${j}-ratio-wrapper-cover`:`${j}-ratio-wrapper-fit`}`,onClick:()=>Ee(),style:{display:"block",padding:0,border:"none",background:"transparent",pointerEvents:I&&!w&&!f?"none":void 0,...G.isImageRatioCover(q)?{"--image-aspect-ratio":G.getAspectRatio(q)}:{}},"aria-label":"Open journal gallery",children:i.jsx("img",{className:`${j}-cover-image ${G.isImageRatioCover(q)?`${j}-cover-image-cover`:`${j}-cover-image-fit`}`,src:V,alt:"cover"})}):null]}),pe&&typeof document<"u"&&(()=>{const b=(ee?document.getElementById(ee):null)??document.body;return Lt.createPortal(i.jsx(gi,{prefix:j,entries:L,settings:e,isEditor:I,isEditMode:w,isPreviewMode:f,initialSlideIndex:E,enableUrlSync:$,journalItemId:k,onBeforeClose:ze,onClose:ve}),b)})()]})};exports.LightboxJournal=vi;
|