{"version":3,"file":"HighlightText.CXav0eYe.mjs","names":["useMemo","__esmMin","pe","c","init_jsx_runtime","init_npm_react_18_3_1","init_framer_motion_DhsWWWsN","motion","addPropertyControls","init_framer_CN96F41L","ControlType","HighlightText","props","Tag","tag","wordsToHighlight","highlightWords","word","processedText","parts","currentIndex","text","foundMatch","earliestMatch","index","selectedAnimation","animationType","style","font","textColor","part","enableAnimation","highlightColor","highlightTextColor","highlightBorderRadius","highlightPaddingY","highlightPaddingX","highlightMarginX","init_HighlightText"],"sources":["https:/framerusercontent.com/modules/e3ZNJLuPizfOPoMAfITP/oALd4okcifxaqE7LYdn0/HighlightText.js"],"sourcesContent":["// Highlighting Text Component - Allows users to emphasize specific words or phrases within a sentence using customizable background highlights\n//\n// Oct 2026 update: adds a \"Tag\" option (Paragraph, H1, H2, H3) so the text can\n// be marked as a page heading for search engines and AI tools. The look does\n// not change: heading tags inherit the component's own font, size, weight and\n// spacing instead of the browser's default heading styles. Default is\n// Paragraph, so existing instances are unchanged until you pick a tag.\n// Use H1 once per page, for the page's main title.\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{motion}from\"framer-motion\";import{addPropertyControls,ControlType}from\"framer\";import{useMemo}from\"react\";/**\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight auto\n */export default function HighlightText(props){const{text,highlightWords,highlightColor,textColor,highlightTextColor,font,padding,backgroundColor,borderRadius,highlightBorderRadius,highlightPaddingY,highlightPaddingX,highlightMarginX,enableAnimation,animationType,textAlign,tag=\"p\",style}=props;const Tag=[\"p\",\"h1\",\"h2\",\"h3\"].includes(tag)?tag:\"p\";const wordsToHighlight=useMemo(()=>{if(!highlightWords.trim())return[];return highlightWords.split(\",\").map(word=>word.trim().toLowerCase()).filter(word=>word.length>0);},[highlightWords]);const processedText=useMemo(()=>{if(wordsToHighlight.length===0){return[{text,isHighlighted:false}];}const parts=[];let currentIndex=0;while(currentIndex<text.length){let foundMatch=false;let earliestMatch={index:text.length,word:\"\",length:0};// Find the earliest match from current position\nfor(const word of wordsToHighlight){const index=text.toLowerCase().indexOf(word,currentIndex);if(index!==-1&&index<earliestMatch.index){earliestMatch={index,word:text.substring(index,index+word.length),length:word.length};foundMatch=true;}}if(foundMatch){// Add non-highlighted text before the match\nif(earliestMatch.index>currentIndex){parts.push({text:text.substring(currentIndex,earliestMatch.index),isHighlighted:false});}// Add highlighted text\nparts.push({text:earliestMatch.word,isHighlighted:true});currentIndex=earliestMatch.index+earliestMatch.length;}else{// No more matches, add remaining text\nparts.push({text:text.substring(currentIndex),isHighlighted:false});break;}}return parts;},[text,wordsToHighlight]);const animationVariants={fade:{initial:{opacity:0},animate:{opacity:1},transition:{duration:.5}},slide:{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:.5}}};const selectedAnimation=animationVariants[animationType];return /*#__PURE__*/_jsx(\"div\",{style:{...style,position:\"relative\",width:\"100%\",padding,backgroundColor,borderRadius,boxSizing:\"border-box\",...font,color:textColor},children:/*#__PURE__*/_jsx(Tag,{style:{// Reset browser heading styles so H1/H2/H3 look exactly\n// like the component's own font settings.\nmargin:0,padding:0,fontFamily:\"inherit\",fontSize:\"inherit\",fontWeight:\"inherit\",fontStyle:\"inherit\",lineHeight:\"inherit\",letterSpacing:\"inherit\",textTransform:\"inherit\",color:\"inherit\",whiteSpace:\"pre-wrap\",wordBreak:\"break-word\",overflowWrap:\"break-word\",width:\"100%\",textAlign},children:processedText.map((part,index)=>{if(part.isHighlighted){if(enableAnimation){return /*#__PURE__*/_jsx(motion.span,{initial:selectedAnimation.initial,whileInView:selectedAnimation.animate,viewport:{once:true,amount:.5},transition:selectedAnimation.transition,style:{backgroundColor:highlightColor,color:highlightTextColor,borderRadius:highlightBorderRadius,padding:`${highlightPaddingY}px ${highlightPaddingX}px`,margin:`0 ${highlightMarginX}px`,display:\"inline\",boxDecorationBreak:\"clone\",WebkitBoxDecorationBreak:\"clone\"},children:part.text},index);}return /*#__PURE__*/_jsx(\"span\",{style:{backgroundColor:highlightColor,color:highlightTextColor,borderRadius:highlightBorderRadius,padding:`${highlightPaddingY}px ${highlightPaddingX}px`,margin:`0 ${highlightMarginX}px`,boxDecorationBreak:\"clone\",WebkitBoxDecorationBreak:\"clone\"},children:part.text},index);}return /*#__PURE__*/_jsx(\"span\",{children:part.text},index);})})});}addPropertyControls(HighlightText,{text:{type:ControlType.String,title:\"Text\",defaultValue:\"The simplicity of this tool has given me real confidence in managing SEO for my clients, and it's an absolute steal vs other platforms on the market.\",displayTextArea:true},highlightWords:{type:ControlType.String,title:\"Highlight Words\",defaultValue:\"simplicity, real confidence, absolute steal\",placeholder:\"word1, word2, phrase\"},highlightColor:{type:ControlType.Color,title:\"Highlight Color\",defaultValue:\"#FFBB00\"},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#000000\"},highlightTextColor:{type:ControlType.Color,title:\"Highlight Text Color\",defaultValue:\"#000000\"},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"15px\",variant:\"Medium\",letterSpacing:\"-0.01em\",lineHeight:\"1.5em\"}},padding:{type:ControlType.Padding,title:\"Padding\",defaultValue:\"20px\"},backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"rgba(255, 255, 255, 0)\"},borderRadius:{type:ControlType.Number,title:\"Container Radius\",defaultValue:0,min:0,max:100,step:1,unit:\"px\"},highlightBorderRadius:{type:ControlType.Number,title:\"Highlight Radius\",defaultValue:4,min:0,max:100,step:1,unit:\"px\"},highlightPaddingY:{type:ControlType.Number,title:\"Highlight Pad Y\",defaultValue:2,min:0,max:24,step:1,unit:\"px\"},highlightPaddingX:{type:ControlType.Number,title:\"Highlight Pad X\",defaultValue:6,min:0,max:48,step:1,unit:\"px\"},highlightMarginX:{type:ControlType.Number,title:\"Highlight Space\",defaultValue:1,min:0,max:24,step:1,unit:\"px\"},enableAnimation:{type:ControlType.Boolean,title:\"Animation\",defaultValue:false,enabledTitle:\"On\",disabledTitle:\"Off\"},animationType:{type:ControlType.Enum,title:\"Animation Type\",options:[\"fade\",\"slide\"],optionTitles:[\"Fade In\",\"Slide Up\"],defaultValue:\"fade\",displaySegmentedControl:true,hidden:({enableAnimation})=>!enableAnimation},textAlign:{type:ControlType.Enum,title:\"Text Align\",options:[\"left\",\"center\",\"right\"],optionTitles:[\"Left\",\"Center\",\"Right\"],defaultValue:\"left\",displaySegmentedControl:true},tag:{type:ControlType.Enum,title:\"Tag\",options:[\"p\",\"h1\",\"h2\",\"h3\"],optionTitles:[\"Paragraph\",\"H1\",\"H2\",\"H3\"],defaultValue:\"p\",description:\"For search engines and AI tools only, the look doesn't change. Use H1 once per page for the main title.\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"HighlightText\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./HighlightText.map"],"mappings":"A,2NAWG,SAAwBW,EAAc,EAAM,CAAC,GAAK,CAAC,OAAK,iBAAe,iBAAe,YAAU,qBAAmB,OAAK,UAAQ,kBAAgB,eAAa,wBAAsB,oBAAkB,oBAAkB,mBAAiB,kBAAgB,gBAAc,YAAU,MAAI,IAAI,SAAOC,EAAYC,EAAI,CAAC,IAAI,KAAK,KAAK,IAAI,CAAC,CAAC,SAASC,CAAG,EAAEA,EAAI,IAAUC,EAAiBf,MAAiBgB,EAAe,KAAK,EAAkBA,EAAe,MAAM,GAAG,CAAC,CAAC,IAAI,GAAMC,EAAK,KAAK,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,OAAO,GAAMA,EAAK,OAAO,CAAC,EAAnG,CAAC,EAAsG,CAACD,CAAc,CAAC,EAAQE,EAAclB,MAAY,CAAC,GAAGe,EAAiB,SAAS,EAAG,MAAM,CAAC,CAAC,OAAK,cAAc,EAA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