{"version":3,"file":"RichText.2iIbFSTi.mjs","names":["useMemo"],"sources":["https:/framerusercontent.com/modules/gvS9otVnqR0nGLafLPqL/NBDSZdb5VMFhi5zGqdyF/RichText.js"],"sourcesContent":["// Text component with customizable styling for text between brackets [] and bullet points with (-)\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useMemo}from\"react\";/**\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n */export default function RichText(props){const{text,defaultColor,defaultFont,bracketColor,bracketFont,bracketBackground,bracketPadding,bracketBorderRadius,bracketBorder,textAlign,balanceText,bulletSvg='<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"100%\" height=\"100%\" viewBox=\"0 0 24 24\"><path fill=\"currentColor\" d=\"M19 3H5c-1.103 0-2 .897-2 2v14c0 1.103.897 2 2 2h14c1.103 0 2-.897 2-2V5c0-1.103-.897-2-2-2zm-7.933 13.481-3.774-3.774 1.414-1.414 2.226 2.226 4.299-5.159 1.537 1.28-5.702 6.841z\"/></svg>',bulletSize,bulletGap,bulletColor,enableTruncation,maxLines,style}=props;const parsedContent=useMemo(()=>{const lines=text.split(\"\\n\");return lines.map(line=>{const isBulletPoint=line.trim().startsWith(\"(-)\");const lineText=isBulletPoint?line.trim().slice(3).trim():line;const isEmpty=lineText.trim()===\"\";const regex=/\\[([^\\]]+)\\]/g;const parts=[];let lastIndex=0;let match;while((match=regex.exec(lineText))!==null){if(match.index>lastIndex){parts.push({text:lineText.slice(lastIndex,match.index),isBracketed:false});}parts.push({text:match[1],isBracketed:true});lastIndex=regex.lastIndex;}if(lastIndex<lineText.length){parts.push({text:lineText.slice(lastIndex),isBracketed:false});}return{isBulletPoint,parts,isEmpty};});},[text]);return /*#__PURE__*/_jsx(\"div\",{style:{...style,position:\"relative\",width:style?.width===\"100%\"?\"100%\":\"max-content\",height:style?.height===\"100%\"?\"100%\":\"auto\",minWidth:style?.width===\"100%\"?undefined:\"max-content\"},children:/*#__PURE__*/_jsx(\"div\",{style:{...defaultFont,color:defaultColor,whiteSpace:\"pre-wrap\",wordBreak:\"break-word\",textAlign:textAlign,...balanceText&&{textWrap:\"balance\",WebkitTextWrap:\"balance\"},...enableTruncation&&{display:\"-webkit-box\",WebkitLineClamp:maxLines,WebkitBoxOrient:\"vertical\",overflow:\"hidden\"}},children:parsedContent.map((line,lineIndex)=>{if(line.isEmpty){return /*#__PURE__*/_jsx(\"div\",{style:{height:\"1em\"}},lineIndex);}if(line.isBulletPoint){return /*#__PURE__*/_jsxs(\"div\",{style:{display:\"flex\",alignItems:\"flex-start\",gap:`${bulletGap}px`,marginBottom:lineIndex<parsedContent.length-1?\"0.5em\":0,justifyContent:textAlign===\"center\"?\"center\":textAlign===\"right\"?\"flex-end\":\"flex-start\"},children:[/*#__PURE__*/_jsx(\"div\",{style:{width:`${bulletSize}px`,height:`${bulletSize}px`,flexShrink:0,color:bulletColor,marginTop:\"0.15em\"},dangerouslySetInnerHTML:{__html:bulletSvg}}),/*#__PURE__*/_jsx(\"span\",{style:{flex:1},children:line.parts.map((part,partIndex)=>{if(part.isBracketed){return /*#__PURE__*/_jsx(\"span\",{style:{...bracketFont,color:bracketColor,backgroundColor:bracketBackground,padding:`${bracketPadding}px`,borderRadius:`${bracketBorderRadius}px`,border:bracketBorder},children:part.text},partIndex);}return /*#__PURE__*/_jsx(\"span\",{children:part.text},partIndex);})})]},lineIndex);}return /*#__PURE__*/_jsx(\"div\",{children:line.parts.map((part,partIndex)=>{if(part.isBracketed){return /*#__PURE__*/_jsx(\"span\",{style:{...bracketFont,color:bracketColor,backgroundColor:bracketBackground,padding:`${bracketPadding}px`,borderRadius:`${bracketBorderRadius}px`,border:bracketBorder},children:part.text},partIndex);}return /*#__PURE__*/_jsx(\"span\",{children:part.text},partIndex);})},lineIndex);})})});}addPropertyControls(RichText,{text:{type:ControlType.String,title:\"Text\",defaultValue:\"Hello [World]! This is a [customizable] text component.\\n\\n(-) First bullet point with [styled] text\\n(-) Second bullet point\\n(-) Third bullet point with [multiple] [styles]\",displayTextArea:true},textAlign:{type:ControlType.Enum,title:\"Text Align\",options:[\"left\",\"center\",\"right\"],optionTitles:[\"Left\",\"Center\",\"Right\"],defaultValue:\"left\",displaySegmentedControl:true},balanceText:{type:ControlType.Boolean,title:\"Balance Text\",defaultValue:false,enabledTitle:\"On\",disabledTitle:\"Off\"},defaultColor:{type:ControlType.Color,title:\"Default Color\",defaultValue:\"#000000\"},defaultFont:{type:ControlType.Font,title:\"Default Font\",defaultValue:{fontSize:\"15px\",variant:\"Medium\",letterSpacing:\"-0.01em\",lineHeight:\"1.3em\"},controls:\"extended\",defaultFontType:\"sans-serif\"},bracketColor:{type:ControlType.Color,title:\"Bracket Text Color\",defaultValue:\"#FFFFFF\"},bracketFont:{type:ControlType.Font,title:\"Bracket Font\",defaultValue:{fontSize:\"15px\",variant:\"Semibold\",letterSpacing:\"-0.01em\",lineHeight:\"1.3em\"},controls:\"extended\",defaultFontType:\"sans-serif\"},bracketBackground:{type:ControlType.Color,title:\"Bracket Background\",defaultValue:\"#000000\"},bracketPadding:{type:ControlType.Number,title:\"Bracket Padding\",defaultValue:4,min:0,max:20,step:1,unit:\"px\"},bracketBorderRadius:{type:ControlType.Number,title:\"Bracket Radius\",defaultValue:4,min:0,max:20,step:1,unit:\"px\"},bracketBorder:{type:ControlType.String,title:\"Bracket Border\",defaultValue:\"none\",placeholder:\"1px solid #000\"},bulletSvg:{type:ControlType.String,title:\"Bullet SVG\",defaultValue:'<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"100%\" height=\"100%\" viewBox=\"0 0 24 24\"><path fill=\"currentColor\" d=\"M19 3H5c-1.103 0-2 .897-2 2v14c0 1.103.897 2 2 2h14c1.103 0 2-.897 2-2V5c0-1.103-.897-2-2-2zm-7.933 13.481-3.774-3.774 1.414-1.414 2.226 2.226 4.299-5.159 1.537 1.28-5.702 6.841z\"/></svg>',displayTextArea:true},bulletSize:{type:ControlType.Number,title:\"Bullet Size\",defaultValue:20,min:8,max:48,step:1,unit:\"px\"},bulletGap:{type:ControlType.Number,title:\"Bullet Gap\",defaultValue:8,min:0,max:32,step:1,unit:\"px\"},bulletColor:{type:ControlType.Color,title:\"Bullet Color\",defaultValue:\"#000000\"},enableTruncation:{type:ControlType.Boolean,title:\"Truncate Text\",defaultValue:false,enabledTitle:\"On\",disabledTitle:\"Off\"},maxLines:{type:ControlType.Number,title:\"Max Lines\",defaultValue:3,min:1,max:20,step:1,displayStepper:true,hidden:({enableTruncation})=>!enableTruncation}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"RichText\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"any\",\"framerSupportedLayoutWidth\":\"any\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./RichText.map"],"mappings":"iLAIG,SAAwB,EAAS,EAAM,CAAC,GAAK,CAAC,OAAK,eAAa,cAAY,eAAa,cAAY,oBAAkB,iBAAe,sBAAoB,gBAAc,YAAU,cAAY,YAAU,kTAAkT,aAAW,YAAU,cAAY,mBAAiB,WAAS,SAAO,EAAY,EAAcA,MAAyB,EAAK,MAAM;EAAK,CAAc,IAAI,GAAM,CAAC,IAAM,EAAc,EAAK,MAAM,CAAC,WAAW,MAAM,CAAO,EAAS,EAAc,EAAK,MAAM,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,EAAW,EAAQ,EAAS,MAAM,GAAG,GAAS,EAAM,gBAAsB,EAAM,EAAE,CAAK,EAAU,EAAM,EAAM,MAAO,EAAM,EAAM,KAAK,EAAS,IAAI,MAAS,EAAM,MAAM,GAAW,EAAM,KAAK,CAAC,KAAK,EAAS,MAAM,EAAU,EAAM,MAAM,CAAC,YAAY,GAAM,CAAC,CAAE,EAAM,KAAK,CAAC,KAAK,EAAM,GAAG,YAAY,GAAK,CAAC,CAAC,EAAU,EAAM,UAAyG,OAA3F,EAA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