{"version":3,"file":"AspectRatioImage.lLEfChup.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/hqcmimd3MaJxC1GCJjtZ/8pWazaFDO9lUu15DXOZc/AspectRatioImage.js"],"sourcesContent":["// Image component that automatically adapts to the aspect ratio of the loaded image\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{useState,useEffect,startTransition}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function AspectRatioImage(props){const{image={src:\"https://framerusercontent.com/images/GfGkADagM4KEibNcIiRUWlfrR0.jpg\",alt:\"Gradient 1 - Blue\"},objectFit=\"contain\",borderRadius=0,shadow=false}=props;const[aspectRatio,setAspectRatio]=useState(null);const[imageLoaded,setImageLoaded]=useState(false);useEffect(()=>{if(!image.src)return;const img=new Image;img.onload=()=>{const ratio=img.naturalWidth/img.naturalHeight;startTransition(()=>{setAspectRatio(ratio);setImageLoaded(true);});};img.onerror=()=>{startTransition(()=>{setAspectRatio(16/9)// fallback ratio\n;setImageLoaded(true);});};img.src=image.src;},[image.src]);const isFixedWidth=props?.style?.width===\"100%\";const isFixedHeight=props?.style?.height===\"100%\";// If both dimensions are fixed, use the container size\nif(isFixedWidth&&isFixedHeight){return /*#__PURE__*/_jsx(\"div\",{style:{...props.style,position:\"relative\",overflow:\"hidden\",borderRadius:`${borderRadius}px`,boxShadow:shadow?\"0 4px 12px rgba(0, 0, 0, 0.1)\":\"none\"},children:/*#__PURE__*/_jsx(\"img\",{src:image.src,alt:image.alt||\"\",style:{width:\"100%\",height:\"100%\",objectFit,display:\"block\"}})});}// Auto-sizing based on aspect ratio\nconst containerStyle={position:\"relative\",overflow:\"hidden\",borderRadius:`${borderRadius}px`,boxShadow:shadow?\"0 4px 12px rgba(0, 0, 0, 0.1)\":\"none\",opacity:imageLoaded?1:0,transition:\"opacity 0.3s ease\"};if(aspectRatio){if(isFixedWidth){// Fixed width, auto height\ncontainerStyle.width=props.style?.width;containerStyle.height=`calc(${props.style?.width} / ${aspectRatio})`;}else if(isFixedHeight){// Fixed height, auto width\ncontainerStyle.height=props.style?.height;containerStyle.width=`calc(${props.style?.height} * ${aspectRatio})`;}else{// Both auto - use intrinsic size with max constraints\ncontainerStyle.maxWidth=\"100%\";containerStyle.maxHeight=\"100vh\";containerStyle.aspectRatio=aspectRatio.toString();containerStyle.width=\"auto\";containerStyle.height=\"auto\";}}else{// Loading state\ncontainerStyle.width=isFixedWidth?props.style?.width:\"300px\";containerStyle.height=isFixedHeight?props.style?.height:\"200px\";containerStyle.backgroundColor=\"#f0f0f0\";containerStyle.display=\"flex\";containerStyle.alignItems=\"center\";containerStyle.justifyContent=\"center\";}return /*#__PURE__*/_jsx(\"div\",{style:containerStyle,children:aspectRatio?/*#__PURE__*/_jsx(\"img\",{src:image.src,alt:image.alt||\"\",style:{width:\"100%\",height:\"100%\",objectFit,display:\"block\"}}):/*#__PURE__*/_jsx(\"div\",{style:{color:\"#999\",fontSize:\"14px\",fontFamily:\"system-ui, sans-serif\"},children:\"Loading...\"})});}addPropertyControls(AspectRatioImage,{image:{type:ControlType.ResponsiveImage,title:\"Image\"},objectFit:{type:ControlType.Enum,title:\"Object Fit\",options:[\"contain\",\"cover\",\"fill\",\"none\",\"scale-down\"],optionTitles:[\"Contain\",\"Cover\",\"Fill\",\"None\",\"Scale Down\"],defaultValue:\"contain\"},borderRadius:{type:ControlType.Number,title:\"Border Radius\",defaultValue:0,min:0,max:50,step:1,unit:\"px\"},shadow:{type:ControlType.Boolean,title:\"Shadow\",defaultValue:false,enabledTitle:\"On\",disabledTitle:\"Off\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"AspectRatioImage\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\"}},\"__FramerMetadata__\":{\"type\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