{
  "version": 3,
  "sources": ["ssg:https://framerusercontent.com/modules/MQ3eN0meZVSV1TrezwqZ/mzpmkDkhQIIsecBPIeno/Text_highlighter.js"],
  "sourcesContent": ["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useEffect,useState,useRef}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * @framerDisableUnlink\n *\n * @framerSupportedLayoutWidth any\n * @framerIntrinsicWidth auto\n * @framerSupportedLayoutHeight any\n * @framerIntrinsicHeight auto\n */export default function AnimatedHighlighter(props){const[isVisible,setIsVisible]=useState(false);const elementRef=useRef(null);useEffect(()=>{const calculateTriggerPoint=()=>{switch(props.triggerPosition){case\"top\":return window.innerHeight*.2;case\"center\":return window.innerHeight*.5;case\"bottom\":return window.innerHeight*.8;default:return window.innerHeight*.8;}};const handleScroll=()=>{if(elementRef.current){const rect=elementRef.current.getBoundingClientRect();const triggerPoint=calculateTriggerPoint();setIsVisible(rect.top<=triggerPoint+props.triggerOffset);}};window.addEventListener(\"scroll\",handleScroll);handleScroll();return()=>window.removeEventListener(\"scroll\",handleScroll);},[props.triggerPosition,props.triggerOffset]);const highlightText=(text,highlight,color)=>{if(!highlight)return text;const parts=text.split(new RegExp(`(${highlight})`,\"gi\"));return parts.map((part,index)=>{if(part.toLowerCase()===highlight.toLowerCase()){return /*#__PURE__*/_jsxs(\"span\",{style:{padding:\"0 4px\",borderRadius:\"2px\",position:\"relative\",isolation:\"isolate\",display:\"inline-block\",color:props.fontColor},children:[part,props.animate&&/*#__PURE__*/_jsx(\"span\",{style:{position:\"absolute\",inset:0,backgroundColor:color,borderRight:props.showCursor?`${props.cursorThickness}px solid ${props.cursorColor}`:\"none\",transform:isVisible?\"scaleX(1)\":\"scaleX(0)\",transformOrigin:\"left\",transition:\"transform 0.5s ease-out\",zIndex:-1}}),!props.animate&&/*#__PURE__*/_jsx(\"span\",{style:{position:\"absolute\",inset:0,backgroundColor:color,borderRight:props.showCursor?`${props.cursorThickness}px solid ${props.cursorColor}`:\"none\",zIndex:-1}})]},index);}return /*#__PURE__*/_jsx(\"span\",{style:{color:props.fontColor},children:part});});};return /*#__PURE__*/_jsx(\"div\",{ref:elementRef,style:{...props.font},children:highlightText(props.text,props.highlightPhrase,props.highlightColor)});}AnimatedHighlighter.defaultProps={text:\"This is a sample text with highlighted words\",highlightPhrase:\"highlighted\",highlightColor:\"#FFE082\",fontColor:\"#000000\",animate:true,showCursor:false,cursorColor:\"#000000\",cursorThickness:2,triggerPosition:\"bottom\",triggerOffset:0};addPropertyControls(AnimatedHighlighter,{text:{type:ControlType.String,title:\"Text\"},highlightPhrase:{type:ControlType.String,title:\"Highlight Phrase\"},highlightColor:{type:ControlType.Color,title:\"Highlight Color\"},fontColor:{type:ControlType.Color,title:\"Font Color\"},animate:{type:ControlType.Boolean,title:\"Animate\",defaultValue:true},showCursor:{type:ControlType.Boolean,title:\"Show Cursor\",hidden:props=>!props.animate},cursorColor:{type:ControlType.Color,title:\"Cursor Color\",hidden:props=>!props.animate||!props.showCursor},cursorThickness:{type:ControlType.Number,title:\"Cursor Thickness\",min:1,max:10,step:1,hidden:props=>!props.animate||!props.showCursor},triggerPosition:{type:ControlType.Enum,title:\"Trigger Position\",options:[\"top\",\"center\",\"bottom\"],optionTitles:[\"Top\",\"Center\",\"Bottom\"],hidden:props=>!props.animate},triggerOffset:{type:ControlType.Number,title:\"Trigger Offset\",min:-500,max:500,step:10,hidden:props=>!props.animate},font:{type:ControlType.Font,controls:\"extended\",title:\"Font Style\",description:\"v1.1 \\n[via SegmentUI](https://www.segmentUI.com)\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"AnimatedHighlighter\",\"slots\":[],\"annotations\":{\"framerDisableUnlink\":\"*\",\"framerSupportedLayoutWidth\":\"any\",\"framerIntrinsicHeight\":\"auto\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"any\",\"framerIntrinsicWidth\":\"auto\"}},\"__FramerMetad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G,KAAK,EAAE,OAAOrB,GAAO,CAACA,EAAM,SAAS,CAACA,EAAM,UAAU,EAAE,gBAAgB,CAAC,KAAKqB,EAAY,KAAK,MAAM,mBAAmB,QAAQ,CAAC,MAAM,SAAS,QAAQ,EAAE,aAAa,CAAC,MAAM,SAAS,QAAQ,EAAE,OAAOrB,GAAO,CAACA,EAAM,OAAO,EAAE,cAAc,CAAC,KAAKqB,EAAY,OAAO,MAAM,iBAAiB,IAAI,KAAK,IAAI,IAAI,KAAK,GAAG,OAAOrB,GAAO,CAACA,EAAM,OAAO,EAAE,KAAK,CAAC,KAAKqB,EAAY,KAAK,SAAS,WAAW,MAAM,aAAa,YAAY;AAAA,2CAAmD,CAAC,CAAC",
  "names": ["AnimatedHighlighter", "props", "isVisible", "setIsVisible", "ye", "elementRef", "pe", "ue", "calculateTriggerPoint", "window", "handleScroll", "rect", "triggerPoint", "highlightText", "text", "highlight", "color", "part", "index", "u", "p", "addPropertyControls", "ControlType"]
}
