{"version":3,"file":"RichText.DOMi2RXX.mjs","names":["useMemo"],"sources":["https:/framerusercontent.com/modules/cKLCsG8vYGz9vH5aFwpo/snMyVssLHxUmbdAoLCEX/RichText.js"],"sourcesContent":["// Text component with slot-based custom element nesting, tag selection, typography, color, gap, and user select\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useMemo}from\"react\";/**\n * RichText\n *\n * A text component that allows nesting custom elements (components, icons, etc.) between words using a slot symbol. Supports tag selection, typography, color, gap, and user select.\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight auto\n */export default function RichText(props){const{text=\"Hello [] world []!\",tag=\"h1\",slotSymbol=\"[]\",children,typography,color,gap,userSelect,style,alignment=\"left\",elementAlign=\"baseline\"}=props;// Split text by slot symbol, keep slots\nconst parts=useMemo(()=>{if(!slotSymbol)return[text];const regex=new RegExp(`(${slotSymbol.replace(/[.*+?^${}()|[\\]\\\\]/g,\"\\\\$&\")})`,\"g\");return text.split(regex);},[text,slotSymbol]);// Interleave children into slots\nlet childIndex=0;const showElements=props.showElements===undefined?true:props.showElements;const content=parts.map((part,i)=>{if(part===slotSymbol){const child=Array.isArray(children)?children[childIndex]:children;childIndex++;if(child&&showElements){return /*#__PURE__*/_jsx(\"span\",{style:{display:\"inline-block\",verticalAlign:elementAlign,margin:gap?`0 ${gap/2}px`:undefined},children:child},`slot-${i}`);}else{// Show the slot symbol as text if not connected\nreturn /*#__PURE__*/_jsx(\"span\",{style:{margin:gap?`0 ${gap/2}px`:undefined},children:slotSymbol},`slot-missing-${i}`);}}return /*#__PURE__*/_jsx(\"span\",{style:{margin:gap?`0 ${gap/2}px`:undefined},children:part},`text-${i}`);});const Tag=tag;return /*#__PURE__*/_jsx(Tag,{style:{...style,...typography,color,display:\"block\",userSelect,width:\"100%\",minWidth:0,wordBreak:\"break-word\",margin:0,textAlign:alignment},children:content});}addPropertyControls(RichText,{text:{type:ControlType.String,title:\"Text\",defaultValue:\"Hello [] world []!\",displayTextArea:true},tag:{type:ControlType.Enum,title:\"Tag\",options:[\"h1\",\"h2\",\"h3\",\"h4\",\"h5\",\"h6\",\"p\",\"span\",\"div\"],optionTitles:[\"H1\",\"H2\",\"H3\",\"H4\",\"H5\",\"H6\",\"Paragraph\",\"Span\",\"Div\"],defaultValue:\"h1\",displaySegmentedControl:false},slotSymbol:{type:ControlType.String,title:\"Slot Symbol\",defaultValue:\"[]\",placeholder:\"[]\"},children:{type:ControlType.Slot,title:\"Custom Elements\",maxCount:10},showElements:{type:ControlType.Boolean,title:\"Show Elements\",defaultValue:true,enabledTitle:\"Show\",disabledTitle:\"Hide\"},typography:{type:ControlType.Font,title:\"Typography\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"40px\",variant:\"Bold\",letterSpacing:\"-0.04em\",lineHeight:\"1em\"}},color:{type:ControlType.Color,title:\"Color\",defaultValue:\"#000000\"},gap:{type:ControlType.Number,title:\"Gap\",defaultValue:8,min:0,max:64,step:1,unit:\"px\"},userSelect:{type:ControlType.Enum,title:\"User Select\",options:[\"auto\",\"none\"],optionTitles:[\"Auto\",\"None\"],defaultValue:\"auto\",displaySegmentedControl:true},alignment:{type:ControlType.Enum,title:\"Alignment\",options:[\"left\",\"center\",\"right\"],optionTitles:[\"Left\",\"Center\",\"Right\"],defaultValue:\"left\",displaySegmentedControl:true},elementAlign:{type:ControlType.Enum,title:\"Element Align\",options:[\"baseline\",\"middle\"],optionTitles:[\"Baseline\",\"Middle\"],defaultValue:\"baseline\",displaySegmentedControl:true}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"RichText\",\"slots\":[\"children\"],\"annotations\":{\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerSupportedLayoutHeight\":\"auto\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./RichText.map"],"mappings":"0KAQG,SAAwB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