{"version":3,"file":"ProjectSlideshow.P8ceYNFK.mjs","names":["React.useRef","React.useState","React.useCallback","__esmMin","init_npm_react_18_3_1","ne","init_ssg_sandbox_shims","window","_e","p","c","init_jsx_runtime","ce","de","init_framer_BpuvUAiZ","addPropertyControls","ControlType","ProjectSlideshow","props","slides","images","image","count","rootRef","touch","index","setIndex","hovered","setHovered","linkSize","setLinkSize","box","setBox","viewH","setViewH","ratios","setRatios","COUNTER_H","showCounter","alive","probe","current","src","el","update","w","observer","go","step","onKey","event","stageH","ratio","byWidth","limit","fillHeight","maxHeightVh","currentH","tallest","totalH","onClick","rect","pad","n","arrow","stroke","side","arrowSize","h","d","arrowPadding","style","start","t","dx","dy","i","fadeDuration","captions","init_ProjectSlideshow"],"sources":["https:/framerusercontent.com/modules/fdudHlsoLwNQjp4wYMiz/4bGHJaqT4DY3X0cI8DhB/ProjectSlideshow.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * One image at a time, always aligned to the top. The counter sits a fixed distance under the picture\n * (10px), so when the screen gets narrower everything just stretches down from the same top line.\n * Arrows, click on the left / right half, keyboard arrows and swipe move through the slides.\n *\n * fillHeight on: fills the height it is given (desktop, picture never taller than the space).\n * fillHeight off: its height follows the pictures (tablet, phone, one column).\n *\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n */export default function ProjectSlideshow(props){const{images=[],captions=[],fadeDuration=.3,arrowSize=18,arrowPadding=20,showCounter=true,fillHeight=true,maxHeightVh=75,background=\"transparent\",style}=props;const slides=images.map(image=>typeof image===\"string\"?image:image?.src||\"\").filter(Boolean);const count=slides.length;const rootRef=React.useRef(null);const touch=React.useRef(null);const[index,setIndex]=React.useState(0);const[hovered,setHovered]=React.useState(null);const[linkSize,setLinkSize]=React.useState(24);const[box,setBox]=React.useState({w:0,h:0});const[viewH,setViewH]=React.useState(800);const[ratios,setRatios]=React.useState({});const GAP=10// distance between the picture and the counter\n;const COUNTER_H=showCounter?16:0;React.useEffect(()=>{if(index>=count)setIndex(0);},[count,index]);// natural proportions of every picture, so the layout is known before a slide is shown\nReact.useEffect(()=>{let alive=true;slides.forEach(src=>{const probe=new Image;probe.onload=()=>{if(alive&&probe.naturalWidth&&probe.naturalHeight)setRatios(current=>current[src]?current:{...current,[src]:probe.naturalWidth/probe.naturalHeight});};probe.src=src;});return()=>{alive=false;};},[slides.join(\"|\")]);// size of the box we live in\nReact.useEffect(()=>{const el=rootRef.current;if(!el)return;const update=()=>{setBox({w:el.clientWidth,h:el.clientHeight});setViewH(window.innerHeight);const w=window.innerWidth;setLinkSize(w>=1600?30:w>=1200?24:w>=640?22:18);};update();const observer=new ResizeObserver(update);observer.observe(el);window.addEventListener(\"resize\",update);return()=>{observer.disconnect();window.removeEventListener(\"resize\",update);};},[]);const go=React.useCallback(step=>{if(count<=1)return;setIndex(current=>(current+step+count)%count);},[count]);React.useEffect(()=>{const onKey=event=>{if(event.key===\"ArrowRight\")go(1);if(event.key===\"ArrowLeft\")go(-1);};window.addEventListener(\"keydown\",onKey);return()=>window.removeEventListener(\"keydown\",onKey);},[go]);// height of a picture shown as wide as the box allows, never taller than the space (or 75% of the screen)\nconst heightOf=src=>{const ratio=ratios[src]||1.5;const byWidth=box.w>0?box.w/ratio:0;const limit=fillHeight&&box.h>0?box.h-GAP-COUNTER_H:viewH*maxHeightVh/100;return Math.max(0,Math.min(byWidth,limit));};// the frame is as tall as the first picture; every other picture fits inside it, so the counter never moves\nconst stageH=slides[0]?heightOf(slides[0]):0;const currentH=stageH;const tallest=stageH;const totalH=stageH+(showCounter?GAP+COUNTER_H:0);const onClick=event=>{const rect=event.currentTarget.getBoundingClientRect();go(event.clientX-rect.left<rect.width/2?-1:1);};const pad=n=>String(n).padStart(2,\"0\");const arrow=side=>{// same line as the underlines: 0.068em at rest, 0.1em on hover, em = the link text size of the breakpoint (30 / 24 / 22 / 18), the size of the navigation links and the email\nconst stroke=(hovered===side?.1:.068)*linkSize;const w=arrowSize*.7;const h=arrowSize*1.4;const d=side===\"left\"?\"M \"+w+\" 0 L 0 \"+h/2+\" L \"+w+\" \"+h:\"M 0 0 L \"+w+\" \"+h/2+\" L 0 \"+h;return /*#__PURE__*/_jsx(\"button\",{onClick:event=>{event.stopPropagation();go(side===\"left\"?-1:1);},onMouseEnter:()=>setHovered(side),onMouseLeave:()=>setHovered(null),\"aria-label\":side===\"left\"?\"Previous image\":\"Next image\",style:{position:\"absolute\",top:0,bottom:0,[side]:0,width:arrowSize+arrowPadding*2,padding:0,border:\"none\",background:\"transparent\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",cursor:\"pointer\",zIndex:10},children:/*#__PURE__*/_jsx(\"svg\",{width:w,height:h,viewBox:\"0 0 \"+w+\" \"+h,style:{overflow:\"visible\",display:\"block\"},children:/*#__PURE__*/_jsx(\"path\",{d:d,fill:\"none\",stroke:\"#211F1F\",strokeWidth:stroke,strokeLinecap:\"butt\",strokeLinejoin:\"miter\",style:{transition:\"stroke-width 0.15s ease\"}})})});};return /*#__PURE__*/_jsxs(\"div\",{ref:rootRef,style:{...style,position:\"relative\",width:\"100%\",height:fillHeight?style?.height??\"100%\":totalH,background,overflow:\"hidden\"},children:[/*#__PURE__*/_jsxs(\"div\",{onTouchStart:event=>{const t=event.touches[0];touch.current={x:t.clientX,y:t.clientY};},onTouchEnd:event=>{const start=touch.current;touch.current=null;if(!start)return;const t=event.changedTouches[0];const dx=t.clientX-start.x;const dy=t.clientY-start.y;if(Math.abs(dx)>40&&Math.abs(dx)>Math.abs(dy))go(dx<0?1:-1);},style:{position:\"absolute\",top:0,left:0,width:\"100%\",height:currentH,touchAction:\"pan-y\"},children:[slides.map((src,i)=>/*#__PURE__*/_jsx(\"img\",{src:src,alt:\"Slide \"+(i+1)+\" of \"+count,draggable:false,style:{position:\"absolute\",inset:0,width:\"100%\",height:\"100%\",objectFit:\"contain\",objectPosition:\"center top\",opacity:i===index?1:0,transition:\"opacity \"+fadeDuration+\"s ease\",pointerEvents:\"none\",userSelect:\"none\"}},src+i)),count>1&&/*#__PURE__*/_jsx(\"div\",{onClick:onClick,style:{position:\"absolute\",inset:0,zIndex:5,cursor:\"pointer\"}}),count>1&&arrow(\"left\"),count>1&&arrow(\"right\")]}),showCounter&&count>0&&/*#__PURE__*/_jsxs(\"div\",{\"aria-live\":\"polite\",style:{position:\"absolute\",left:0,top:tallest+GAP,fontFamily:'\"Be Vietnam Pro\", sans-serif',fontWeight:400,fontSize:12,letterSpacing:\"-0.05em\",lineHeight:\"1.15em\",color:\"#211F1F\",fontVariantNumeric:\"tabular-nums\"},children:[pad(index+1),\" / \",pad(count),captions[index]?\"   \"+captions[index]:\"\"]})]});}ProjectSlideshow.defaultProps={images:[],captions:[],fadeDuration:.3,arrowSize:18,arrowPadding:20,showCounter:true,fillHeight:true,maxHeightVh:75,background:\"transparent\"};addPropertyControls(ProjectSlideshow,{images:{type:ControlType.Array,title:\"Images\",control:{type:ControlType.Image},maxCount:50},captions:{type:ControlType.Array,title:\"Captions\",control:{type:ControlType.String},maxCount:50},fillHeight:{type:ControlType.Boolean,title:\"Fill height\",defaultValue:true},maxHeightVh:{type:ControlType.Number,title:\"Max height\",min:30,max:100,step:1,defaultValue:75,unit:\"vh\",hidden:props=>props.fillHeight},fadeDuration:{type:ControlType.Number,title:\"Fade\",min:0,max:2,step:.1,defaultValue:.3,unit:\"s\"},arrowSize:{type:ControlType.Number,title:\"Arrow size\",min:8,max:60,step:1,defaultValue:18,unit:\"px\"},arrowPadding:{type:ControlType.Number,title:\"Arrow padding\",min:0,max:80,step:1,defaultValue:20,unit:\"px\"},showCounter:{type:ControlType.Boolean,title:\"Counter\",defaultValue:true},background:{type:ControlType.Color,title:\"Background\",defaultValue:\"transparent\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ProjectSlideshow\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLay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