{"version":3,"file":"Carousel_Safe.DFF8aKBF.mjs","names":["useRef","useState","scrollLeft","e","React"],"sources":["https:/framerusercontent.com/modules/FZ7eJtIn20Ca7pkMI0OD/sgwYhaDNIiw3KRjc98Dm/Carousel_Safe.js"],"sourcesContent":["// Carousel component that prevents hydration errors by using useEffect for client-side initialization\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import React,{useState,useEffect,useRef}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * Carousel component that displays children in a scrollable row with navigation arrows\n * Prevents hydration errors by initializing scroll state on client-side only\n * Use Slot control to attach children from Framer Stack components\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight auto\n */export default function Carousel_Safe(props){const{imageUrls=[],children=[],itemWidth=200,itemHeight=200,gap=16,showArrows=true,arrowColor=\"#000000\",arrowSize=24,backgroundColor=\"#F5F5F5\",borderRadius=8,padding=16}=props;const scrollContainerRef=useRef(null);const[canScrollLeft,setCanScrollLeft]=useState(false);const[canScrollRight,setCanScrollRight]=useState(false);const[isClient,setIsClient]=useState(false);// Touch/swipe state\nconst touchStartRef=useRef(null);const isHorizontalSwipeRef=useRef(false);const updateScrollButtons=()=>{if(!scrollContainerRef.current||!isClient)return;const container=scrollContainerRef.current;const scrollLeft=container.scrollLeft;const scrollWidth=container.scrollWidth;const clientWidth=container.clientWidth;// Can scroll left if we're not at the beginning\nsetCanScrollLeft(scrollLeft>0);// Can scroll right if there's more content to scroll\nsetCanScrollRight(scrollLeft<scrollWidth-clientWidth-1);};// Initialize client-side state to prevent hydration errors\nuseEffect(()=>{setIsClient(true);},[]);// Update scroll buttons when client-side state changes\nuseEffect(()=>{if(isClient){// Small delay to ensure DOM is updated\nconst timeoutId=setTimeout(()=>{updateScrollButtons();},100);return()=>clearTimeout(timeoutId);}return undefined;},[isClient,imageUrls,itemWidth,gap]);// Add resize observer to handle container size changes\nuseEffect(()=>{if(!isClient||!scrollContainerRef.current)return;const resizeObserver=new ResizeObserver(()=>{updateScrollButtons();});resizeObserver.observe(scrollContainerRef.current);return()=>{resizeObserver.disconnect();};},[isClient]);const scrollLeft=()=>{if(!scrollContainerRef.current)return;const scrollAmount=itemWidth+gap;scrollContainerRef.current.scrollBy({left:-scrollAmount,behavior:\"smooth\"});};const scrollRight=()=>{if(!scrollContainerRef.current)return;const scrollAmount=itemWidth+gap;scrollContainerRef.current.scrollBy({left:scrollAmount,behavior:\"smooth\"});};const handleScroll=()=>{updateScrollButtons();};// Touch event handlers for swipe functionality\nconst handleTouchStart=e=>{if(!scrollContainerRef.current)return;const touch=e.targetTouches[0];touchStartRef.current={x:touch.clientX,y:touch.clientY};isHorizontalSwipeRef.current=false;};const handleTouchMove=e=>{if(!touchStartRef.current||!scrollContainerRef.current)return;const touch=e.targetTouches[0];const deltaX=Math.abs(touch.clientX-touchStartRef.current.x);const deltaY=Math.abs(touch.clientY-touchStartRef.current.y);// Determine if this is a horizontal or vertical swipe\nif(deltaX>15&&deltaX>deltaY*2){// Horizontal swipe detected\nisHorizontalSwipeRef.current=true;// Don't preventDefault - let native scrolling work smoothly\n}else if(deltaY>15&&deltaY>deltaX*2){// Vertical swipe - release control immediately\ntouchStartRef.current=null;isHorizontalSwipeRef.current=false;}};const handleTouchEnd=()=>{// Let CSS scroll-snap handle the snapping naturally\n// This avoids conflicts with native scrolling\ntouchStartRef.current=null;isHorizontalSwipeRef.current=false;};const renderImage=imageSrc=>{return /*#__PURE__*/_jsx(\"img\",{src:imageSrc,alt:\"\",style:{width:`${itemWidth}px`,...itemHeight?{height:`${itemHeight}px`}:{},flexShrink:0,scrollSnapAlign:\"center\"}});};const renderChild=child=>{return /*#__PURE__*/_jsx(\"div\",{style:{width:`${itemWidth}px`,...itemHeight?{height:`${itemHeight}px`}:{},flexShrink:0,scrollSnapAlign:\"center\"},children:child});};// later where you render children:\nconst childArray=React.Children.toArray(children);// Only show arrows if client-side and arrows are enabled\nconst shouldShowArrows=isClient&&showArrows;return /*#__PURE__*/_jsxs(\"div\",{style:{position:\"relative\",width:\"100%\",...itemHeight?{height:`${itemHeight}px`}:{},...backgroundColor?{backgroundColor}:{},borderRadius,padding,overflow:\"hidden\"},children:[shouldShowArrows&&canScrollLeft&&/*#__PURE__*/_jsx(\"button\",{type:\"button\",\"aria-label\":\"Scroll Left\",onClick:scrollLeft,style:{cursor:\"pointer\",pointerEvents:\"auto\",width:\"40px\",height:\"40px\",aspectRatio:\"auto 40 / 40\",boxSizing:\"border-box\",background:\"none\",border:\"none\",position:\"absolute\",left:\"20px\",top:\"50%\",transform:\"translateY(-50%)\",zIndex:2},children:/*#__PURE__*/_jsx(\"img\",{decoding:\"async\",alt:\"\",width:\"40\",height:\"40\",src:\"https://framerusercontent.com/images/6tTbkXggWgQCAJ4DO2QEdXXmgM.svg\",style:{boxSizing:\"border-box\",WebkitFontSmoothing:\"inherit\",border:\"none\",display:\"block\",placeContent:\"center\",placeItems:\"center\",overflow:\"hidden\",background:\"rgba(0, 0, 0, 0.2)\",margin:\"0px\",padding:\"0px\",width:\"40px\",height:\"40px\",borderRadius:\"40px\",cursor:\"pointer\",opacity:1,pointerEvents:\"auto\",transform:\"none\"}})}),shouldShowArrows&&canScrollRight&&/*#__PURE__*/_jsx(\"button\",{type:\"button\",\"aria-label\":\"Scroll Right\",onClick:scrollRight,style:{cursor:\"pointer\",pointerEvents:\"auto\",width:\"40px\",height:\"40px\",aspectRatio:\"auto 40 / 40\",boxSizing:\"border-box\",background:\"none\",border:\"none\",position:\"absolute\",right:\"20px\",top:\"50%\",transform:\"translateY(-50%)\",zIndex:2},children:/*#__PURE__*/_jsx(\"img\",{decoding:\"async\",alt:\"\",width:\"40\",height:\"40\",src:\"https://framerusercontent.com/images/11KSGbIZoRSg4pjdnUoif6MKHI.svg\",style:{boxSizing:\"border-box\",WebkitFontSmoothing:\"inherit\",border:\"none\",display:\"block\",placeContent:\"center\",placeItems:\"center\",overflow:\"hidden\",background:\"rgba(0, 0, 0, 0.2)\",margin:\"0px\",padding:\"0px\",width:\"40px\",height:\"40px\",borderRadius:\"40px\",cursor:\"pointer\",opacity:1,pointerEvents:\"auto\",transform:\"none\"}})}),/*#__PURE__*/_jsxs(\"div\",{ref:scrollContainerRef,onScroll:handleScroll,onTouchStart:handleTouchStart,onTouchMove:handleTouchMove,onTouchEnd:handleTouchEnd,style:{display:\"flex\",gap,overflowX:\"auto\",overflowY:\"hidden\",scrollbarWidth:\"none\",msOverflowStyle:\"none\",touchAction:\"pan-x pan-y\",overscrollBehavior:\"contain auto\",scrollBehavior:\"smooth\",WebkitOverflowScrolling:\"touch\",scrollSnapType:\"x mandatory\"},className:\"hide-scrollbar\",children:[imageUrls.map(imageSrc=>renderImage(imageSrc)),childArray.map(child=>renderChild(child))]})]});}addPropertyControls(Carousel_Safe,{children:{type:ControlType.Array,control:{type:ControlType.ComponentInstance},title:\"Child Items\",maxCount:20},imageUrls:{type:ControlType.Array,title:\"Image URLs\",maxCount:20},itemWidth:{type:ControlType.Number,title:\"Item Width\",defaultValue:350,min:100,max:900,step:10,unit:\"px\"},itemHeight:{type:ControlType.Number,title:\"Item Height\",defaultValue:450,min:100,max:1e3,step:10,unit:\"px\"},gap:{type:ControlType.Number,title:\"Gap\",defaultValue:16,min:0,max:40,step:4,unit:\"px\"},showArrows:{type:ControlType.Boolean,title:\"Show Arrows\",defaultValue:true,enabledTitle:\"Show\",disabledTitle:\"Hide\"},arrowColor:{type:ControlType.Color,title:\"Arrow Color\",defaultValue:\"#000000\",hidden:({showArrows})=>!showArrows},arrowSize:{type:ControlType.Number,title:\"Arrow Size\",defaultValue:24,min:16,max:40,step:2,unit:\"px\",hidden:({showArrows})=>!showArrows},backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"#F5F5F5\"},borderRadius:{type:ControlType.Number,title:\"Border Radius\",defaultValue:8,min:0,max:24,step:1,unit:\"px\"},padding:{type:ControlType.Number,title:\"Padding\",defaultValue:16,min:0,max:40,step:4,unit:\"px\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"Carousel_Safe\",\"slots\":[\"children\"],\"annotations\":{\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerSupportedLayoutHeight\":\"auto\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Carousel_Safe.map"],"mappings":"sMAQG,SAAwB,EAAc,EAAM,CAAC,GAAK,CAAC,YAAU,EAAE,CAAC,WAAS,EAAE,CAAC,YAAU,IAAI,aAAW,IAAI,MAAI,GAAG,aAAW,GAAK,aAAW,UAAU,YAAU,GAAG,kBAAgB,UAAU,eAAa,EAAE,UAAQ,IAAI,EAAY,EAAmBA,EAAO,KAAK,CAAM,CAAC,EAAc,GAAkBC,EAAS,GAAM,CAAM,CAAC,EAAe,GAAmBA,EAAS,GAAM,CAAM,CAAC,EAAS,GAAaA,EAAS,GAAM,CACzZ,EAAcD,EAAO,KAAK,CAAO,EAAqBA,EAAO,GAAM,CAAO,MAAwB,CAAC,GAAG,CAAC,EAAmB,SAAS,CAAC,EAAS,OAAO,IAAM,EAAU,EAAmB,QAAcE,EAAW,EAAU,WAAiB,EAAY,EAAU,YAAkB,EAAY,EAAU,YAC/S,EAAiBA,EAAW,EAAE,CAC9B,EAAkBA,EAAW,EAAY,EAAY,EAAE,EACvD,MAAc,CAAC,EAAY,GAAK,EAAG,EAAE,CAAC,CACtC,MAAc,CAAC,GAAG,EAAS,CAC3B,IAAM,EAAU,eAAe,CAAC,GAAqB,EAAG,IAAI,CAAC,UAAU,aAAa,EAAU,GAAqB,CAAC,EAAS,EAAU,EAAU,EAAI,CAAC,CACtJ,MAAc,CAAC,GAAG,CAAC,GAAU,CAAC,EAAmB,QAAQ,OAAO,IAAM,EAAe,IAAI,mBAAmB,CAAC,GAAqB,EAAG,CAAoD,OAAnD,EAAe,QAAQ,EAAmB,QAAQ,KAAW,CAAC,EAAe,YAAY,GAAK,CAAC,EAAS,CAAC,CAA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