{"version":3,"file":"ImageMaskText.CSNzkWXW.mjs","names":["useMemo"],"sources":["https:/framerusercontent.com/modules/5IA0vVLHlsvj8t4zfEEM/i139eZk9nZNPHbNMQpWI/ImageMaskText.js"],"sourcesContent":["// Customizable text component with image mask, adjustable image fit (cover, contain, percent), and font controls\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useMemo}from\"react\";/**\n * ImageMaskText\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function ImageMaskText(props){const{text,image,imageFit,imagePercent,font,style,backgroundColor}=props;// Calculate background size and position\nconst bgSize=useMemo(()=>{if(imageFit===\"cover\")return\"cover\";if(imageFit===\"contain\")return\"contain\";// percent\nreturn`${imagePercent}%`;},[imageFit,imagePercent]);const bgPosition=useMemo(()=>{if(imageFit===\"percent\")return\"center\";return\"center\";},[imageFit]);// Map text alignment to flex justifyContent\nconst justifyContent=useMemo(()=>{const textAlign=font?.textAlign||\"center\";switch(textAlign){case\"left\":return\"flex-start\";case\"right\":return\"flex-end\";case\"center\":default:return\"center\";}},[font?.textAlign]);const useImageMask=image&&image.src&&imageFit!==undefined&&image.src!==\"\";return /*#__PURE__*/_jsx(\"div\",{style:{...style,width:\"100%\",height:\"100%\",display:\"flex\",alignItems:\"center\",justifyContent:justifyContent,position:\"relative\",overflow:\"hidden\",backgroundColor},children:/*#__PURE__*/_jsx(\"span\",{style:{...font,width:\"max-content\",minWidth:0,...useImageMask?{backgroundImage:`url(${image.src})`,backgroundSize:bgSize,backgroundPosition:bgPosition,backgroundRepeat:\"no-repeat\",WebkitBackgroundClip:\"text\",WebkitTextFillColor:\"transparent\",backgroundClip:\"text\",color:\"transparent\"}:{color:props.textColor},display:\"inline-block\",textAlign:font?.textAlign||\"center\",lineHeight:font?.lineHeight||1.1,fontSize:font?.fontSize||40,fontWeight:font?.fontWeight,fontStyle:font?.fontStyle},\"aria-label\":text,children:text})});}addPropertyControls(ImageMaskText,{text:{type:ControlType.String,title:\"Text\",defaultValue:\"Masked Text\"},image:{type:ControlType.ResponsiveImage,title:\"Image\"},imageFit:{type:ControlType.Enum,title:\"Image Fit\",options:[\"cover\",\"contain\",\"percent\"],optionTitles:[\"Cover\",\"Contain\",\"Percent\"],defaultValue:\"cover\",displaySegmentedControl:true},imagePercent:{type:ControlType.Number,title:\"Image %\",defaultValue:100,min:10,max:200,step:1,unit:\"%\",hidden:({imageFit})=>imageFit!==\"percent\"},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:64,variant:\"Bold\",letterSpacing:\"-0.04em\",lineHeight:\"1em\",textAlign:\"center\"}},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#000000\",description:\"Component by [Joseph Alexander](https://framer.link/0iVitu4)\"},backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"#FFFFFF\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ImageMaskText\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ImageMaskText.map"],"mappings":"0KAMG,SAAwB,EAAc,EAAM,CAAC,GAAK,CAAC,OAAK,QAAM,WAAS,eAAa,OAAK,QAAM,mBAAiB,EAC7G,EAAOA,MAAgB,IAAW,QAAc,QAAW,IAAW,UAAgB,UACtF,GAAG,EAAa,GAAK,CAAC,EAAS,CAAY,CAAC,EAAQ,EAAWA,MAA2C,SAA0B,CAAC,CAAQ,CAAC,EAC9I,EAAeA,MAAY,CAA2C,OAA1B,GAAM,WAAW,SAAS,CAAkB,IAAI,OAAO,MAAM,aAAa,IAAI,QAAQ,MAAM,WAAwB,QAAQ,MAAM,QAAS,CAAC,EAAE,CAAC,GAAM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