{"version":3,"file":"GradientHeadline_1.Be-3envn.mjs","names":["useMemo"],"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//# sourceMapp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