{"version":3,"file":"StackingSlider.ehEqWvyW.mjs","names":["Children","useState","useRef"],"sources":["https:/framerusercontent.com/modules/w2fXh0nn86UsYq57E9Kp/xTgBD50I2p64s9B74CJ9/StackingSlider.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";import{motion}from\"framer-motion\";import{Children,useState,useRef,useEffect,useMemo}from\"react\";export default function InfiniteSlider(props){const{children,cardGap=20,arrowSize=40,arrowColor=\"#000000\",arrowBackgroundColor=\"#FFFFFF\",arrowGap=20,transitionDuration=.4}=props;const childrenArray=Children.toArray(children);const[currentIndex,setCurrentIndex]=useState(0);const[cardWidth,setCardWidth]=useState(0);const cardRef=useRef(null);// We only need a small buffer for arrow-based infinite scrolling\nconst displayArray=useMemo(()=>{if(childrenArray.length===0)return[];// Repeat the array to allow for smooth looping transitions\nreturn[...childrenArray,...childrenArray,...childrenArray];},[childrenArray]);useEffect(()=>{const updateWidth=()=>{if(cardRef.current){setCardWidth(cardRef.current.offsetWidth);}};updateWidth();setTimeout(updateWidth,100);window.addEventListener(\"resize\",updateWidth);return()=>window.removeEventListener(\"resize\",updateWidth);},[childrenArray.length]);const totalItems=childrenArray.length;const handleNext=()=>{setCurrentIndex(prev=>prev+1);};const handlePrev=()=>{setCurrentIndex(prev=>prev-1);};// Logic to calculate the wrap-around\n// We target the middle set of the tripled array\nconst offset=currentIndex%totalItems*(cardWidth+cardGap);if(RenderTarget.current()===RenderTarget.canvas&&childrenArray.length===0){return /*#__PURE__*/_jsxs(\"div\",{style:placeholderStyle,children:[\"↔️ Infinite Arrow Slider \",/*#__PURE__*/_jsx(\"br\",{}),\" Connect slides to begin\"]});}return /*#__PURE__*/_jsxs(\"div\",{style:{width:\"100%\",height:\"100%\",display:\"flex\",flexDirection:\"column\",gap:`${arrowGap}px`,overflow:\"hidden\"},children:[/*#__PURE__*/_jsx(\"div\",{style:{flex:1,position:\"relative\",overflow:\"visible\",display:\"flex\",alignItems:\"center\"},children:/*#__PURE__*/_jsx(motion.div,{animate:{x:-(currentIndex*(cardWidth+cardGap))},transition:{duration:transitionDuration,ease:[.32,.72,0,1]},style:{display:\"flex\",gap:`${cardGap}px`,cursor:\"grab\"},children:[...Array(100)].map((_,i)=>{const childIndex=i%totalItems;return /*#__PURE__*/_jsxs(\"div\",{ref:i===0?cardRef:null,className:\"gradient-killer\",style:{flexShrink:0},children:[childrenArray[childIndex],/*#__PURE__*/_jsx(\"style\",{dangerouslySetInnerHTML:{__html:`\n                                    .gradient-killer [style*=\"background: linear-gradient\"],\n                                    .gradient-killer [style*=\"background-image: linear-gradient\"],\n                                    .gradient-killer [style*=\"linear-gradient\"] {\n                                        background: transparent !important;\n                                        background-image: none !important;\n                                        display: none !important;\n                                    }\n                                `}})]},i);})})}),/*#__PURE__*/_jsxs(\"div\",{style:{display:\"flex\",gap:\"12px\",justifyContent:\"center\"},children:[/*#__PURE__*/_jsx(\"button\",{onClick:handlePrev,style:{...buttonStyle,width:arrowSize,height:arrowSize,background:arrowBackgroundColor},children:/*#__PURE__*/_jsx(\"svg\",{width:\"20\",height:\"20\",viewBox:\"0 0 24 24\",fill:\"none\",stroke:arrowColor,strokeWidth:\"2\",strokeLinecap:\"round\",strokeLinejoin:\"round\",children:/*#__PURE__*/_jsx(\"path\",{d:\"M19 12H5M12 19l-7-7 7-7\"})})}),/*#__PURE__*/_jsx(\"button\",{onClick:handleNext,style:{...buttonStyle,width:arrowSize,height:arrowSize,background:arrowBackgroundColor},children:/*#__PURE__*/_jsx(\"svg\",{width:\"20\",height:\"20\",viewBox:\"0 0 24 24\",fill:\"none\",stroke:arrowColor,strokeWidth:\"2\",strokeLinecap:\"round\",strokeLinejoin:\"round\",children:/*#__PURE__*/_jsx(\"path\",{d:\"M5 12h14M12 5l7 7-7 7\"})})})]})]});}const buttonStyle={border:\"none\",borderRadius:\"50%\",cursor:\"pointer\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",boxShadow:\"0 2px 8px rgba(0,0,0,0.1)\",transition:\"transform 0.1s ease\"};const placeholderStyle={width:\"100%\",height:\"100%\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",border:\"2px dashed rgba(136, 85, 255, 0.3)\",borderRadius:\"12px\",color:\"#8855FF\",textAlign:\"center\"};addPropertyControls(InfiniteSlider,{children:{type:ControlType.Array,title:\"Slides\",control:{type:ControlType.ComponentInstance}},cardGap:{type:ControlType.Number,title:\"Gap\",defaultValue:20},arrowSize:{type:ControlType.Number,title:\"Arrow Size\",defaultValue:45},arrowColor:{type:ControlType.Color,title:\"Arrow Color\",defaultValue:\"#000\"},arrowBackgroundColor:{type:ControlType.Color,title:\"Arrow BG\",defaultValue:\"#fff\"},arrowGap:{type:ControlType.Number,title:\"Arrow Top Gap\",defaultValue:20},transitionDuration:{type:ControlType.Number,title:\"Slide Speed\",min:.1,max:2,step:.1,defaultValue:.4}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"InfiniteSlider\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./StackingSlider.map"],"mappings":"mRAA0N,SAAwB,EAAe,EAAM,CAAC,GAAK,CAAC,WAAS,UAAQ,GAAG,YAAU,GAAG,aAAW,UAAU,uBAAqB,UAAU,WAAS,GAAG,qBAAmB,IAAI,EAAY,EAAcA,EAAS,QAAQ,EAAS,CAAM,CAAC,EAAa,GAAiBC,EAAS,EAAE,CAAM,CAAC,EAAU,GAAcA,EAAS,EAAE,CAAO,EAAQC,EAAO,KAAK,CAC5hB,MAAgB,EAAc,SAAS,EAAQ,EAAE,CAC9D,CAAC,GAAG,EAAc,GAAG,EAAc,GAAG,EAAc,CAAG,CAAC,EAAc,CAAC,CAAC,MAAc,CAAC,IAAM,MAAgB,CAAI,EAAQ,SAAS,EAAa,EAAQ,QAAQ,YAAY,EAA4F,OAAxF,GAAa,CAA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