{"version":3,"file":"FlipCard_component.BdZ95kpN.mjs","names":["useState","useCallback","useMemo"],"sources":["https:/framerusercontent.com/modules/nfSrHGx5h1sWCHqSbQW3/pCpFvQiFCEcmIth2oAKE/FlipCard_component.js"],"sourcesContent":["// Draggable card stack component with flip-to-back interaction\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,useCallback,useMemo,startTransition}from\"react\";import{motion,AnimatePresence}from\"framer-motion\";import{addPropertyControls,ControlType}from\"framer\";/**\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n * @framerIntrinsicWidth 300\n * @framerIntrinsicHeight 400\n */export default function FlipCardStack(props){const{cards=[{image:{src:\"https://framerusercontent.com/images/GfGkADagM4KEibNcIiRUWlfrR0.jpg\",alt:\"Card 1\"},title:\"\",description:\"\"},{image:{src:\"https://framerusercontent.com/images/aNsAT3jCvt4zglbWCUoFe33Q.jpg\",alt:\"Card 2\"},title:\"\",description:\"\"},{image:{src:\"https://framerusercontent.com/images/BYnxEV1zjYb9bhWh1IwBZ1ZoS60.jpg\",alt:\"Card 3\"},title:\"\",description:\"\"}],cardWidth,cardHeight,stackOffset,stackRotation,dragThreshold,animationDuration,animationEase,borderRadius,shadowIntensity,style}=props;const[cardOrder,setCardOrder]=useState(()=>cards.map((_,index)=>index));const getCardTransform=useCallback((index,cardIndex)=>{const stackPosition=cardOrder.indexOf(cardIndex);const positionFromBottom=cardOrder.length-1-stackPosition;return{zIndex:stackPosition,y:-positionFromBottom*stackOffset,rotate:positionFromBottom*stackRotation,scale:1-positionFromBottom*.02,opacity:1};},[cardOrder,stackOffset,stackRotation]);const handleDragEnd=useCallback((event,info,cardIndex)=>{const dragDistance=Math.abs(info.offset.x)+Math.abs(info.offset.y);const velocity=Math.abs(info.velocity.x)+Math.abs(info.velocity.y);if(dragDistance>dragThreshold||velocity>800){startTransition(()=>{setCardOrder(prevOrder=>{const newOrder=[...prevOrder];const draggedCardPosition=newOrder.indexOf(cardIndex);const draggedCard=newOrder.splice(draggedCardPosition,1)[0];newOrder.unshift(draggedCard);return newOrder;});});}},[dragThreshold]);const cardVariants={initial:custom=>({...custom,x:0,y:custom.y}),animate:custom=>({...custom,x:0,y:custom.y,transition:{type:\"spring\",damping:30,stiffness:500,mass:.5,restDelta:.01,restSpeed:.01}}),drag:{scale:1.05,rotate:0,transition:{duration:.05}}};const renderedCards=useMemo(()=>{return cards.map((card,index)=>{const transform=getCardTransform(index,index);const isTopCard=cardOrder.indexOf(index)===cardOrder.length-1;return /*#__PURE__*/_jsxs(motion.div,{custom:transform,variants:cardVariants,initial:\"initial\",animate:\"animate\",exit:\"exit\",whileDrag:\"drag\",drag:isTopCard,dragConstraints:{top:-150,bottom:150,left:-150,right:150},dragElastic:.2,dragSnapToOrigin:true,dragTransition:{power:.3,timeConstant:125,bounceStiffness:500,bounceDamping:30},onDragEnd:(event,info)=>handleDragEnd(event,info,index),style:{position:\"absolute\",width:cardWidth,height:cardHeight,borderRadius,overflow:\"hidden\",cursor:isTopCard?\"grab\":\"default\",boxShadow:`0px ${4+transform.zIndex*2}px ${8+transform.zIndex*4}px rgba(0, 0, 0, ${shadowIntensity})`},whileHover:isTopCard?{scale:1.02}:{},children:[card.image&&/*#__PURE__*/_jsx(\"img\",{src:card.image.src,srcSet:card.image.srcSet,alt:card.image.alt||`Card ${index+1}`,style:{width:\"100%\",height:\"100%\",objectFit:\"cover\",objectPosition:`${card.image.positionX||\"50%\"} ${card.image.positionY||\"50%\"}`,userSelect:\"none\",pointerEvents:\"none\"}}),(card.title||card.description)&&/*#__PURE__*/_jsxs(\"div\",{style:{position:\"absolute\",bottom:0,left:0,right:0,background:\"linear-gradient(transparent, rgba(0,0,0,0.7))\",color:\"white\",padding:\"24px\",textAlign:\"left\"},children:[card.title&&/*#__PURE__*/_jsx(\"h3\",{style:{margin:\"0 0 4px 0\",fontSize:\"18px\",fontWeight:\"600\"},children:card.title}),card.description&&/*#__PURE__*/_jsx(\"p\",{style:{margin:0,fontSize:\"14px\",opacity:.8},children:card.description})]})]},`card-${index}`);});},[cards,cardOrder,cardWidth,cardHeight,borderRadius,shadowIntensity,getCardTransform,cardVariants,handleDragEnd]);return /*#__PURE__*/_jsxs(\"div\",{style:{...style,position:\"relative\",width:cardWidth,height:cardHeight,perspective:\"1000px\"},children:[/*#__PURE__*/_jsx(AnimatePresence,{children:renderedCards}),cards.length===0&&/*#__PURE__*/_jsxs(\"div\",{style:{width:\"100%\",height:\"100%\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",background:\"#f0f0f0\",borderRadius,border:\"2px dashed #ccc\",color:\"#666\",textAlign:\"center\",fontSize:\"14px\"},children:[\"Add cards to create\",/*#__PURE__*/_jsx(\"br\",{}),\"your flip stack\"]})]});}addPropertyControls(FlipCardStack,{cards:{type:ControlType.Array,title:\"Cards\",control:{type:ControlType.Object,controls:{image:{type:ControlType.ResponsiveImage,title:\"Image\"},title:{type:ControlType.String,title:\"Title\",placeholder:\"Card title...\",defaultValue:\"\"},description:{type:ControlType.String,title:\"Description\",placeholder:\"Card description...\",displayTextArea:true,defaultValue:\"\"}}},defaultValue:[{image:{src:\"https://framerusercontent.com/images/GfGkADagM4KEibNcIiRUWlfrR0.jpg\",alt:\"Gradient 1 - Blue\"}},{image:{src:\"https://framerusercontent.com/images/aNsAT3jCvt4zglbWCUoFe33Q.jpg\",alt:\"Gradient 2 - Purple\"}},{image:{src:\"https://framerusercontent.com/images/BYnxEV1zjYb9bhWh1IwBZ1ZoS60.jpg\",alt:\"Gradient 3 - Orange\"}}],maxCount:10},cardWidth:{type:ControlType.Number,title:\"Card Width\",min:200,max:600,step:10,unit:\"px\",defaultValue:300},cardHeight:{type:ControlType.Number,title:\"Card Height\",min:200,max:800,step:10,unit:\"px\",defaultValue:400},stackOffset:{type:ControlType.Number,title:\"Offset\",description:\"Vertical spacing between cards in the stack\",min:0,max:20,step:1,unit:\"px\",defaultValue:8},stackRotation:{type:ControlType.Number,title:\"Rotation\",description:\"Rotation angle applied to each card in the stack\",min:-10,max:15,step:.5,unit:\"\\xb0\",defaultValue:-10},dragThreshold:{type:ControlType.Number,title:\"Drag Threshold\",min:30,max:200,step:10,unit:\"px\",defaultValue:80},animationDuration:{type:ControlType.Number,title:\"Animation Speed\",min:.1,max:1,step:.1,unit:\"s\",defaultValue:.3},animationEase:{type:ControlType.Enum,title:\"Animation Ease\",options:[\"linear\",\"easeIn\",\"easeOut\",\"easeInOut\"],optionTitles:[\"Linear\",\"Ease In\",\"Ease Out\",\"Ease In Out\"],defaultValue:\"easeOut\"},borderRadius:{type:ControlType.Number,title:\"Border Radius\",min:0,max:50,step:1,unit:\"px\",defaultValue:24},shadowIntensity:{type:ControlType.Number,title:\"Shadow Intensity\",min:0,max:1,step:.1,defaultValue:.2}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"FlipCardStack\",\"slots\":[],\"annotations\":{\"framerIntrinsicHeight\":\"400\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"fixed\",\"framerIntrinsicWidth\":\"300\",\"framerSupportedLayoutWidth\":\"fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./FlipCard_component.map"],"mappings":"8PAMG,SAAwB,EAAc,EAAM,CAAC,GAAK,CAAC,QAAM,CAAC,CAAC,MAAM,CAAC,IAAI,sEAAsE,IAAI,SAAS,CAAC,MAAM,GAAG,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC,IAAI,oEAAoE,IAAI,SAAS,CAAC,MAAM,GAAG,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC,IAAI,uEAAuE,IAAI,SAAS,CAAC,MAAM,GAAG,YAAY,GAAG,CAAC,CAAC,YAAU,aAAW,cAAY,gBAAc,gBAAc,oBAAkB,gBAAc,eAAa,kBAAgB,SAAO,EAAW,CAAC,EAAU,GAAcA,MAAa,EAAM,KAAK,EAAE,IAAQ,EAAM,CAAC,CAAO,EAAiBC,GAAa,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