{"version":3,"file":"HighlightKeywords.NEmardHT.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,IAAI,CAAC,IAAI,GAAG,EAAE,MAAM,CAAC,CAAC,OAAO,GAAG,IAAI,GAAG,CAAC,EAAe,EAAY,CAAC,WAAW,EAAK,WAAW,WAAW,EAAK,WAAW,SAAS,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