{"version":3,"file":"GradientHeadline_1.Dp1iegAO.mjs","names":["useMemo","__esmMin","pe","init_npm_react_18_3_1","init_jsx_runtime","H","c","init_framer_CKT6jEEQ","addPropertyControls","ControlType","GradientHeadline","props","highlightList","highlightWords","w","wordRegex","words","text","renderWords","word","i","result","str","lastIndex","highlightRegex","match","idx","gradientAngle","gradientFrom","gradientTo","font","Tag","tagOptions","tag","elementStyle","style","textColor","init_GradientHeadline_1","t"],"sources":["https:/framerusercontent.com/modules/dOzjXPWEU8uL9rA0CkFa/GQ7uaOzrDDyEMZ1Ok9fE/GradientHeadline_1.js"],"sourcesContent":["// Headline component with gradient highlight for selected words, tag selection, full font controls, and reusable text via prop\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{useMemo,createElement}from\"react\";import{addPropertyControls,ControlType}from\"framer\";const tagOptions=[\"h1\",\"h2\",\"h3\",\"h4\",\"h5\",\"h6\",\"p\"];/**\n * Headline with Gradient Highlight\n *\n * - Select tag (h1-h6, p)\n * - Full font controls\n * - Highlight single/multiple words with gradient\n * - Text is reusable via prop\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight auto\n */export default function GradientHeadline(props){const{text,tag,highlightWords,gradientFrom,gradientTo,gradientAngle,font,style,textColor,padding}=props;// Parse highlightWords (comma-separated or array)\nconst highlightList=useMemo(()=>{if(!highlightWords)return[];if(Array.isArray(highlightWords))return highlightWords;return highlightWords.split(\",\").map(w=>w.trim()).filter(Boolean);},[highlightWords]);// Split text into words, preserving spaces\nconst wordRegex=/\\S+|\\s+/g;const words=useMemo(()=>{if(!text)return[];return text.match(wordRegex)||[];},[text]);// Render with highlights\nconst renderWords=()=>{if(!highlightList.length)return words.map((word,i)=>/*#__PURE__*/_jsx(\"span\",{children:word},i));// Join all words into a string, find all highlight substrings, and split accordingly\nlet result=[];let str=text;let lastIndex=0;// Build a regex to match any of the highlight phrases (escape special chars)\nconst highlightRegex=new RegExp(highlightList.map(w=>w.replace(/[.*+?^${}()|[\\]\\\\]/g,\"\\\\$&\")).join(\"|\"),\"gi\");let match;let idx=0;while((match=highlightRegex.exec(str))!==null){if(match.index>lastIndex){result.push(/*#__PURE__*/_jsx(\"span\",{children:str.slice(lastIndex,match.index)},idx++));}result.push(/*#__PURE__*/_jsx(\"span\",{style:{backgroundImage:`linear-gradient(${gradientAngle}deg, ${gradientFrom}, ${gradientTo})`,WebkitBackgroundClip:\"text\",WebkitTextFillColor:\"transparent\",backgroundClip:\"text\",color:undefined,fontWeight:font?.variant?.includes(\"Bold\")?\"bold\":undefined},children:match[0]},idx++));lastIndex=match.index+match[0].length;}if(lastIndex<str.length){result.push(/*#__PURE__*/_jsx(\"span\",{children:str.slice(lastIndex)},idx++));}return result;};const Tag=tagOptions.includes(tag)?tag:\"h1\";const elementStyle={...style,...font,margin:0,padding:padding,width:\"fit-content\",display:\"block\",color:textColor};return /*#__PURE__*/createElement(Tag,{style:elementStyle},renderWords());}addPropertyControls(GradientHeadline,{text:{type:ControlType.String,title:\"Text\",defaultValue:\"This is a gradient headline\",displayTextArea:true},tag:{type:ControlType.Enum,title:\"Tag\",options:tagOptions,optionTitles:tagOptions.map(t=>t.toUpperCase()),defaultValue:\"h1\"},highlightWords:{type:ControlType.String,title:\"Highlight Words\",placeholder:\"word1, word2\",defaultValue:\"gradient\",description:\"Comma-separated words to highlight\"},gradientFrom:{type:ControlType.Color,title:\"Gradient From\",defaultValue:\"#0099FF\"},gradientTo:{type:ControlType.Color,title:\"Gradient To\",defaultValue:\"#FF5588\"},gradientAngle:{type:ControlType.Number,title:\"Gradient Angle\",defaultValue:90,min:0,max:360,unit:\"deg\",step:1,displayStepper:true},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"40px\",variant:\"Bold\",letterSpacing:\"-0.04em\",lineHeight:\"1em\"}},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#000000\"},padding:{type:ControlType.Padding,title:\"Padding\",defaultValue:\"0px\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"GradientHeadline\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./GradientHeadline_1.map"],"mappings":"A,iLAWG,SAAwBU,EAAiB,EAAM,CAAC,GAAK,CAAC,OAAK,MAAI,iBAAe,eAAa,aAAW,gBAAc,OAAK,QAAM,YAAU,WAASC,EAC/IC,EAAcZ,MAAiBa,EAA2B,MAAM,QAAQA,CAAc,EAASA,EAAsBA,EAAe,MAAM,GAAG,CAAC,CAAC,IAAI,GAAGC,EAAE,KAAK,CAAC,CAAC,CAAC,OAAO,OAAO,EAA1H,CAAC,EAA6H,CAACD,CAAc,CAAC,EAClME,EAAU,WAAiBC,EAAMhB,MAAiBiB,GAAqBA,EAAK,MAAMF,CAAS,GAAG,CAAC,EAAI,CAACE,CAAI,CAAC,EACzGC,MAAgB,CAAC,GAAG,CAACN,EAAc,OAAO,OAAOI,EAAM,KAAK,EAAK,IAAiB,gBAAK,OAAO,CAAC,SAASG,CAAI,EAAEC,CAAC,CAAC,EACtH,IAAIC,EAAO,CAAC,EAAMC,EAAIL,EAASM,EAAU,EACnCC,EAAe,IAAI,OAAOZ,EAAc,IAAI,GAAGE,EAAE,QAAQ,sBAAsB,MAAM,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE,IAAI,EAAMW,EAAUC,EAAI,EAAE,MAAO,EAAMF,EAAe,KAAKF,CAAG,KAAK,MAASG,EAAM,MAAMF,GAAWF,EAAO,KAAkB,gBAAK,OAAO,CAAC,SAASC,EAAI,MAAMC,EAAUE,EAAM,KAAK,CAAC,EAAE,GAAK,CAAC,EAAGJ,EAAO,KAAkB,gBAAK,OAAO,CAAC,MAAM,CAAC,gBAAgB,mBAAmBM,EAAc,OAAOC,EA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