{"version":3,"file":"ImageCarousel.C6M1xtjV.mjs","names":["useState","useRef","useCallback"],"sources":["https:/framerusercontent.com/modules/0nlHvN1OrMmV4lauA3pf/F8MN3u9Ad1AmtrXtsUBJ/ImageCarousel.js"],"sourcesContent":["// Image carousel with arrow navigation to scroll between images\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,useCallback,useEffect,startTransition,useRef}from\"react\";import{addPropertyControls,ControlType}from\"framer\";import{motion}from\"framer-motion\";/**\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */export default function ImageCarousel(props){const{images=[{src:\"https://framerusercontent.com/images/GfGkADagM4KEibNcIiRUWlfrR0.jpg\",alt:\"Gradient 1 - Blue\"},{src:\"https://framerusercontent.com/images/aNsAT3jCvt4zglbWCUoFe33Q.jpg\",alt:\"Gradient 2 - Purple\"},{src:\"https://framerusercontent.com/images/BYnxEV1zjYb9bhWh1IwBZ1ZoS60.jpg\",alt:\"Gradient 3 - Orange\"}],startIndex=0,autoPlay,autoPlayInterval,showDots,showArrows,arrowColor,dotColor,activeDotColor,backgroundColor,borderRadius}=props;const[currentIndex,setCurrentIndex]=useState(startIndex);const[isDragging,setIsDragging]=useState(false);const containerRef=useRef(null);// Initialize carousel at startIndex without animation\nuseEffect(()=>{if(startIndex>=0&&startIndex<images.length){setCurrentIndex(startIndex);}},[startIndex,images.length]);const nextImage=useCallback(()=>{startTransition(()=>{setCurrentIndex(prev=>Math.min(prev+1,images.length-1));});},[images.length]);const prevImage=useCallback(()=>{startTransition(()=>{setCurrentIndex(prev=>Math.max(prev-1,0));});},[images.length]);const goToImage=useCallback(index=>{startTransition(()=>{setCurrentIndex(index);});},[]);const handleDragStart=useCallback(()=>{setIsDragging(true);},[]);const handleDragEnd=useCallback((event,info)=>{const dragThreshold=50;if(info.offset.x>dragThreshold&&currentIndex>0){prevImage();}else if(info.offset.x<-dragThreshold&&currentIndex<images.length-1){nextImage();}setIsDragging(false);},[currentIndex,images.length,nextImage,prevImage]);// Auto-play functionality\nuseEffect(()=>{if(!autoPlay||isDragging)return;const interval=setInterval(nextImage,autoPlayInterval*1e3);return()=>clearInterval(interval);},[autoPlay,autoPlayInterval,nextImage,isDragging]);// Keyboard navigation\nuseEffect(()=>{const handleKeyDown=event=>{if(event.key===\"ArrowLeft\"){event.preventDefault();prevImage();}else if(event.key===\"ArrowRight\"){event.preventDefault();nextImage();}};window.addEventListener(\"keydown\",handleKeyDown);return()=>window.removeEventListener(\"keydown\",handleKeyDown);},[nextImage,prevImage]);// Wheel/touchpad navigation\nuseEffect(()=>{const handleWheel=event=>{// Check if it's a horizontal scroll or if shift is held\nif(Math.abs(event.deltaX)>Math.abs(event.deltaY)||event.shiftKey){event.preventDefault();// Determine direction and scroll one image at a time\nconst delta=event.shiftKey?event.deltaY:event.deltaX;if(delta>20&&currentIndex<images.length-1){startTransition(()=>setCurrentIndex(currentIndex+1));}else if(delta<-20&&currentIndex>0){startTransition(()=>setCurrentIndex(currentIndex-1));}}};const container=containerRef.current;if(container){container.addEventListener(\"wheel\",handleWheel,{passive:false});return()=>{container.removeEventListener(\"wheel\",handleWheel);};}},[currentIndex,images.length]);if(images.length===0){return /*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",height:\"100%\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",backgroundColor,borderRadius,color:\"#666\"},children:\"No images to display\"});}return /*#__PURE__*/_jsxs(\"div\",{ref:containerRef,style:{position:\"relative\",width:\"100%\",height:\"100%\",backgroundColor,borderRadius,overflow:\"hidden\"},children:[/*#__PURE__*/_jsx(motion.div,{style:{position:\"absolute\",width:`${images.length*100}%`,height:\"100%\",display:\"flex\",willChange:\"transform\"},initial:false,animate:{x:`-${currentIndex*(100/images.length)}%`},transition:{type:\"spring\",stiffness:300,damping:30},drag:isDragging?false:\"x\",dragConstraints:{left:-((images.length-1)*(100/images.length))+\"%\",right:0},onDragStart:handleDragStart,onDragEnd:handleDragEnd,dragElastic:.2,children:images.map((image,index)=>/*#__PURE__*/_jsx(\"div\",{style:{width:`${100/images.length}%`,height:\"100%\",overflow:\"hidden\"},children:/*#__PURE__*/_jsx(\"img\",{src:image.src,alt:image.alt,style:{width:\"100%\",height:\"100%\",objectFit:\"cover\"}})},index))}),showArrows&&images.length>1&&currentIndex>0&&/*#__PURE__*/_jsx(\"button\",{onClick:prevImage,style:{position:\"absolute\",left:16,top:\"50%\",transform:\"translateY(-50%)\",background:\"rgba(0, 0, 0, 0.5)\",border:\"none\",borderRadius:\"50%\",width:40,height:40,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",cursor:\"pointer\",zIndex:2,transition:\"background-color 0.2s ease\"},onMouseEnter:e=>{e.currentTarget.style.background=\"rgba(0, 0, 0, 0.7)\";},onMouseLeave:e=>{e.currentTarget.style.background=\"rgba(0, 0, 0, 0.5)\";},children:/*#__PURE__*/_jsx(\"svg\",{width:\"16\",height:\"16\",viewBox:\"0 0 24 24\",fill:\"none\",stroke:arrowColor,strokeWidth:\"2\",strokeLinecap:\"round\",strokeLinejoin:\"round\",children:/*#__PURE__*/_jsx(\"polyline\",{points:\"15,18 9,12 15,6\"})})}),showArrows&&images.length>1&&currentIndex<images.length-1&&/*#__PURE__*/_jsx(\"button\",{onClick:nextImage,style:{position:\"absolute\",right:16,top:\"50%\",transform:\"translateY(-50%)\",background:\"rgba(0, 0, 0, 0.5)\",border:\"none\",borderRadius:\"50%\",width:40,height:40,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",cursor:\"pointer\",zIndex:2,transition:\"background-color 0.2s ease\"},onMouseEnter:e=>{e.currentTarget.style.background=\"rgba(0, 0, 0, 0.7)\";},onMouseLeave:e=>{e.currentTarget.style.background=\"rgba(0, 0, 0, 0.5)\";},children:/*#__PURE__*/_jsx(\"svg\",{width:\"16\",height:\"16\",viewBox:\"0 0 24 24\",fill:\"none\",stroke:arrowColor,strokeWidth:\"2\",strokeLinecap:\"round\",strokeLinejoin:\"round\",children:/*#__PURE__*/_jsx(\"polyline\",{points:\"9,18 15,12 9,6\"})})}),showDots&&images.length>1&&/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",bottom:16,left:\"50%\",transform:\"translateX(-50%)\",display:\"flex\",gap:8,zIndex:2},children:images.map((_,index)=>/*#__PURE__*/_jsx(\"button\",{onClick:()=>goToImage(index),style:{width:8,height:8,borderRadius:\"50%\",border:\"none\",backgroundColor:index===currentIndex?activeDotColor:dotColor,cursor:\"pointer\",transition:\"background-color 0.2s ease\"}},index))})]});}addPropertyControls(ImageCarousel,{images:{type:ControlType.Array,title:\"Images\",control:{type:ControlType.ResponsiveImage},defaultValue:[{src:\"https://framerusercontent.com/images/GfGkADagM4KEibNcIiRUWlfrR0.jpg\",alt:\"Gradient 1 - Blue\"},{src:\"https://framerusercontent.com/images/aNsAT3jCvt4zglbWCUoFe33Q.jpg\",alt:\"Gradient 2 - Purple\"},{src:\"https://framerusercontent.com/images/BYnxEV1zjYb9bhWh1IwBZ1ZoS60.jpg\",alt:\"Gradient 3 - Orange\"}],maxCount:10},startIndex:{type:ControlType.Number,title:\"Start Index\",defaultValue:0,min:0,max:9,step:1,displayStepper:true},showArrows:{type:ControlType.Boolean,title:\"Show Arrows\",defaultValue:true,enabledTitle:\"Show\",disabledTitle:\"Hide\"},arrowColor:{type:ControlType.Color,title:\"Arrow Color\",defaultValue:\"#FFFFFF\",hidden:({showArrows})=>!showArrows},showDots:{type:ControlType.Boolean,title:\"Show Dots\",defaultValue:true,enabledTitle:\"Show\",disabledTitle:\"Hide\"},dotColor:{type:ControlType.Color,title:\"Dot Color\",defaultValue:\"#CCCCCC\",hidden:({showDots})=>!showDots},activeDotColor:{type:ControlType.Color,title:\"Active Dot Color\",defaultValue:\"#FFFFFF\",hidden:({showDots})=>!showDots},autoPlay:{type:ControlType.Boolean,title:\"Auto Play\",defaultValue:false,enabledTitle:\"On\",disabledTitle:\"Off\"},autoPlayInterval:{type:ControlType.Number,title:\"Auto Play Interval\",defaultValue:3,min:1,max:10,step:.5,unit:\"s\",hidden:({autoPlay})=>!autoPlay},backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"#000000\"},borderRadius:{type:ControlType.Number,title:\"Border Radius\",defaultValue:8,min:0,max:32,step:1,unit:\"px\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ImageCarousel\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"fixed\",\"framerSupportedLayoutWidth\":\"fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ImageCarousel.map"],"mappings":"gaAIG,SAAwB,EAAc,EAAM,CAAC,GAAK,CAAC,SAAO,CAAC,CAAC,IAAI,sEAAsE,IAAI,oBAAoB,CAAC,CAAC,IAAI,oEAAoE,IAAI,sBAAsB,CAAC,CAAC,IAAI,uEAAuE,IAAI,sBAAsB,CAAC,CAAC,aAAW,EAAE,WAAS,mBAAiB,WAAS,aAAW,aAAW,WAAS,iBAAe,kBAAgB,gBAAc,EAAW,CAAC,EAAa,GAAiBA,EAAS,EAAW,CAAM,CAAC,EAAW,GAAeA,EAAS,GAAM,CAAO,EAAaC,EAAO,KAAK,CACxnB,MAAc,CAAI,GAAY,GAAG,EAAW,EAAO,QAAQ,EAAgB,EAAW,EAAI,CAAC,EAAW,EAAO,OAAO,CAAC,CAAC,IAAM,EAAUC,MAAgB,CAAC,MAAoB,CAAC,EAAgB,GAAM,KAAK,IAAI,EAAK,EAAE,EAAO,OAAO,EAAE,CAAC,EAAG,EAAG,CAAC,EAAO,OAAO,CAAC,CAAO,EAAUA,MAAgB,CAAC,MAAoB,CAAC,EAAgB,GAAM,KAAK,IAAI,EAAK,EAAE,EAAE,CAAC,EAAG,EAAG,CAAC,EAAO,OAAO,CAAC,CAAO,EAAUA,EAAY,GAAO,CAAC,MAAoB,CAAC,EAAgB,EAAM,EAAG,EAAG,EAAE,CAAC,CAAO,EAAgBA,MAAgB,C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