{"version":3,"file":"ImageComparisonSlider.Dqbe11Sj.mjs","names":["useRef","useState","useCallback"],"sources":["https:/framerusercontent.com/modules/Xj2skk4Pe7xjdzMCucgP/P0PbE7SMJ1sE9s1HEInH/ImageComparisonSlider.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useCallback,useEffect,useRef,useState,startTransition}from\"react\";/**\n * @framerIntrinsicWidth 500\n * @framerIntrinsicHeight 300\n */export default function ImageComparisonSlider(props){const{beforeImage={src:\"https://framerusercontent.com/images/GfGkADagM4KEibNcIiRUWlfrR0.jpg\"},afterImage={src:\"https://framerusercontent.com/images/aNsAT3jCvt4zglbWCUoFe33Q.jpg\"},beforeLabel=\"Before\",afterLabel=\"After\",initialPosition=50,dividerColor=\"#FFFFFF\",dividerWidth=2,handleColor=\"#FFFFFF\",handleIconColor=\"#FFFFFF\",handleSize=40,iconOffset=10,borderRadius=0,labelBottom=36,labelFontSize=16,paddingV=12,paddingH=24,minWidth=0,showHandle=true,showHandleBackground=true}=props;const containerRef=useRef(null);const[position,setPosition]=useState(initialPosition);const[isDragging,setIsDragging]=useState(false);const updatePosition=useCallback(e=>{if(!containerRef.current)return;const rect=containerRef.current.getBoundingClientRect();const x=e.clientX-rect.left;const newPos=Math.max(0,Math.min(100,x/rect.width*100));startTransition(()=>setPosition(newPos));},[]);const handleMouseDown=e=>{e.preventDefault();setIsDragging(true);};useEffect(()=>{const handleMouseMove=e=>isDragging&&updatePosition(e);const handleMouseUp=()=>setIsDragging(false);if(isDragging){window.addEventListener(\"mousemove\",handleMouseMove);window.addEventListener(\"mouseup\",handleMouseUp);}return()=>{window.removeEventListener(\"mousemove\",handleMouseMove);window.removeEventListener(\"mouseup\",handleMouseUp);};},[isDragging,updatePosition]);const labelBaseStyle={position:\"absolute\",bottom:`${labelBottom}px`,padding:`${paddingV}px ${paddingH}px`,backgroundColor:\"white\",color:\"black\",borderRadius:\"8px\",fontSize:`${labelFontSize}px`,fontWeight:\"bold\",pointerEvents:\"none\",zIndex:5,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",minWidth:`${minWidth}px`,boxShadow:\"0 4px 12px rgba(0,0,0,0.15)\",transform:\"translateX(-50%)\",transition:\"opacity 0.2s ease-out, bottom 0.2s ease-out\",whiteSpace:\"nowrap\"};const beforeLabelPos=position/2;const afterLabelPos=position+(100-position)/2;return /*#__PURE__*/_jsxs(\"div\",{ref:containerRef,style:{position:\"relative\",width:\"100%\",height:\"100%\",overflow:\"hidden\",borderRadius:`${borderRadius}px`,userSelect:\"none\",cursor:\"ew-resize\"},onMouseDown:handleMouseDown,children:[/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",inset:0,backgroundImage:`url(${afterImage.src})`,backgroundSize:\"cover\",backgroundPosition:\"center\"}}),afterLabel&&/*#__PURE__*/_jsx(\"div\",{style:{...labelBaseStyle,left:`${afterLabelPos}%`,opacity:position>afterLabelPos-10?0:1},children:afterLabel}),/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",inset:0,backgroundImage:`url(${beforeImage.src})`,backgroundSize:\"cover\",backgroundPosition:\"center\",clipPath:`inset(0 ${100-position}% 0 0)`}}),beforeLabel&&/*#__PURE__*/_jsx(\"div\",{style:{...labelBaseStyle,left:`${beforeLabelPos}%`,opacity:position<beforeLabelPos+10?0:1},children:beforeLabel}),/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",top:0,bottom:0,left:`${position}%`,width:`${dividerWidth}px`,backgroundColor:dividerColor,transform:\"translateX(-50%)\",zIndex:10}}),showHandle&&/*#__PURE__*/_jsxs(\"div\",{style:{position:\"absolute\",top:\"50%\",left:`${position}%`,width:handleSize,height:handleSize,backgroundColor:showHandleBackground?handleColor:\"transparent\",borderRadius:\"50%\",transform:\"translate(-50%, -50%)\",zIndex:11,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",boxShadow:showHandleBackground?\"0 0 10px rgba(0,0,0,0.2)\":\"none\",gap:`${iconOffset*2}px`},children:[/*#__PURE__*/_jsx(\"svg\",{width:\"20\",height:\"20\",viewBox:\"0 0 24 24\",style:{transform:`translateX(-${iconOffset}px)`},children:/*#__PURE__*/_jsx(\"path\",{d:\"M13 7l-5 5 5 5\",fill:\"none\",stroke:handleIconColor,strokeWidth:\"2.5\",strokeLinecap:\"round\",strokeLinejoin:\"round\"})}),/*#__PURE__*/_jsx(\"svg\",{width:\"20\",height:\"20\",viewBox:\"0 0 24 24\",style:{transform:`translateX(${iconOffset}px)`},children:/*#__PURE__*/_jsx(\"path\",{d:\"M11 7l5 5-5 5\",fill:\"none\",stroke:handleIconColor,strokeWidth:\"2.5\",strokeLinecap:\"round\",strokeLinejoin:\"round\"})})]})]});}addPropertyControls(ImageComparisonSlider,{beforeImage:{type:ControlType.ResponsiveImage,title:\"Before Image\"},afterImage:{type:ControlType.ResponsiveImage,title:\"After Image\"},beforeLabel:{type:ControlType.String,title:\"Before Text\",defaultValue:\"Before\"},afterLabel:{type:ControlType.String,title:\"After Text\",defaultValue:\"After\"},labelFontSize:{type:ControlType.Number,title:\"Font Size\",defaultValue:16,min:10},paddingV:{type:ControlType.Number,title:\"Padding V\",defaultValue:12,min:0},paddingH:{type:ControlType.Number,title:\"Padding H\",defaultValue:24,min:0},minWidth:{type:ControlType.Number,title:\"Min Width\",defaultValue:0,min:0,max:300},labelBottom:{type:ControlType.Number,title:\"Distance Bottom\",defaultValue:36},dividerColor:{type:ControlType.Color,title:\"Line Color\",defaultValue:\"#FFFFFF\"},dividerWidth:{type:ControlType.Number,title:\"Line Width\",defaultValue:2,min:1,max:20},showHandle:{type:ControlType.Boolean,title:\"Show Handle\",defaultValue:true,enabledTitle:\"Yes\",disabledTitle:\"No\"},showHandleBackground:{type:ControlType.Boolean,title:\"Handle BG\",defaultValue:true,hidden:props=>!props.showHandle},handleColor:{type:ControlType.Color,title:\"Handle Color\",defaultValue:\"#FFFFFF\",hidden:props=>!props.showHandle||!props.showHandleBackground},handleIconColor:{type:ControlType.Color,title:\"Icon Color\",defaultValue:\"#FFFFFF\",hidden:props=>!props.showHandle},handleSize:{type:ControlType.Number,title:\"Handle Size\",defaultValue:40,min:20,max:120},iconOffset:{type:ControlType.Number,title:\"Icon Offset\",defaultValue:10,min:0,max:30},borderRadius:{type:ControlType.Number,title:\"Radius\",defaultValue:12}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ImageComparisonSlider\",\"slots\":[],\"annotations\":{\"framerIntrinsicHeight\":\"300\",\"framerIntrinsicWidth\":\"500\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ImageComparisonSlider.map"],"mappings":"2NAGG,SAAwB,EAAsB,EAAM,CAAC,GAAK,CAAC,cAAY,CAAC,IAAI,sEAAsE,CAAC,aAAW,CAAC,IAAI,oEAAoE,CAAC,cAAY,SAAS,aAAW,QAAQ,kBAAgB,GAAG,eAAa,UAAU,eAAa,EAAE,cAAY,UAAU,kBAAgB,UAAU,aAAW,GAAG,aAAW,GAAG,eAAa,EAAE,cAAY,GAAG,gBAAc,GAAG,WAAS,GAAG,WAAS,GAAG,WAAS,EAAE,aAAW,GAAK,uBAAqB,IAAM,EAAY,EAAaA,EAAO,KAAK,CAAM,CAAC,EAAS,GAAaC,EAAS,EAAgB,CAAM,CAAC,EAAW,GAAeA,EAAS,GAAM,CAAO,EAAeC,EAAY,GAAG,CAAC,GAAG,CAAC,EAAa,QAAQ,OAAO,IAAM,EAAK,EAAa,QAAQ,uBAAuB,CAAO,EAAE,EAAE,QAAQ,EAAK,KAAW,EAAO,KAAK,IAAI,EAAE,KAAK,IAAI,IAAI,EAAE,EAAK,MAAM,IAAI,CAAC,CAAC,MAAoB,EAAY,EAAO,CAAC,EAAG,EAAE,CAAC,CAAO,EAAgB,GAAG,CAAC,EAAE,gBAAgB,CAAC,EAAc,GAAK,EAAG,MAAc,CAAC,IAAM,EAAgB,GAAG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