{"version":3,"file":"HighlightedText.guMePC47.mjs","names":["useRef"],"sources":["https:/framerusercontent.com/modules/LZ100btEbz9nF0oxlFfb/SK67KHHyNEFbQpg5L6qb/HighlightedText.js"],"sourcesContent":["// Highlighted Text Component\n// Text between *asterisks* gets a customizable background color and skew\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";import{motion,useAnimation,useInView}from\"framer-motion\";import{useRef,useEffect}from\"react\";/**\n * HighlightedText\n *\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function HighlightedText(props){const{text,highlightColor,skew,font,style}=props;const isStatic=useIsStaticRenderer();const ref=useRef(null);const inView=useInView(ref,{once:true,margin:\"-10% 0px -10% 0px\"});const controls=useAnimation();// Split text by *...* and mark those as highlighted, trim leading/trailing whitespace for highlighted parts\nconst parts=[];let lastIndex=0;let match;const regex=/\\*(.*?)\\*/g;let idx=0;while((match=regex.exec(text))!==null){if(match.index>lastIndex){parts.push({text:text.slice(lastIndex,match.index),highlight:false,key:idx++});}// Remove leading/trailing whitespace from highlighted part, but preserve in non-highlighted\nconst highlightedText=match[1].replace(/^\\s+|\\s+$/g,\"\");parts.push({text:highlightedText,highlight:true,key:idx++});lastIndex=match.index+match[0].length;}if(lastIndex<text.length){parts.push({text:text.slice(lastIndex),highlight:false,key:idx++});}// Animation variants for the background\n// Underline effect: animate width from 0% to 100% for background\nfunction getUnderlineVariants(direction){const skewStr=`skewX(${skew}deg)`;if(direction===\"left-to-right\"){return{hidden:{width:\"0%\",left:0,right:\"auto\",opacity:1,transform:skewStr},visible:{width:\"100%\",left:0,right:\"auto\",opacity:1,transform:skewStr}};}else if(direction===\"right-to-left\"){return{hidden:{width:\"0%\",left:\"auto\",right:0,opacity:1,transform:skewStr},visible:{width:\"100%\",left:\"auto\",right:0,opacity:1,transform:skewStr}};}else if(direction===\"center-out\"){return{hidden:{width:\"0%\",left:\"50%\",right:\"auto\",opacity:1,transform:skewStr,translateX:\"-50%\"},visible:{width:\"100%\",left:0,right:\"auto\",opacity:1,transform:skewStr,translateX:\"0%\"}};}// fallback\nreturn{hidden:{width:\"0%\",left:0,right:\"auto\",opacity:1,transform:skewStr},visible:{width:\"100%\",left:0,right:\"auto\",opacity:1,transform:skewStr}};}const underlineVariants=getUnderlineVariants(\"left-to-right\");const shouldAnimate=isStatic?false:inView;useEffect(()=>{if(!shouldAnimate)return;if(inView)controls.start(\"visible\");else controls.start(\"hidden\");},[inView,shouldAnimate,controls]);const Tag=props.accessibilityTag||\"span\";// Only attach ref if Tag is 'span', otherwise attach to the observer span\n// For useInView, always use a span as the observer target\n// Render the text using a span for observer and Tag for semantics, but actual content is always styled as before\nreturn /*#__PURE__*/_jsx(\"span\",{ref:ref,style:{display:\"block\",width:props.fill||props.highlightMode===\"bold\"?\"100%\":\"max-content\"},children:/*#__PURE__*/_jsx(Tag,{style:{all:\"unset\",display:props.fill||props.highlightMode===\"bold\"?\"block\":\"inline-block\",...style,...font,color:props.textColor,width:props.fill||props.highlightMode===\"bold\"?\"100%\":\"max-content\",minWidth:props.fill||props.highlightMode===\"bold\"?undefined:\"max-content\",textAlign:props.textAlign},children:parts.map(part=>part.highlight?props.highlightMode===\"background\"?/*#__PURE__*/_jsxs(\"span\",{style:{position:\"relative\",display:\"inline-block\",borderRadius:props.borderRadius,verticalAlign:\"baseline\",padding:0,margin:0},children:[/*#__PURE__*/_jsx(motion.span,{initial:shouldAnimate?\"hidden\":false,animate:shouldAnimate?controls:false,variants:underlineVariants,transition:{duration:props.animationSpeed||.6,ease:\"easeOut\"},style:{background:highlightColor,display:\"block\",position:\"absolute\",top:0,left:0,bottom:0,height:\"100%\",zIndex:0,borderRadius:props.borderRadius,pointerEvents:\"none\",transform:`skewX(${skew}deg)`},\"aria-hidden\":\"true\"}),/*#__PURE__*/_jsx(\"span\",{style:{position:\"relative\",display:\"inline-block\",padding:\"0 4px\",zIndex:1,background:\"none\",color:shouldAnimate&&inView?props.highlightActiveColor:props.textColor,transition:\"color 0.3s cubic-bezier(.4,0,.2,1)\"},children:part.text})]},part.key):/*#__PURE__*/_jsx(\"span\",{style:{fontWeight:700,color:props.boldColor,padding:\"0 4px\",borderRadius:props.borderRadius,background:\"none\",display:\"inline\",whiteSpace:\"normal\",boxSizing:\"border-box\"},children:part.text},part.key):/*#__PURE__*/_jsx(\"span\",{style:props.highlightMode===\"bold\"?{display:\"inline\",color:props.textColor,fontWeight:font?.fontWeight,whiteSpace:\"normal\",boxSizing:\"border-box\"}:undefined,children:part.text},part.key))})});}addPropertyControls(HighlightedText,{text:{type:ControlType.String,title:\"Text\",defaultValue:\"This is a *highlighted* word.\",displayTextArea:true},fill:{type:ControlType.Boolean,title:\"Fill Width\",defaultValue:false,enabledTitle:\"Fill\",disabledTitle:\"Auto\"},highlightMode:{type:ControlType.Enum,title:\"Highlight Mode\",options:[\"background\",\"bold\"],optionTitles:[\"Background\",\"Bold\"],defaultValue:\"background\",displaySegmentedControl:true},highlightColor:{type:ControlType.Color,title:\"Highlight Color\",defaultValue:\"#E9F4F5\",hidden:({highlightMode})=>highlightMode!==\"background\"},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#222222\"},skew:{type:ControlType.Number,title:\"Skew\",defaultValue:-15,min:-45,max:45,step:1,unit:\"deg\",hidden:({highlightMode})=>highlightMode!==\"background\"},highlightActiveColor:{type:ControlType.Color,title:\"Active Text Color\",defaultValue:\"#212836\",hidden:({highlightMode})=>highlightMode!==\"background\"},boldColor:{type:ControlType.Color,title:\"Bold Color\",defaultValue:\"#212836\",hidden:({highlightMode})=>highlightMode!==\"bold\"},boldAlign:{type:ControlType.Enum,title:\"Bold Align\",options:[\"left\",\"center\",\"right\"],optionTitles:[\"Left\",\"Center\",\"Right\"],defaultValue:\"left\",displaySegmentedControl:true,hidden:({highlightMode})=>highlightMode!==\"bold\"},textAlign:{type:ControlType.Enum,title:\"Text Align\",options:[\"left\",\"center\",\"right\"],optionTitles:[\"Left\",\"Center\",\"Right\"],defaultValue:\"left\",displaySegmentedControl:true},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"22px\",variant:\"Semibold\",letterSpacing:\"-0.01em\",lineHeight:\"1.2em\"}},borderRadius:{type:ControlType.Number,title:\"Background Radius\",defaultValue:4,min:0,max:32,step:1,unit:\"px\",hidden:({highlightMode})=>highlightMode!==\"background\"},accessibilityTag:{type:ControlType.Enum,title:\"Tag\",options:[\"span\",\"p\",\"h1\",\"h2\",\"h3\",\"h4\",\"h5\",\"h6\"],optionTitles:[\"span\",\"p\",\"h1\",\"h2\",\"h3\",\"h4\",\"h5\",\"h6\"],defaultValue:\"span\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"HighlightedText\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"auto\",\"framerSupportedLayoutWidth\":\"auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./HighlightedText.map"],"mappings":"kQAOG,SAAwB,EAAgB,EAAM,CAAC,GAAK,CAAC,OAAK,iBAAe,OAAK,OAAK,SAAO,EAAY,EAAS,EAAoB,EAAQ,EAAIA,EAAO,IAAI,EAAQ,EAAO,EAAU,EAAI,CAAC,KAAK,GAAK,OAAO,mBAAmB,CAAC,EAAQ,EAAS,EAAa,EACxP,EAAM,CAAC,EAAM,EAAU,EAAM,EAAY,EAAM,aAAiB,EAAI,EAAE,MAAO,EAAM,EAAM,KAAK,CAAI,KAAK,MAAK,CAAI,EAAM,MAAM,GAAW,EAAM,KAAK,CAAC,KAAK,EAAK,MAAM,EAAU,EAAM,KAAK,EAAE,UAAU,GAAM,IAAI,GAAK,CAAC,EAC1N,IAAM,EAAgB,EAAM,EAAE,CAAC,QAAQ,aAAa,EAAE,EAAE,EAAM,KAAK,CAAC,KAAK,EAAgB,UAAU,GAAK,IA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