{"version":3,"file":"InteractiveFlippingCards.CWSa3rnP.mjs","names":["React.useRef","React.useState"],"sources":["https:/framerusercontent.com/modules/x5YuxvFhtS8v9BAK0BMx/vdsasPkKZHvZqShaPGBB/InteractiveFlippingCards.js"],"sourcesContent":["\"use client\";import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType}from\"framer\";export default function FlipCardLight(props){const{frontImage,backImage,frontTitle,frontBody,backTitle,backBody,frontTitleFont,frontBodyFont,backTitleFont,backBodyFont,frontTitleColor,frontBodyColor,backTitleColor,backBodyColor,radius,tiltStrength,link,openInNewTab}=props;const cardRef=React.useRef(null);const[tilt,setTilt]=React.useState({x:0,y:0});const[hover,setHover]=React.useState(false);const[flipped,setFlipped]=React.useState(false);const handleMove=e=>{if(!cardRef.current)return;const rect=cardRef.current.getBoundingClientRect();const x=(e.clientX-rect.left)/rect.width;const y=(e.clientY-rect.top)/rect.height;const rotateX=(y-.5)*tiltStrength;const rotateY=(x-.5)*-tiltStrength;setTilt({x:rotateX,y:rotateY});setHover(true);};const handleLeave=()=>{setHover(false);setTilt({x:0,y:0});};const handleClick=()=>{if(!flipped){setFlipped(true);}else if(link){if(openInNewTab){window.open(link,\"_blank\");}else{window.location.href=link;}}};const transform=`\nperspective(900px)\nrotateY(${flipped?180:0}deg)\nrotateX(${hover?tilt.x:0}deg)\nrotateY(${hover?tilt.y:0}deg)\n`;return /*#__PURE__*/_jsx(\"div\",{ref:cardRef,onMouseMove:handleMove,onMouseLeave:handleLeave,onClick:handleClick,style:{width:\"100%\",height:\"100%\",cursor:\"pointer\",borderRadius:radius,perspective:900},children:/*#__PURE__*/_jsxs(\"div\",{style:{width:\"100%\",height:\"100%\",transformStyle:\"preserve-3d\",transition:\"transform .35s ease\",transform},children:[/*#__PURE__*/_jsxs(\"div\",{style:{position:\"absolute\",width:\"100%\",height:\"100%\",backfaceVisibility:\"hidden\",borderRadius:radius,overflow:\"hidden\"},children:[/*#__PURE__*/_jsx(\"img\",{src:frontImage?.src,style:{position:\"absolute\",width:\"100%\",height:\"100%\",objectFit:\"cover\"}}),/*#__PURE__*/_jsxs(\"div\",{style:{position:\"absolute\",bottom:0,padding:24,width:\"100%\",color:frontTitleColor},children:[/*#__PURE__*/_jsx(\"div\",{style:{...frontTitleFont},children:frontTitle}),/*#__PURE__*/_jsx(\"div\",{style:{...frontBodyFont,color:frontBodyColor},children:frontBody})]})]}),/*#__PURE__*/_jsxs(\"div\",{style:{position:\"absolute\",width:\"100%\",height:\"100%\",backfaceVisibility:\"hidden\",transform:\"rotateY(180deg)\",borderRadius:radius,overflow:\"hidden\"},children:[/*#__PURE__*/_jsx(\"img\",{src:backImage?.src,style:{position:\"absolute\",width:\"100%\",height:\"100%\",objectFit:\"cover\"}}),/*#__PURE__*/_jsxs(\"div\",{style:{position:\"absolute\",bottom:0,padding:24,width:\"100%\",color:backTitleColor},children:[/*#__PURE__*/_jsx(\"div\",{style:{...backTitleFont},children:backTitle}),/*#__PURE__*/_jsx(\"div\",{style:{...backBodyFont,color:backBodyColor},children:backBody})]})]})]})});}addPropertyControls(FlipCardLight,{frontImage:{type:ControlType.ResponsiveImage,title:\"Front Image\"},backImage:{type:ControlType.ResponsiveImage,title:\"Back Image\"},link:{type:ControlType.String,title:\"Link\"},openInNewTab:{type:ControlType.Boolean,title:\"New Tab\",defaultValue:false},radius:{type:ControlType.Number,title:\"Radius\",defaultValue:16,min:0,max:40},tiltStrength:{type:ControlType.Number,title:\"Tilt\",defaultValue:12,min:0,max:30},frontTitle:{type:ControlType.String,title:\"Front Title\",defaultValue:\"Front Title\"},frontBody:{type:ControlType.String,title:\"Front Body\",defaultValue:\"Front body text\"},backTitle:{type:ControlType.String,title:\"Back Title\",defaultValue:\"Back Title\"},backBody:{type:ControlType.String,title:\"Back Body\",defaultValue:\"Back body text\"},frontTitleFont:{type:ControlType.Font,title:\"Front Title Font\",defaultFontType:\"sans-serif\",controls:\"extended\"},frontBodyFont:{type:ControlType.Font,title:\"Front Body Font\",defaultFontType:\"sans-serif\",controls:\"extended\"},backTitleFont:{type:ControlType.Font,title:\"Back Title Font\",defaultFontType:\"sans-serif\",controls:\"extended\"},backBodyFont:{type:ControlType.Font,title:\"Back Body Font\",defaultFontType:\"sans-serif\",controls:\"extended\"},frontTitleColor:{type:ControlType.Color,title:\"Front Title Color\",defaultValue:\"#FCDAA8\"},frontBodyColor:{type:ControlType.Color,title:\"Front Body Color\",defaultValue:\"#FCDAA8\"},backTitleColor:{type:ControlType.Color,title:\"Back Title Color\",defaultValue:\"#FCDAA8\"},backBodyColor:{type:ControlType.Color,title:\"Back Body Color\",defaultValue:\"#FCDAA8\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"FlipCardLight\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./InteractiveFlippingCards.map"],"mappings":"sMAAsJ,SAAwB,EAAc,EAAM,CAAC,GAAK,CAAC,aAAW,YAAU,aAAW,YAAU,YAAU,WAAS,iBAAe,gBAAc,gBAAc,eAAa,kBAAgB,iBAAe,iBAAe,gBAAc,SAAO,eAAa,OAAK,gBAAc,EAAY,EAAQA,EAAa,KAAK,CAAM,CAAC,EAAK,GAASC,EAAe,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,CAAM,CAAC,EAAM,GAAUA,EAAe,GAAM,CAAM,CAAC,EAAQ,GAAYA,EAAe,GAAM,CAAO,EAAW,GAAG,CAAC,GAAG,CAAC,EAAQ,QAAQ,OAAO,IAAM,EAAK,EAAQ,QAAQ,uBAAuB,CAAO,GAAG,EAAE,QAAQ,EAAK,MAAM,EAAK,MAAoH,EAAQ,CAAC,IAA9G,EAAE,QAAQ,EAAK,KAAK,EAAK,OAAwB,IAAI,EAAmE,GAAvC,EAAE,IAAI,CAAC,EAA0C,CAAC,CAAC,EAAS,GAAK,EAAS,MAAgB,CAA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