{"version":3,"file":"After_fait_maison.Uo7_GSnd.mjs","names":["useState","useRef","_Fragment"],"sources":["https:/framerusercontent.com/modules/JdSKWq95RHwxsHyrQEbg/ZrRplALoPXxGt7DO9nO8/After_fait_maison.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import{useEffect,useState,useRef}from\"react\";import{useInView}from\"framer-motion\";import{addPropertyControls,ControlType}from\"framer\";export default function BeforeAfterAnimated(props){const[position,setPosition]=useState(props.initialPosition);const[isDragging,setIsDragging]=useState(false);const[hasAnimated,setHasAnimated]=useState(false);const containerRef=useRef(null);const isInView=useInView(containerRef,{once:true,margin:\"-100px\"});// Animation automatique au scroll - plus smooth et subtile\nuseEffect(()=>{if(isInView&&!hasAnimated&&!isDragging){const animate=async()=>{await new Promise(r=>setTimeout(r,600));// Mouvement plus petit et plus smooth\nsetPosition(props.initialPosition-10)// Va 10% à gauche\n;await new Promise(r=>setTimeout(r,1e3));setPosition(props.initialPosition+10)// Va 10% à droite\n;await new Promise(r=>setTimeout(r,1e3));setPosition(props.initialPosition)// Retour à la position initiale\n;setHasAnimated(true);};animate();}},[isInView,hasAnimated,isDragging,props.initialPosition]);// Reset position quand initialPosition change\nuseEffect(()=>{if(!isDragging){setPosition(props.initialPosition);}},[props.initialPosition]);const handleMouseDown=e=>{setIsDragging(true);setHasAnimated(true);};const handleMouseMove=e=>{if(!isDragging)return;const rect=containerRef.current.getBoundingClientRect();const x=(e.clientX-rect.left)/rect.width*100;setPosition(Math.min(100,Math.max(0,x)));};const handleMouseUp=()=>setIsDragging(false);const handleTouchMove=e=>{if(!isDragging)return;const rect=containerRef.current.getBoundingClientRect();const x=(e.touches[0].clientX-rect.left)/rect.width*100;setPosition(Math.min(100,Math.max(0,x)));};return /*#__PURE__*/_jsxs(\"div\",{ref:containerRef,style:{position:\"relative\",width:\"100%\",height:\"100%\",overflow:\"hidden\",borderRadius:props.radius,cursor:isDragging?\"grabbing\":\"grab\",userSelect:\"none\"},onMouseMove:handleMouseMove,onMouseUp:handleMouseUp,onMouseLeave:handleMouseUp,onTouchMove:handleTouchMove,onTouchEnd:handleMouseUp,children:[/*#__PURE__*/_jsx(\"img\",{src:props.leftImage,style:{width:\"100%\",height:\"100%\",objectFit:\"cover\",display:\"block\"},alt:\"Before\"}),/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",top:0,left:0,width:\"100%\",height:\"100%\",clipPath:`inset(0 0 0 ${position}%)`,transition:isDragging?\"none\":\"clip-path 0.5s cubic-bezier(0.4, 0, 0.2, 1)\"},children:/*#__PURE__*/_jsx(\"img\",{src:props.rightImage,style:{width:\"100%\",height:\"100%\",objectFit:\"cover\",display:\"block\"},alt:\"After\"})}),/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",left:`${position}%`,top:0,bottom:0,width:\"2px\",backgroundColor:props.lineColor,transition:isDragging?\"none\":\"left 0.5s cubic-bezier(0.4, 0, 0.2, 1)\",cursor:\"ew-resize\"},onMouseDown:handleMouseDown,onTouchStart:handleMouseDown,children:/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",left:\"50%\",top:\"50%\",transform:\"translate(-50%, -50%)\",width:props.handleSize,height:props.handleSize,display:\"flex\",alignItems:\"center\",justifyContent:\"center\"},children:props.handleComponent?/*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",height:\"100%\"},children:props.handleComponent}):/*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",height:\"100%\",borderRadius:\"50%\",backgroundColor:props.handleColor,border:`2px solid ${props.lineColor}`,boxShadow:\"0 2px 8px rgba(0,0,0,0.2)\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\"},children:/*#__PURE__*/_jsx(\"span\",{style:{color:props.arrowColor,fontSize:\"16px\",fontWeight:\"bold\"},children:\"◀▶\"})})})}),props.showLabels&&/*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",top:\"20px\",left:\"20px\",padding:\"8px 16px\",backgroundColor:\"rgba(255,255,255,0.9)\",borderRadius:\"6px\",fontSize:\"14px\",fontWeight:\"500\"},children:props.beforeLabel}),/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",top:\"20px\",right:\"20px\",padding:\"8px 16px\",backgroundColor:\"rgba(0,0,0,0.7)\",color:\"white\",borderRadius:\"6px\",fontSize:\"14px\",fontWeight:\"500\"},children:props.afterLabel})]})]});}// Configuration des propriétés dans Framer\naddPropertyControls(BeforeAfterAnimated,{leftImage:{type:ControlType.Image,title:\"Before Image\"},rightImage:{type:ControlType.Image,title:\"After Image\"},initialPosition:{type:ControlType.Number,title:\"Initial Position\",defaultValue:50,min:0,max:100,step:1,displayStepper:true},radius:{type:ControlType.Number,title:\"Border Radius\",defaultValue:8,min:0,max:50,step:1},lineColor:{type:ControlType.Color,title:\"Line Color\",defaultValue:\"#ffffff\"},handleComponent:{type:ControlType.ComponentInstance,title:\"Handle Component\"},handleSize:{type:ControlType.Number,title:\"Handle Size\",defaultValue:40,min:20,max:80,step:1},handleColor:{type:ControlType.Color,title:\"Handle Color (if no component)\",defaultValue:\"#ffffff\",hidden:props=>!!props.handleComponent},arrowColor:{type:ControlType.Color,title:\"Arrow Color (if no component)\",defaultValue:\"#333333\",hidden:props=>!!props.handleComponent},showLabels:{type:ControlType.Boolean,title:\"Show Labels\",defaultValue:false},beforeLabel:{type:ControlType.String,title:\"Before Label\",defaultValue:\"Before\",hidden:props=>!props.showLabels},afterLabel:{type:ControlType.String,title:\"After Label\",defaultValue:\"After\",hidden:props=>!props.showLabels}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"BeforeAfterAnimated\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./After_fait_maison.map"],"mappings":"uPAAqN,SAAwB,EAAoB,EAAM,CAAC,GAAK,CAAC,EAAS,GAAaA,E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