{"version":3,"file":"HighlightKeywords.CgOdSVLU.mjs","names":[],"sources":["https:/framerusercontent.com/modules/iaSXYqibckKgrzFviksz/EgZ3O6spDXGni5AJucD5/HighlightKeywords.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType}from\"framer\";// Custom Component Built For Alpaca Health, in collaboration with Kind Heart.\n/**\n * @framerDisableUnlink\n */export function HighlightKeywords(props){const{text,keywords,keywordsAsString,useKeywordsString,font,fontSize,lineHeight,letterSpacing,fontColor,highlightColor,paddingHorizontal,paddingVertical,keywordColor,borderRadius,textAlign,borderColor,borderWidth,borderStyle}=props;const effectiveKeywords=useKeywordsString?keywordsAsString.split(\",\").map(k=>k.trim()).filter(k=>k!==\"\"):keywords;const customStyle={fontFamily:font.fontFamily,fontWeight:font.fontWeight,fontSize:fontSize+\"px\",lineHeight:lineHeight+\"em\",letterSpacing:letterSpacing+\"px\",color:fontColor,wordBreak:\"break-word\"};const highlightStyle={backgroundColor:highlightColor,padding:`${paddingVertical}px ${paddingHorizontal}px`,borderRadius:`${borderRadius}px`,margin:\"0 4px\",borderColor:borderColor,borderWidth:`${borderWidth}px`,borderStyle:borderStyle,display:\"inline\",color:keywordColor};const containerStyle={display:\"block\",justifyContent:\"center\",alignItems:\"center\",overflow:\"hidden\",padding:\"10px\",textAlign:textAlign};const highlightText=React.useMemo(()=>{if(effectiveKeywords.length===0)return text;let parts=text.split(new RegExp(`(${effectiveKeywords.join(\"|\")})`,\"gi\"));return parts.map((part,i)=>effectiveKeywords.find(keyword=>new RegExp(keyword,\"gi\").test(part))?/*#__PURE__*/_jsx(\"span\",{style:{...customStyle,...highlightStyle},children:part},i):/*#__PURE__*/_jsx(\"span\",{style:customStyle,children:part},i));},[text,effectiveKeywords,customStyle,highlightStyle]);return /*#__PURE__*/_jsx(\"div\",{style:containerStyle,children:highlightText});}HighlightKeywords.defaultProps={text:\"Highlight specific keywords in this text. You can align this text as you like.\",keywords:[\"specific\",\"keywords\"],keywordsAsString:\"specific,keywords\",useKeywordsString:false,font:{fontFamily:\"Inter\",fontWeight:\"Regular\"},fontSize:22,lineHeight:1.5,letterSpacing:\"0\",fontColor:\"#000000\",highlightColor:\"red\",paddingHorizontal:5,paddingVertical:5,keywordColor:\"#FFFFFF\",borderRadius:10,textAlign:\"left\",borderColor:\"black\",borderWidth:0,borderStyle:\"solid\"};addPropertyControls(HighlightKeywords,{text:{title:\"Text Content\",type:ControlType.String,defaultValue:HighlightKeywords.defaultProps.text},useKeywordsString:{type:ControlType.Boolean,title:\"Use Keywords String\",defaultValue:HighlightKeywords.defaultProps.useKeywordsString,description:\"Use comma-separated keywords string instead of array\",enabledTitle:\"String\",disabledTitle:\"Array\"},keywordsAsString:{title:\"Keywords String\",type:ControlType.String,defaultValue:HighlightKeywords.defaultProps.keywordsAsString,description:\"Comma-separated keywords\",hidden(props){return!props.useKeywordsString;}},keywords:{title:\"Keywords\",type:ControlType.Array,control:{type:ControlType.String},defaultValue:HighlightKeywords.defaultProps.keywords,hidden(props){return props.useKeywordsString;}},font:{title:\"Font\",type:ControlType.Font,defaultValue:HighlightKeywords.defaultProps.font},fontSize:{title:\"Font Size\",type:ControlType.Number,defaultValue:HighlightKeywords.defaultProps.fontSize,min:1},lineHeight:{title:\"Line Height\",type:ControlType.Number,defaultValue:HighlightKeywords.defaultProps.lineHeight,min:0,step:.1},letterSpacing:{title:\"Letter Spacing\",type:ControlType.Number,defaultValue:HighlightKeywords.defaultProps.letterSpacing,min:0},fontColor:{title:\"Font Color\",type:ControlType.Color,defaultValue:HighlightKeywords.defaultProps.fontColor},highlightColor:{title:\"Highlight Background Color\",type:ControlType.Color,defaultValue:HighlightKeywords.defaultProps.highlightColor},keywordColor:{title:\"Keyword Text Color\",type:ControlType.Color,defaultValue:HighlightKeywords.defaultProps.keywordColor},paddingHorizontal:{title:\"Padding Horizontal\",type:ControlType.Number,defaultValue:HighlightKeywords.defaultProps.paddingHorizontal,min:0,max:20,step:1},paddingVertical:{title:\"Padding Vertical\",type:ControlType.Number,defaultValue:HighlightKeywords.defaultProps.paddingVertical,min:0,max:20,step:1},borderRadius:{title:\"Border Radius\",type:ControlType.Number,defaultValue:HighlightKeywords.defaultProps.borderRadius,min:0,max:100,step:1},textAlign:{title:\"Text Alignment\",type:ControlType.Enum,options:[\"left\",\"center\",\"right\",\"justify\"],optionTitles:[\"Left\",\"Center\",\"Right\",\"Justify\"],defaultValue:HighlightKeywords.defaultProps.textAlign},borderColor:{title:\"Border Color\",type:ControlType.Color,defaultValue:HighlightKeywords.defaultProps.borderColor},borderWidth:{title:\"Border Width\",type:ControlType.Number,defaultValue:HighlightKeywords.defaultProps.borderWidth,min:0,max:10,step:1},borderStyle:{title:\"Border Style\",type:ControlType.Enum,options:[\"solid\",\"dotted\",\"dashed\",\"double\",\"groove\",\"ridge\",\"inset\",\"outset\"],optionTitles:[\"Solid\",\"Dotted\",\"Dashed\",\"Double\",\"Groove\",\"Ridge\",\"Inset\",\"Outset\"],defaultValue:HighlightKeywords.defaultProps.borderStyle,description:\"A component by Framer Maison\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"HighlightKeywords\":{\"type\":\"reactComponent\",\"name\":\"HighlightKeywords\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerDisableUnlink\":\"\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./HighlightKeywords.map"],"mappings":"kQAGG,SAAgB,EAAkB,EAAM,CAAC,GAAK,CAAC,OAAK,WAAS,mBAAiB,oBAAkB,OAAK,WAAS,aAAW,gBAAc,YAAU,iBAAe,oBAAkB,kBAAgB,eAAa,eAAa,YAAU,cAAY,cAAY,cAAY,CAAC,EAAY,EAAkB,EAAkB,EAAiB,MAAM,KAAK,IAAI,GAAG,EAAE,QAAQ,OAAO,GAAG,IAAI,IAAI,EAAe,EAAY,CAAC,WAAW,EAAK,WAAW,WAAW,EAAK,WAAW,SAAS,EAAS,KAAK,WAAW,EA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