{"version":3,"file":"PhotoSlideshow.fNHMeEV5.mjs","names":["useState","useRef","useCallback","_Fragment"],"sources":["https:/framerusercontent.com/modules/GBPQSr6joH5Qw3LJCbRt/nuI3EcRZFKiVq5KE3x3w/PhotoSlideshow.js"],"sourcesContent":["// Click-through single-image gallery: click the photo (or use arrows) to advance one image at a time, instead of stacking every photo in a long scroll — modeled on editorial photo-story viewers like nadialeecohen.com\nimport{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import{useState,useRef,useCallback,startTransition}from\"react\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";import{motion,AnimatePresence}from\"framer-motion\";/**\n * Photo Slideshow\n *\n * Click-through gallery — click the image, or use the arrows, to advance to the next photo one at a time.\n *\n * @framerIntrinsicWidth 900\n * @framerIntrinsicHeight 700\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function PhotoSlideshow(props){const{images=[{src:\"https://framerusercontent.com/images/GfGkADagM4KEibNcIiRUWlfrR0.jpg\",alt:\"Photo 1\"},{src:\"https://framerusercontent.com/images/aNsAT3jCvt4zglbWCUoFe33Q.jpg\",alt:\"Photo 2\"},{src:\"https://framerusercontent.com/images/BYnxEV1zjYb9bhWh1IwBZ1ZoS60.jpg\",alt:\"Photo 3\"}],objectFit=\"cover\",backgroundColor=\"#F5F5F5\",showArrows=true,showCounter=true,counterColor=\"#FFFFFF\",counterFont,style}=props;const[index,setIndex]=useState(0);const touchStartX=useRef(null);const didSwipe=useRef(false);const count=images.length;const isStatic=RenderTarget.current()===RenderTarget.thumbnail;const swipeThreshold=50;const goNext=useCallback(e=>{e?.stopPropagation?.();if(count<2)return;startTransition(()=>setIndex(i=>(i+1)%count));},[count]);const goPrev=useCallback(e=>{e?.stopPropagation?.();if(count<2)return;startTransition(()=>setIndex(i=>(i-1+count)%count));},[count]);const handleTouchStart=useCallback(e=>{touchStartX.current=e.touches[0]?.clientX??null;didSwipe.current=false;},[]);const handleTouchEnd=useCallback(e=>{const startX=touchStartX.current;const endX=e.changedTouches[0]?.clientX;touchStartX.current=null;if(startX==null||endX==null)return;const deltaX=endX-startX;if(deltaX<=-swipeThreshold){didSwipe.current=true;goNext();return;}if(deltaX>=swipeThreshold){didSwipe.current=true;goPrev();}},[goNext,goPrev]);const handleContainerClick=useCallback(()=>{if(didSwipe.current){didSwipe.current=false;return;}goNext();},[goNext]);if(!count)return null;const current=images[Math.min(index,count-1)];return /*#__PURE__*/_jsxs(\"div\",{style:{...style,position:\"relative\",width:style?.width??\"100%\",height:style?.height??\"100%\",overflow:\"hidden\",backgroundColor,cursor:count>1?\"pointer\":\"default\"},onClick:handleContainerClick,onTouchStart:handleTouchStart,onTouchEnd:handleTouchEnd,role:\"button\",\"aria-label\":\"Show next photo\",children:[/*#__PURE__*/_jsx(AnimatePresence,{initial:false,mode:\"wait\",children:/*#__PURE__*/_jsx(motion.img,{src:current.src,srcSet:current.srcSet,alt:current.alt||\"\",initial:isStatic?false:{opacity:0},animate:{opacity:1},exit:isStatic?undefined:{opacity:0},transition:{duration:.35,ease:\"easeInOut\"},style:{position:\"absolute\",inset:0,width:\"100%\",height:\"100%\",objectFit,userSelect:\"none\",pointerEvents:\"none\"},draggable:false},isStatic?\"static\":index)}),showArrows&&count>1&&/*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(\"button\",{onClick:goPrev,\"aria-label\":\"Previous photo\",style:arrowStyle(\"left\"),children:\"←\"}),/*#__PURE__*/_jsx(\"button\",{onClick:goNext,\"aria-label\":\"Next photo\",style:arrowStyle(\"right\"),children:\"→\"})]}),showCounter&&count>1&&/*#__PURE__*/_jsxs(\"div\",{style:{position:\"absolute\",bottom:16,right:20,color:counterColor,pointerEvents:\"none\",...counterFont},children:[String(index+1).padStart(2,\"0\"),\" / \",String(count).padStart(2,\"0\")]})]});}function arrowStyle(side){return{position:\"absolute\",top:\"50%\",[side]:16,transform:\"translateY(-50%)\",width:40,height:40,borderRadius:\"50%\",border:\"none\",background:\"rgba(0,0,0,0.35)\",color:\"#fff\",fontSize:18,cursor:\"pointer\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\"};}addPropertyControls(PhotoSlideshow,{images:{type:ControlType.Array,title:\"Photos\",control:{type:ControlType.ResponsiveImage},defaultValue:[{src:\"https://framerusercontent.com/images/GfGkADagM4KEibNcIiRUWlfrR0.jpg\",alt:\"Photo 1\"},{src:\"https://framerusercontent.com/images/aNsAT3jCvt4zglbWCUoFe33Q.jpg\",alt:\"Photo 2\"},{src:\"https://framerusercontent.com/images/BYnxEV1zjYb9bhWh1IwBZ1ZoS60.jpg\",alt:\"Photo 3\"}]},objectFit:{type:ControlType.Enum,title:\"Fit\",options:[\"cover\",\"contain\"],optionTitles:[\"Cover\",\"Contain\"],defaultValue:\"cover\"},backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"#F5F5F5\"},showArrows:{type:ControlType.Boolean,title:\"Arrows\",defaultValue:true},showCounter:{type:ControlType.Boolean,title:\"Counter\",defaultValue:true},counterColor:{type:ControlType.Color,title:\"Counter Color\",defaultValue:\"#FFFFFF\"},counterFont:{type:ControlType.Font,title:\"Counter Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"13px\",variant:\"Medium\",letterSpacing:\"0.02em\",lineHeight:\"1em\"}}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"PhotoSlideshow\",\"slots\":[],\"annotations\":{\"framerIntrinsicHeight\":\"700\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerIntrinsicWidth\":\"900\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./PhotoSlideshow.map"],"mappings":"4QAWG,SAAwB,EAAe,EAAM,CAAC,GAAK,CAAC,SAAO,CAAC,CAAC,IAAI,sEAAsE,IAA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