{"version":3,"file":"BeforeAfterSlider.CcHyb_p5.mjs","names":["useRef","useState","useCallback","_Fragment"],"sources":["https:/framerusercontent.com/modules/jtJl9htAOdWJo7PA7Ai8/jQqpUEcwiIGM6miEylkD/BeforeAfterSlider.js"],"sourcesContent":["// Sliding bar for before after effect for portfolio section\nimport{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";import{useCallback,useEffect,useRef,useState,startTransition}from\"react\";/**\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */export default function BeforeAfterSlider(props){const{beforeImage={src:\"https://framerusercontent.com/images/GfGkADagM4KEibNcIiRUWlfrR0.jpg\",alt:\"Before\"},afterImage={src:\"https://framerusercontent.com/images/aNsAT3jCvt4zglbWCUoFe33Q.jpg\",alt:\"After\"},beforeLabel,afterLabel,showLabels,initialPosition,sliderColor,sliderWidth,handleColor,handleSize,showHandle,labelFont,labelColor,labelBackground}=props;const containerRef=useRef(null);const[position,setPosition]=useState(initialPosition);const[isDragging,setIsDragging]=useState(false);const isStatic=useIsStaticRenderer();const updatePosition=useCallback(clientX=>{if(!containerRef.current)return;const rect=containerRef.current.getBoundingClientRect();const x=clientX-rect.left;const newPosition=Math.max(0,Math.min(100,x/rect.width*100));startTransition(()=>setPosition(newPosition));},[]);const handleMouseDown=useCallback(e=>{e.preventDefault();startTransition(()=>setIsDragging(true));updatePosition(e.clientX);},[updatePosition]);const handleMouseMove=useCallback(e=>{if(!isDragging)return;updatePosition(e.clientX);},[isDragging,updatePosition]);const handleMouseUp=useCallback(()=>{startTransition(()=>setIsDragging(false));},[]);useEffect(()=>{if(isStatic)return;if(isDragging){document.addEventListener(\"mousemove\",handleMouseMove);document.addEventListener(\"mouseup\",handleMouseUp);}return()=>{document.removeEventListener(\"mousemove\",handleMouseMove);document.removeEventListener(\"mouseup\",handleMouseUp);};},[isDragging,handleMouseMove,handleMouseUp,isStatic]);const handleClick=useCallback(e=>{if(!isDragging){updatePosition(e.clientX);}},[isDragging,updatePosition]);return /*#__PURE__*/_jsxs(\"div\",{ref:containerRef,style:{position:\"relative\",width:\"100%\",height:\"100%\",overflow:\"hidden\",cursor:isDragging?\"ew-resize\":\"pointer\",userSelect:\"none\",borderRadius:\"12px\",boxShadow:\"0 8px 32px rgba(0, 0, 0, 0.12)\"},onClick:isStatic?undefined:handleClick,onMouseDown:isStatic?undefined:handleMouseDown,children:[/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",top:0,left:0,width:\"100%\",height:\"100%\",backgroundImage:`url(${afterImage.src})`,backgroundSize:\"cover\",backgroundPosition:\"center\"}}),/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",top:0,left:0,width:\"100%\",height:\"100%\",backgroundImage:`url(${beforeImage.src})`,backgroundSize:\"cover\",backgroundPosition:\"center\",clipPath:`inset(0 ${100-position}% 0 0)`}}),showLabels&&/*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",top:\"16px\",left:\"16px\",padding:\"8px 12px\",backgroundColor:labelBackground,color:labelColor,borderRadius:\"8px\",backdropFilter:\"blur(8px)\",border:\"1px solid rgba(255, 255, 255, 0.2)\",...labelFont,opacity:position>20?1:.7,transition:\"all 0.3s cubic-bezier(0.4, 0, 0.2, 1)\"},children:beforeLabel}),/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",top:\"16px\",right:\"16px\",padding:\"8px 12px\",backgroundColor:labelBackground,color:labelColor,borderRadius:\"8px\",backdropFilter:\"blur(8px)\",border:\"1px solid rgba(255, 255, 255, 0.2)\",...labelFont,opacity:position<80?1:.7,transition:\"all 0.3s cubic-bezier(0.4, 0, 0.2, 1)\"},children:afterLabel})]}),/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",top:0,left:`${position}%`,width:`${sliderWidth}px`,height:\"100%\",backgroundColor:sliderColor,transform:`translateX(-${sliderWidth/2}px)`,cursor:\"ew-resize\",boxShadow:\"0 0 20px rgba(255, 255, 255, 0.6), 0 0 40px rgba(255, 255, 255, 0.3)\",transition:isDragging?\"none\":\"all 0.2s ease\"}}),showHandle&&/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",top:\"50%\",left:`${position}%`,width:`${handleSize}px`,height:`${handleSize}px`,backgroundColor:handleColor,borderRadius:\"50%\",transform:`translate(-50%, -50%) ${isDragging?\"scale(1.1)\":\"scale(1)\"}`,cursor:\"ew-resize\",boxShadow:\"0 4px 20px rgba(0, 0, 0, 0.25), 0 0 0 3px rgba(255, 255, 255, 0.3)\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",border:\"3px solid white\",transition:isDragging?\"none\":\"all 0.2s cubic-bezier(0.4, 0, 0.2, 1)\"},children:/*#__PURE__*/_jsxs(\"svg\",{width:handleSize*.5,height:handleSize*.5,viewBox:\"0 0 24 24\",fill:\"none\",stroke:\"white\",strokeWidth:\"2.5\",strokeLinecap:\"round\",strokeLinejoin:\"round\",children:[/*#__PURE__*/_jsx(\"path\",{d:\"M9 18l6-6-6-6\"}),/*#__PURE__*/_jsx(\"path\",{d:\"M15 6l-6 6 6 6\"})]})})]});}addPropertyControls(BeforeAfterSlider,{beforeImage:{type:ControlType.ResponsiveImage,title:\"Before Image\"},afterImage:{type:ControlType.ResponsiveImage,title:\"After Image\"},beforeLabel:{type:ControlType.String,title:\"Before Label\",defaultValue:\"Before\"},afterLabel:{type:ControlType.String,title:\"After Label\",defaultValue:\"After\"},showLabels:{type:ControlType.Boolean,title:\"Show Labels\",defaultValue:true,enabledTitle:\"Show\",disabledTitle:\"Hide\"},initialPosition:{type:ControlType.Number,title:\"Initial Position\",defaultValue:50,min:0,max:100,unit:\"%\"},sliderColor:{type:ControlType.Color,title:\"Slider Color\",defaultValue:\"#FFFFFF\"},sliderWidth:{type:ControlType.Number,title:\"Slider Width\",defaultValue:3,min:1,max:10,unit:\"px\"},showHandle:{type:ControlType.Boolean,title:\"Show Handle\",defaultValue:true,enabledTitle:\"Show\",disabledTitle:\"Hide\"},handleColor:{type:ControlType.Color,title:\"Handle Color\",defaultValue:\"#FFFFFF\",hidden:({showHandle})=>!showHandle},handleSize:{type:ControlType.Number,title:\"Handle Size\",defaultValue:40,min:20,max:80,unit:\"px\",hidden:({showHandle})=>!showHandle},labelFont:{type:ControlType.Font,title:\"Label Font\",defaultValue:{fontSize:\"14px\",variant:\"Semibold\",letterSpacing:\"-0.01em\",lineHeight:\"1em\"},controls:\"extended\",defaultFontType:\"sans-serif\",hidden:({showLabels})=>!showLabels},labelColor:{type:ControlType.Color,title:\"Label Text Color\",defaultValue:\"#FFFFFF\",hidden:({showLabels})=>!showLabels},labelBackground:{type:ControlType.Color,title:\"Label Background\",defaultValue:\"rgba(0, 0, 0, 0.7)\",hidden:({showLabels})=>!showLabels}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"BeforeAfterSlider\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"fixed\",\"framerSupportedLayoutHeight\":\"fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./BeforeAfterSlider.map"],"mappings":"4NAIG,SAAwB,EAAkB,EAAM,CAAC,GAAK,CAAC,cAAY,CAAC,IAAI,sEAAsE,IAAI,QAAQ,EAAE,aAAW,CAAC,IAAI,oEAAoE,IAAI,OAAO,EAAE,cAAY,aAAW,aAAW,kBAAgB,cAAY,cAAY,cAAY,aAAW,aAAW,YAAU,aAAW,mBAAiB,EAAY,EAAaA,EAAO,IAAI,EAAO,CAAC,EAAS,GAAaC,EAAS,CAAe,EAAO,CAAC,EAAW,GAAeA,EAAS,EAAK,EAAQ,EAAS,EAAoB,EAAQ,EAAeC,EAAY,GAAS,CAAC,GAAG,CAAC,EAAa,QAAQ,OAAO,IAAM,EAAK,EAAa,QAAQ,sBAAsB,EAAQ,EAAE,EAAQ,EAAK,KA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