{"version":3,"file":"BlockTransition.DsXtMFRz.mjs","names":["React.useState","React.useMemo"],"sources":["https:/framerusercontent.com/modules/pKhwhQkeMGrAyuplRlzF/RMQobvAWN5M9xJg86o6O/BlockTransition.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType}from\"framer\";import{motion}from\"framer-motion\";/**\n * @framerIntrinsicWidth 200\n * @framerIntrinsicHeight 200\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n */export function DivChangeTransition(props){const{firstComponent,secondComponent,thirdComponent,width,height,transition,fillComponent,clickAnimation,overflowX=false,overflowY=false,active=false,hoverEnabled=true}=props;const[isHovered,setIsHovered]=React.useState(false);const[isPressed,setIsPressed]=React.useState(false);const hasWidth=typeof width===\"number\"&&width>0;const hasHeight=typeof height===\"number\"&&height>0;const fillWidth=fillComponent||hasWidth;const fillHeight=fillComponent||hasHeight;const clickIsVisible=clickAnimation&&isPressed;const secondIsVisible=hoverEnabled&&isHovered||clickIsVisible||Boolean(active);const instantTransition=React.useMemo(()=>({duration:0}),[]);const hoverTransition=clickIsVisible?instantTransition:transition;const wipeY=secondIsVisible?\"0%\":\"calc(100% + 2px)\";const faceY=secondIsVisible?\"0%\":\"calc(-100% - 2px)\";const clipLeft=overflowX?\"-100vw\":\"-1px\";const clipRight=overflowX?\"-100vw\":\"-1px\";const clipY=overflowY&&secondIsVisible?\"-100vh\":\"-1px\";const clip=`inset(${clipY} ${clipRight} ${clipY} ${clipLeft})`;return /*#__PURE__*/_jsxs(\"div\",{onMouseEnter:()=>setIsHovered(true),onMouseLeave:()=>{setIsHovered(false);setIsPressed(false);},onPointerDown:()=>setIsPressed(true),onPointerUp:()=>setIsPressed(false),onPointerCancel:()=>setIsPressed(false),onPointerLeave:()=>setIsPressed(false),style:{position:\"relative\",width:fillWidth?\"100%\":\"fit-content\",height:fillHeight?fillComponent&&!hasHeight?\"auto\":\"100%\":\"auto\",minWidth:0,minHeight:0,boxSizing:\"border-box\",overflow:\"visible\"},children:[/*#__PURE__*/_jsx(\"div\",{style:{position:\"relative\",width:fillWidth?\"100%\":\"fit-content\",height:fillHeight?\"100%\":\"auto\",minWidth:0,minHeight:0,boxSizing:\"border-box\",overflow:\"visible\"},children:firstComponent}),/*#__PURE__*/_jsx(motion.div,{initial:{x:0,y:wipeY},animate:{x:0,y:wipeY},transition:hoverTransition,style:{position:\"absolute\",inset:0,overflow:\"visible\",clipPath:clip,WebkitClipPath:clip,pointerEvents:\"none\",zIndex:4},children:/*#__PURE__*/_jsx(motion.div,{initial:{x:0,y:faceY},animate:{x:0,y:faceY},transition:hoverTransition,style:{position:\"absolute\",inset:0,boxSizing:\"border-box\",overflow:\"visible\"},children:secondComponent})}),/*#__PURE__*/_jsx(motion.div,{initial:{opacity:0},animate:{opacity:clickIsVisible?1:0},transition:clickAnimation?transition:instantTransition,style:{position:\"absolute\",inset:0,pointerEvents:\"none\",overflow:\"visible\",zIndex:5},children:/*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",height:\"100%\",boxSizing:\"border-box\",overflow:\"visible\"},children:thirdComponent})})]});}DivChangeTransition.displayName=\"divChangeTransition\";DivChangeTransition.defaultProps={width:\"fit-content\",height:\"fit-content\",transition:{type:\"tween\",duration:.1,ease:\"easeInOut\"},fillComponent:false,clickAnimation:false,overflowX:false,overflowY:false};addPropertyControls(DivChangeTransition,{firstComponent:{type:ControlType.ComponentInstance,title:\"Default\"},secondComponent:{type:ControlType.ComponentInstance,title:\"Hover\"},thirdComponent:{type:ControlType.ComponentInstance,title:\"Click\"},fillComponent:{type:ControlType.Boolean,title:\"Fill component inside\",defaultValue:false},clickAnimation:{type:ControlType.Boolean,title:\"Click Animation\",defaultValue:false},overflowX:{type:ControlType.Boolean,title:\"Overflow X\",defaultValue:false,enabledTitle:\"Visible\",disabledTitle:\"Hidden\"},overflowY:{type:ControlType.Boolean,title:\"Overflow Y\",defaultValue:false,enabledTitle:\"Visible\",disabledTitle:\"Hidden\"},transition:{type:ControlType.Transition,title:\"Transition\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"DivChangeTransition\":{\"type\":\"reactComponent\",\"name\":\"DivChangeTransition\",\"slots\":[\"firstComponent\",\"secondComponent\",\"thirdComponent\"],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"any\",\"framerSupportedLayoutHeight\":\"any\",\"framerIntrinsicHeight\":\"200\",\"framerIntrinsicWidth\":\"200\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./BlockTransition.map"],"mappings":"yOAKG,SAAgB,EAAoB,EAAM,CAAC,GAAK,CAAC,iBAAe,kBAAgB,iBAAe,QAAM,SAAO,aAAW,gBAAc,iBAAe,YAAU,GAAM,YAAU,GAAM,SAAO,GAAM,eAAa,IAAM,EAAW,CAAC,EAAU,GAAcA,EAAe,EAAK,EAAO,CAAC,EAAU,GAAcA,EAAe,EAAK,EAAQ,EAAS,OAAO,GAAQ,UAAU,EAAM,EAAQ,EAAU,OAAO,GAAS,UAAU,EAAO,EAAQ,EAAU,GAAe,EAAe,EAAW,GAAe,EAAgB,EAAe,GAAgB,EAAgB,EAAgB,GAAc,GAAW,GAAgB,EAAQ,EAAc,EAAkBC,OAAmB,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,EAAQ,EAAgB,EAAe,EAAkB,EAAiB,EAAM,EAAgB,KAAK,mBAAyB,EAAM,EAAgB,KAAK,oBAA0B,EAAS,EAAU,SAAS,OAAa,EAAU,EAAU,SAAS,OAAa,EAAM,GAAW,EAAgB,SAAS,OAAa,EAAK,SAAS,EAAM,GAAG,EAAU,GAAG,EAAM,GAAG,EAAS,GAAG,OAAoB,EAAM,MAAM,CAAC,iBAAiB,EAAa,EAAI,EAAE,iBAAiB,CAAC,EAAa,EAAK,EAAE,EAAa,EAAK,CAAE,EAAE,kBAAkB,EAAa,EAAI,EAAE,gBAAgB,EAAa,EAAK,EAAE,oBAA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