{"version":3,"file":"Before_After_Image.DmMmD_W1.mjs","names":["React.useState","React.useRef"],"sources":["https:/framerusercontent.com/modules/eoEHSDsS5AZPk3RKR19M/GebKyKTXOymJ4qnbBRmF/Before_After_Image.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * @framerDisableUnlink\n */export function ImageSlider(props){const{beforeImage,afterImage,sliderThumbImage,showDivider,dividerColor,dividerThickness,sliderSize}=props;const[sliderValue,setSliderValue]=React.useState(50);const sliderRef=React.useRef(null);const handleSliderChange=event=>{setSliderValue(event.target.value);};const handleMouseDown=event=>{event.preventDefault();const slider=sliderRef.current;const sliderRect=slider.getBoundingClientRect();const offsetX=event.clientX-sliderRect.left;const percentage=offsetX/sliderRect.width*100;setSliderValue(percentage);const handleMouseMove=moveEvent=>{const newOffsetX=moveEvent.clientX-sliderRect.left;const newPercentage=newOffsetX/sliderRect.width*100;setSliderValue(Math.min(Math.max(newPercentage,0),100));};const handleMouseUp=()=>{document.removeEventListener(\"mousemove\",handleMouseMove);document.removeEventListener(\"mouseup\",handleMouseUp);};document.addEventListener(\"mousemove\",handleMouseMove);document.addEventListener(\"mouseup\",handleMouseUp);};const containerStyle={position:\"relative\",width:\"100%\",height:\"100%\",overflow:\"hidden\"};const imageStyle={position:\"absolute\",top:0,left:0,width:\"100%\",height:\"100%\",objectFit:\"cover\"};const sliderStyle={appearance:\"none\",width:\"100%\",height:`${sliderSize}px`,background:\"transparent\",outline:\"none\",opacity:\"1\",transition:\"opacity .2s\",position:\"absolute\",top:\"50%\",left:\"50%\",transform:\"translate(-50%, -50%)\"};const sliderThumbStyle={width:`${sliderSize}px`,height:`${sliderSize}px`,backgroundImage:`url(${sliderThumbImage})`,backgroundSize:\"cover\",backgroundPosition:\"center\",cursor:\"pointer\",position:\"absolute\",left:`${sliderValue}%`,top:\"50%\",transform:\"translate(-50%, -50%)\"};const beforeImageStyle={position:\"absolute\",top:0,left:0,width:\"100%\",height:\"100%\",clipPath:`inset(0 ${100-sliderValue}% 0 0)`};const afterImageStyle={position:\"absolute\",top:0,right:0,width:\"100%\",height:\"100%\",clipPath:`inset(0 0 0 ${sliderValue}%)`};const dividerStyle={position:\"absolute\",top:0,left:`${sliderValue}%`,width:dividerThickness,height:\"100%\",backgroundColor:dividerColor,transform:\"translateX(-50%)\",pointerEvents:\"none\",zIndex:1};return /*#__PURE__*/_jsxs(\"div\",{style:containerStyle,children:[/*#__PURE__*/_jsx(\"div\",{style:beforeImageStyle,children:/*#__PURE__*/_jsx(\"img\",{src:beforeImage,style:imageStyle,alt:\"Before\"})}),/*#__PURE__*/_jsx(\"div\",{style:afterImageStyle,children:/*#__PURE__*/_jsx(\"img\",{src:afterImage,style:imageStyle,alt:\"After\"})}),showDivider&&/*#__PURE__*/_jsx(\"div\",{style:dividerStyle}),/*#__PURE__*/_jsx(\"div\",{ref:sliderRef,style:sliderStyle,onMouseDown:handleMouseDown,role:\"slider\",\"aria-valuenow\":sliderValue,\"aria-valuemin\":\"0\",\"aria-valuemax\":\"100\",tabIndex:\"0\",children:/*#__PURE__*/_jsx(\"div\",{style:sliderThumbStyle})})]});}ImageSlider.defaultProps={beforeImage:\"\",afterImage:\"\",sliderThumbImage:\"https://www.pngmagic.com/product_images/double-arrow-png.png\",showDivider:true,dividerColor:\"#ffffff\",dividerThickness:\"1px\",sliderSize:15};addPropertyControls(ImageSlider,{beforeImage:{title:\"Before Image\",type:ControlType.Image,defaultValue:ImageSlider.defaultProps.beforeImage},afterImage:{title:\"After Image\",type:ControlType.Image,defaultValue:ImageSlider.defaultProps.afterImage},sliderThumbImage:{title:\"Slider Thumb Image\",type:ControlType.Image,defaultValue:ImageSlider.defaultProps.sliderThumbImage},showDivider:{title:\"Show Divider\",type:ControlType.Boolean,defaultValue:ImageSlider.defaultProps.showDivider},dividerColor:{title:\"Divider Color\",type:ControlType.Color,defaultValue:ImageSlider.defaultProps.dividerColor},dividerThickness:{title:\"Divider Thickness\",type:ControlType.Number,defaultValue:parseFloat(ImageSlider.defaultProps.dividerThickness),unit:\"px\",min:0,max:10,step:.1},sliderSize:{title:\"Slider Size\",type:ControlType.Number,defaultValue:ImageSlider.defaultProps.sliderSize,unit:\"px\",min:10,max:200,step:1,description:\"[via SegmentUI](https://www.segmentUI.com)\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"ImageSlider\":{\"type\":\"reactComponent\",\"name\":\"ImageSlider\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerDisableUnlink\":\"\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Before_After_Image.map"],"mappings":"mLAEG,SAAgB,EAAY,EAAM,CAAC,GAAK,CAAC,cAAY,aAAW,mBAAiB,cAAY,eAAa,mBAAiB,cAAY,EAAW,CAAC,EAAY,GAAgBA,EAAe,GAAG,CAAO,EAAUC,EAAa,KAAK,CAA6E,EAAgB,GAAO,CAAC,EAAM,gBAAgB,CAAgC,IAAM,EAAxB,EAAU,QAAgC,uBAAuB,CAA2F,GAA5E,EAAM,QAAQ,EAAW,MAA8B,EAAW,MAAM,IAA8B,CAAC,IAAM,EAAgB,GAAW,CAAoD,IAAM,GAAxC,EAAU,QAAQ,EAAW,MAAoC,EAAW,MAAM,IAAI,EAAe,KAAK,IAAI,KAAK,IAAI,EAAc,EAAE,CAAC,IAAI,CAAC,EAAS,MAAkB,CAAC,SAAS,oBAAoB,YAAY,EAAgB,CAAC,SAAS,oBAAoB,UAAU,EAAc,EAAG,SAAS,iBAAiB,YAAY,EAAgB,CAAC,SAAS,iBAAiB,UAAU,EAAc,EAAS,EAAe,CAAC,SAAS,WAAW,MAAM,OAAO,OAAO,OAAO,SAAS,SAAS,CAAO,EAAW,CAAC,SAAS,WAAW,IAAI,EAAE,KAAK,EAAE,MAAM,OAAO,OAAO,OAAO,UAAU,QAAQ,CAAO,EAAY,CAAC,WAAW,OAAO,MAAM,OAAO,OAAO,GAAG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