{"version":3,"file":"ImageZoom.BDcWNJOd.mjs","names":["useState","useRef","useCallback"],"sources":["https:/framerusercontent.com/modules/n3ebJIJP7b9wpy7zPKGJ/V3szORCixyDboRuMsuj6/ImageZoom.js"],"sourcesContent":["// Image zoom component that allows users to zoom in on photos by clicking or hovering\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,useRef,useCallback,startTransition}from\"react\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";/**\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */export default function ImageZoom(props){const{image={src:\"https://framerusercontent.com/images/GfGkADagM4KEibNcIiRUWlfrR0.jpg\",alt:\"Zoomable image\"},zoomLevel=2,zoomMode=\"click\",showZoomIndicator=true,indicatorColor=\"#FFFFFF\",transitionDuration=300,objectFit=\"cover\",borderRadius=0,focalPointX=50,focalPointY=50}=props;const[isZoomed,setIsZoomed]=useState(false);const[position,setPosition]=useState({x:focalPointX,y:focalPointY});const containerRef=useRef(null);const isStatic=useIsStaticRenderer();const handleMouseMove=useCallback(e=>{if(!containerRef.current)return;if(zoomMode===\"click\"&&!isZoomed)return;const rect=containerRef.current.getBoundingClientRect();const x=(e.clientX-rect.left)/rect.width*100;const y=(e.clientY-rect.top)/rect.height*100;startTransition(()=>{setPosition({x,y});});},[isZoomed,zoomMode]);const handleClick=useCallback(()=>{if(zoomMode===\"click\"){startTransition(()=>{setIsZoomed(prev=>!prev);});}},[zoomMode]);const handleMouseEnter=useCallback(()=>{if(zoomMode===\"hover\"){startTransition(()=>{setIsZoomed(true);});}},[zoomMode]);const handleMouseLeave=useCallback(()=>{if(zoomMode===\"hover\"){startTransition(()=>{setIsZoomed(false);});}},[zoomMode]);const scale=isZoomed?zoomLevel:1;const transformOrigin=`${position.x}% ${position.y}%`;return /*#__PURE__*/_jsxs(\"div\",{ref:containerRef,style:{position:\"relative\",width:\"100%\",height:\"100%\",overflow:\"hidden\",cursor:isStatic?\"default\":zoomMode===\"click\"?isZoomed?\"zoom-out\":\"zoom-in\":\"zoom-in\",borderRadius:`${borderRadius}px`},onClick:isStatic?undefined:handleClick,onMouseMove:isStatic?undefined:handleMouseMove,onMouseEnter:isStatic?undefined:handleMouseEnter,onMouseLeave:isStatic?undefined:handleMouseLeave,children:[/*#__PURE__*/_jsx(\"img\",{src:image.src,alt:image.alt,style:{width:\"100%\",height:\"100%\",objectFit:objectFit,transform:`scale(${scale})`,transformOrigin:transformOrigin,transition:`transform ${transitionDuration}ms ease-out`,userSelect:\"none\",pointerEvents:\"none\",borderRadius:`${borderRadius}px`},draggable:false}),showZoomIndicator&&!isZoomed&&!isStatic&&/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",bottom:16,right:16,width:32,height:32,borderRadius:\"50%\",backgroundColor:\"rgba(0, 0, 0, 0.5)\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",pointerEvents:\"none\"},children:/*#__PURE__*/_jsxs(\"svg\",{width:\"20\",height:\"20\",viewBox:\"0 0 24 24\",fill:\"none\",stroke:indicatorColor,strokeWidth:\"2\",strokeLinecap:\"round\",strokeLinejoin:\"round\",children:[/*#__PURE__*/_jsx(\"circle\",{cx:\"11\",cy:\"11\",r:\"8\"}),/*#__PURE__*/_jsx(\"path\",{d:\"m21 21-4.35-4.35\"}),/*#__PURE__*/_jsx(\"line\",{x1:\"11\",y1:\"8\",x2:\"11\",y2:\"14\"}),/*#__PURE__*/_jsx(\"line\",{x1:\"8\",y1:\"11\",x2:\"14\",y2:\"11\"})]})})]});}addPropertyControls(ImageZoom,{image:{type:ControlType.ResponsiveImage,title:\"Image\"},objectFit:{type:ControlType.Enum,title:\"Image Fit\",options:[\"cover\",\"contain\",\"fill\",\"none\",\"scale-down\"],optionTitles:[\"Cover\",\"Contain\",\"Fill\",\"None\",\"Scale Down\"],defaultValue:\"cover\"},borderRadius:{type:ControlType.Number,title:\"Radius\",defaultValue:0,min:0,max:100,step:1,unit:\"px\",displayStepper:false},focalPointX:{type:ControlType.Number,title:\"Focal Point X\",defaultValue:50,min:0,max:100,step:1,unit:\"%\",displayStepper:false},focalPointY:{type:ControlType.Number,title:\"Focal Point Y\",defaultValue:50,min:0,max:100,step:1,unit:\"%\",displayStepper:false},zoomLevel:{type:ControlType.Number,title:\"Zoom Level\",defaultValue:2,min:1.5,max:5,step:.5,displayStepper:false},zoomMode:{type:ControlType.Enum,title:\"Zoom Mode\",options:[\"click\",\"hover\"],optionTitles:[\"Click\",\"Hover\"],defaultValue:\"click\",displaySegmentedControl:true},transitionDuration:{type:ControlType.Number,title:\"Transition\",defaultValue:300,min:100,max:1e3,step:50,unit:\"ms\",displayStepper:false},showZoomIndicator:{type:ControlType.Boolean,title:\"Zoom Indicator\",defaultValue:true,enabledTitle:\"Show\",disabledTitle:\"Hide\"},indicatorColor:{type:ControlType.Color,title:\"Indicator Color\",defaultValue:\"#FFFFFF\",hidden:({showZoomIndicator})=>!showZoomIndicator}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ImageZoom\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"fixed\",\"framerSupportedLayoutHeight\":\"fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ImageZoom.map"],"mappings":"8MAIG,SAAwB,EAAU,EAAM,CAAC,GAAK,CAAC,QAAM,CAAC,IAAI,sEAAsE,IAAI,iBAAiB,CAAC,YAAU,EAAE,WAAS,QAAQ,oBAAkB,GAAK,iBAAe,UAAU,qBAAmB,IAAI,YAAU,QAAQ,eAAa,EAAE,cAAY,GAAG,cAAY,IAAI,EAAW,CAAC,EAAS,GAAaA,EAAS,GAAM,CAAM,CAAC,EAAS,GAAaA,EAAS,CAAC,EAAE,EAAY,EAAE,EAAY,CAAC,CAAO,EAAaC,EAAO,KAAK,CAAO,EAAS,GAAqB,CAAO,EAAgBC,EAAY,GAAG,CAAiC,GAA7B,CAAC,EAA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