{"version":3,"file":"VerticalScrollImage.CmJOvzZ7.mjs","names":["useRef","useState"],"sources":["https:/framerusercontent.com/modules/GzzIFmMNtcCVHj5ubMxm/kkxnl8TbqOsLf5gUJd6K/VerticalScrollImage.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useState,useRef,useEffect}from\"react\";/**\n * Image Vertical Scroller\n * A component that allows an image to scroll vertically within a container.\n * \n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */export default function VerticalScrollImage(props){const{image={src:\"https://framerusercontent.com/images/GfGkADagM4KEibNcIiRUWlfrR0.jpg\",alt:\"Gradient 1 - Blue\"},scrollSpeed=30,autoScroll=true,reverseDirection=false,pauseOnHover=true,showScrollbar=false,borderRadius=0,border={borderWidth:0,borderStyle:\"solid\",borderColor:\"#000000\"}}=props;const containerRef=useRef(null);const[isPaused,setIsPaused]=useState(false);const[containerHeight,setContainerHeight]=useState(0);const[imageHeight,setImageHeight]=useState(0);const[scrollPosition,setScrollPosition]=useState(0);// Get container dimensions\nuseEffect(()=>{if(containerRef.current){setContainerHeight(containerRef.current.clientHeight);}},[]);// Handle image load to get image dimensions\nconst handleImageLoad=e=>{setImageHeight(e.target.naturalHeight);};// Auto-scroll effect\nuseEffect(()=>{if(!autoScroll||isPaused||containerHeight===0||imageHeight===0||imageHeight<=containerHeight){return;}const maxScroll=imageHeight-containerHeight;const direction=reverseDirection?-1:1;const scrollAmount=direction*(scrollSpeed/100);const interval=setInterval(()=>{setScrollPosition(prevPos=>{let newPos=prevPos+scrollAmount;// Reset when we reach the end\nif(newPos>maxScroll)newPos=0;if(newPos<0)newPos=maxScroll;if(containerRef.current){containerRef.current.scrollTop=newPos;}return newPos;});},50);return()=>clearInterval(interval);},[autoScroll,isPaused,containerHeight,imageHeight,scrollSpeed,reverseDirection]);return /*#__PURE__*/_jsx(\"div\",{ref:containerRef,style:{position:\"relative\",width:\"100%\",height:\"100%\",overflow:\"hidden\",overflowY:showScrollbar?\"auto\":\"hidden\",scrollBehavior:\"smooth\",borderRadius:`${borderRadius}px`,borderWidth:border.borderWidth,borderStyle:border.borderStyle,borderColor:border.borderColor},onMouseEnter:()=>pauseOnHover&&setIsPaused(true),onMouseLeave:()=>pauseOnHover&&setIsPaused(false),children:/*#__PURE__*/_jsx(\"img\",{src:image.src,alt:image.alt||\"Scrolling image\",style:{width:\"100%\",objectFit:\"cover\",display:\"block\"},onLoad:handleImageLoad})});}addPropertyControls(VerticalScrollImage,{image:{type:ControlType.ResponsiveImage,title:\"Image\"},borderRadius:{type:ControlType.Number,title:\"Border Radius\",defaultValue:0,min:0,max:100,step:1},autoScroll:{type:ControlType.Boolean,title:\"Auto Scroll\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\"},scrollSpeed:{type:ControlType.Number,title:\"Scroll Speed\",defaultValue:30,min:1,max:100,step:1,displayStepper:true,hidden:({autoScroll})=>!autoScroll},reverseDirection:{type:ControlType.Boolean,title:\"Direction\",defaultValue:false,enabledTitle:\"Up\",disabledTitle:\"Down\",hidden:({autoScroll})=>!autoScroll},pauseOnHover:{type:ControlType.Boolean,title:\"Pause on Hover\",defaultValue:true,enabledTitle:\"Yes\",disabledTitle:\"No\",hidden:({autoScroll})=>!autoScroll},showScrollbar:{type:ControlType.Boolean,title:\"Scrollbar\",defaultValue:false,enabledTitle:\"Show\",disabledTitle:\"Hide\"},border:{type:ControlType.Border,title:\"Border\",defaultValue:{borderWidth:0,borderStyle:\"solid\",borderColor:\"#000000\"}}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"VerticalScrollImage\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"fixed\",\"framerSupportedLayoutWidth\":\"fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./VerticalScrollImage.map"],"mappings":"wLAMG,SAAwB,EAAoB,EAA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