{"version":3,"file":"PolaroidStack.BUyT7p27.mjs","names":["useState","useRef"],"sources":["https:/framerusercontent.com/modules/D8OiERKFjgsgxbERP1Ef/DHEZpryvsIc4o3yJMLZd/PolaroidStack.js"],"sourcesContent":["// Polaroid image stack component with tap-to-shift functionality\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,startTransition,useRef}from\"react\";import{addPropertyControls,ControlType}from\"framer\";import{motion,AnimatePresence}from\"framer-motion\";/**\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */export default function PolaroidStack(props){const{images=[{src:{src:\"https://framerusercontent.com/images/GfGkADagM4KEibNcIiRUWlfrR0.jpg\",alt:\"Gradient 1 - Blue\"},text:\"Photo 1\"},{src:{src:\"https://framerusercontent.com/images/aNsAT3jCvt4zglbWCUoFe33Q.jpg\",alt:\"Gradient 2 - Purple\"},text:\"Photo 2\"},{src:{src:\"https://framerusercontent.com/images/BYnxEV1zjYb9bhWh1IwBZ1ZoS60.jpg\",alt:\"Gradient 3 - Orange\"},text:\"Photo 3\"}],stackOffset=8,rotationRange=6,backgroundColor=\"#FFFFFF\",shadowIntensity=.15,animationDuration=.4,textColor=\"#000000\",textFont={fontSize:\"12px\",variant:\"Medium\",letterSpacing:\"-0.01em\",lineHeight:\"1em\"}}=props;const[currentIndex,setCurrentIndex]=useState(0);const[isDragging,setIsDragging]=useState(false);const[draggedIndex,setDraggedIndex]=useState(null);const containerRef=useRef(null);const handleClick=()=>{if(!isDragging){startTransition(()=>{// Move the bottom card to the top by cycling backwards\nsetCurrentIndex(prev=>(prev-1+images.length)%images.length);});}};const handleDragStart=index=>{startTransition(()=>{setIsDragging(true);setDraggedIndex(index);});};const handleDragEnd=index=>{startTransition(()=>{setIsDragging(false);setDraggedIndex(null);});};const handleReorder=(draggedIndex,targetIndex)=>{if(draggedIndex===targetIndex)return;// Calculate the new order based on drag and drop\nconst newOrder=[...images];const draggedItem=newOrder[draggedIndex];newOrder.splice(draggedIndex,1);newOrder.splice(targetIndex,0,draggedItem);// Update the current index to maintain the visual order\nconst draggedCurrentPos=(draggedIndex-currentIndex+images.length)%images.length;const targetCurrentPos=(targetIndex-currentIndex+images.length)%images.length;if(draggedCurrentPos===0){// If we're dragging the top card\nsetCurrentIndex(targetIndex);}else if(targetCurrentPos===0){// If we're dropping on the top card\nsetCurrentIndex(draggedIndex);}};const getRotation=(index,current)=>{const distance=(index-current+images.length)%images.length;const seed=index*123.456;const baseRotation=Math.sin(seed)*rotationRange;// Add slight variation for stacked cards\nif(distance>0){const stackSeed=index*456.789;const stackVariation=Math.cos(stackSeed)*3;return baseRotation+stackVariation;}return baseRotation;};const getZIndex=(index,current)=>{const distance=(index-current+images.length)%images.length;return images.length-distance;};const getOffset=(index,current)=>{const distance=(index-current+images.length)%images.length;if(distance===0)return 0;// Create organic offset with slight randomness\nconst baseOffset=stackOffset*distance;const seed=index*789.123;const randomOffset=Math.sin(seed)*5;const cosOffset=Math.cos(seed*1.5)*2;return baseOffset+randomOffset+cosOffset;};const getScale=(index,current)=>{const distance=(index-current+images.length)%images.length;if(distance===0)return 1;return 1-distance*.02;};return /*#__PURE__*/_jsx(\"div\",{ref:containerRef,style:{position:\"relative\",width:\"100%\",height:\"100%\",cursor:isDragging?\"grabbing\":\"pointer\",perspective:\"1000px\"},onClick:handleClick,children:/*#__PURE__*/_jsx(AnimatePresence,{children:images.map((image,index)=>/*#__PURE__*/_jsx(motion.div,{drag:true,dragConstraints:containerRef,dragElastic:.1,onDragStart:()=>handleDragStart(index),onDragEnd:()=>handleDragEnd(index),style:{position:\"absolute\",top:0,left:0,width:\"100%\",height:\"100%\",zIndex:draggedIndex===index?1e3:getZIndex(index,currentIndex),cursor:isDragging&&draggedIndex===index?\"grabbing\":\"grab\"},initial:{y:getOffset(index,currentIndex),x:getOffset(index,currentIndex)*.4,rotate:getRotation(index,currentIndex),scale:getScale(index,currentIndex),opacity:1},animate:{y:getOffset(index,currentIndex),x:getOffset(index,currentIndex)*.4,rotate:getRotation(index,currentIndex),scale:getScale(index,currentIndex),opacity:1},transition:{duration:isDragging&&draggedIndex===index?0:animationDuration,ease:\"easeInOut\",type:\"tween\"},whileHover:{scale:index===currentIndex?1.02:getScale(index,currentIndex),transition:{duration:.2}},whileDrag:{scale:1.05,rotate:getRotation(index,currentIndex)+5,zIndex:1e3},children:/*#__PURE__*/_jsxs(\"div\",{style:{width:\"100%\",height:\"100%\",backgroundColor:backgroundColor,border:\"1px solid #E0E0E0\",borderRadius:\"4px\",padding:\"12px\",boxShadow:`0 4px 20px rgba(0, 0, 0, ${shadowIntensity})`,display:\"flex\",flexDirection:\"column\"},children:[/*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",height:\"85%\",backgroundColor:\"#f0f0f0\",borderRadius:\"2px\",overflow:\"hidden\"},children:/*#__PURE__*/_jsx(\"img\",{src:image.src.src,alt:image.src.alt||\"Polaroid photo\",style:{width:\"100%\",height:\"100%\",objectFit:\"cover\"}})}),/*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",height:\"15%\",backgroundColor:backgroundColor,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",color:textColor,...textFont},children:image.text||\"\"})]})},`${index}-${currentIndex}`))})});}addPropertyControls(PolaroidStack,{images:{type:ControlType.Array,title:\"Images\",control:{type:ControlType.Object,controls:{src:{type:ControlType.ResponsiveImage,title:\"Image\"},text:{type:ControlType.String,title:\"Text\",defaultValue:\"\"}}},defaultValue:[{src:{src:\"https://framerusercontent.com/images/GfGkADagM4KEibNcIiRUWlfrR0.jpg\",alt:\"Gradient 1 - Blue\"},text:\"Photo 1\"},{src:{src:\"https://framerusercontent.com/images/aNsAT3jCvt4zglbWCUoFe33Q.jpg\",alt:\"Gradient 2 - Purple\"},text:\"Photo 2\"},{src:{src:\"https://framerusercontent.com/images/BYnxEV1zjYb9bhWh1IwBZ1ZoS60.jpg\",alt:\"Gradient 3 - Orange\"},text:\"Photo 3\"}],maxCount:8},stackOffset:{type:ControlType.Number,title:\"Stack Offset\",defaultValue:8,min:0,max:30,step:1,unit:\"px\"},rotationRange:{type:ControlType.Number,title:\"Rotation Range\",defaultValue:6,min:0,max:15,step:.5,unit:\"deg\"},backgroundColor:{type:ControlType.Color,title:\"Polaroid Color\",defaultValue:\"#FFFFFF\"},shadowIntensity:{type:ControlType.Number,title:\"Shadow Intensity\",defaultValue:.15,min:0,max:.5,step:.05},animationDuration:{type:ControlType.Number,title:\"Animation Speed\",defaultValue:.4,min:.1,max:1,step:.1,unit:\"s\"},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#000000\"},textFont:{type:ControlType.Font,title:\"Text Font\",defaultValue:{fontSize:\"12px\",variant:\"Medium\",letterSpacing:\"-0.01em\",lineHeight:\"1em\"},controls:\"extended\",defaultFontType:\"sans-serif\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"PolaroidStack\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"fixed\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./PolaroidStack.map"],"mappings":"uPAIG,SAAwB,EAAc,EAAM,CAAC,GAAK,CAAC,SAAO,CAAC,CAAC,IAAI,CAAC,IAAI,sEAAsE,IAAI,oBAAoB,CAAC,KAAK,UAAU,CAAC,CAAC,IAAI,CAAC,IAAI,oEAAoE,IAAI,sBAAsB,CAAC,KAAK,UAAU,CAAC,CAAC,IAAI,CAAC,IAAI,uEAAuE,IAAI,sBAAsB,CAAC,KAAK,UAAU,CAAC,CAAC,cAAY,EAAE,gBAAc,EAAE,kBAAgB,UAAU,kBAAgB,IAAI,oBAAkB,GAAG,YAAU,UAAU,WAAS,CAAC,SAAS,OAAO,QAAQ,SAAS,cAAc,UAAU,WAAW,MAAM,EAAE,EAAW,CAAC,EAAa,GAAiBA,EAAS,EAAE,CAAM,CAAC,EAAW,GAAeA,EA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