{"version":3,"file":"TextPop.DR0Fspef.mjs","names":["React.useState","React.useMemo","__esmMin","_e","init_jsx_runtime","K","pe","c","init_npm_react_18_3_1","addPropertyControls","init_framer_CaDWdxiz","ControlType","extractText","value","item","preserveLineBreaks","element","elementType","childrenText","BLOCK_ELEMENT_TAGS","anyValue","objectType","text","HoverSentenceText","props","hoveredIndex","setHoveredIndex","rawContent","contentSource","manualContent","cmsContent","plainText","extracted","sentences","shouldClamp","truncateLines","style","fontSize","baseColor","index","hoverColor","transitionDuration","easing","hoverBleed","sentence","init_TextPop"],"sources":["https:/framerusercontent.com/modules/Ip2QgworRYN1hXZWc7QU/6gapuhZOoJ3ksBOfotmS/TextPop.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType}from\"framer\";const BLOCK_ELEMENT_TAGS=new Set([\"p\",\"div\",\"li\",\"ul\",\"ol\",\"h1\",\"h2\",\"h3\",\"h4\",\"h5\",\"h6\",\"blockquote\"]);function extractText(value,preserveLineBreaks=true){if(value==null||value===false||value===true)return\"\";if(typeof value===\"string\"||typeof value===\"number\"){return String(value);}if(Array.isArray(value)){return value.map(item=>extractText(item,preserveLineBreaks)).join(\"\");}if(/*#__PURE__*/React.isValidElement(value)){const element=value;const elementType=typeof element.type===\"string\"?element.type:\"\";if(preserveLineBreaks&&elementType===\"br\"){return\"\\n\";}const childrenText=extractText(element.props?.children,preserveLineBreaks);if(preserveLineBreaks&&BLOCK_ELEMENT_TAGS.has(elementType)){return`${childrenText}\n\n`;}return childrenText;}if(typeof value===\"object\"){const anyValue=value;const objectType=typeof anyValue.type===\"string\"?anyValue.type:\"\";if(preserveLineBreaks&&objectType===\"br\"){return\"\\n\";}if(anyValue.props?.children){const childrenText=extractText(anyValue.props.children,preserveLineBreaks);if(preserveLineBreaks&&BLOCK_ELEMENT_TAGS.has(objectType)){return`${childrenText}\n\n`;}return childrenText;}if(anyValue.children){const childrenText=extractText(anyValue.children,preserveLineBreaks);if(preserveLineBreaks&&BLOCK_ELEMENT_TAGS.has(objectType)){return`${childrenText}\n\n`;}return childrenText;}if(anyValue.text){const text=extractText(anyValue.text,preserveLineBreaks);if(preserveLineBreaks&&BLOCK_ELEMENT_TAGS.has(objectType)){return`${text}\n\n`;}return text;}if(anyValue.value){const text=extractText(anyValue.value,preserveLineBreaks);if(preserveLineBreaks&&BLOCK_ELEMENT_TAGS.has(objectType)){return`${text}\n\n`;}return text;}return\"\";}return\"\";}export function HoverSentenceText(props){const{contentSource,cmsContent,manualContent,fontFamily,fontSize,lineHeight,fontWeight,baseColor,hoverColor,transitionDuration,easing,hoverBleed,preserveLineBreaks,truncateLines,style}=props;const[hoveredIndex,setHoveredIndex]=React.useState(null);const rawContent=contentSource===\"manual\"?manualContent:cmsContent;const plainText=React.useMemo(()=>{const extracted=extractText(rawContent,preserveLineBreaks);if(!preserveLineBreaks)return extracted;return extracted.replace(/\\n{3,}/g,\"\\n\\n\").replace(/[ \\t]+\\n/g,\"\\n\").trimEnd();},[rawContent,preserveLineBreaks]);const sentences=React.useMemo(()=>{if(!plainText)return[];return plainText.match(/[^.!?]+[.!?]+[\"')\\]]*|[^.!?]+$/g)||[];},[plainText]);const shouldClamp=truncateLines>0;return /*#__PURE__*/_jsx(\"div\",{style:{...style,width:\"100%\",height:\"100%\",overflow:shouldClamp?\"hidden\":\"visible\",fontFamily,fontSize:`${fontSize}rem`,lineHeight,fontWeight,color:baseColor,whiteSpace:preserveLineBreaks?\"pre-wrap\":\"normal\",display:shouldClamp?\"-webkit-box\":\"block\",WebkitLineClamp:shouldClamp?truncateLines:undefined,WebkitBoxOrient:shouldClamp?\"vertical\":undefined},children:sentences.map((sentence,index)=>/*#__PURE__*/_jsx(\"span\",{style:{display:\"inline\",color:hoveredIndex===index?hoverColor:baseColor,transition:`color ${transitionDuration}s ${easing}`,cursor:\"default\",paddingTop:`${hoverBleed}em`,paddingBottom:`${hoverBleed}em`,marginTop:`-${hoverBleed}em`,marginBottom:`-${hoverBleed}em`},onMouseEnter:()=>setHoveredIndex(index),onMouseLeave:()=>setHoveredIndex(null),children:preserveLineBreaks?sentence:`${sentence.trim()} `},index))});}HoverSentenceText.defaultProps={contentSource:\"cms\",cmsContent:\"This is CMS/bindable content. Set this field to a CMS variable when using a collection.\",manualContent:\"This is manually editable content. Switch Content Source to Manual to use this field.\",fontFamily:\"Inter, sans-serif\",fontSize:1.125,lineHeight:1.5,fontWeight:400,baseColor:\"#111111\",hoverColor:\"#888888\",transitionDuration:.18,easing:\"ease\",hoverBleed:.2,preserveLineBreaks:true,truncateLines:0};addPropertyControls(HoverSentenceText,{contentSource:{type:ControlType.Enum,title:\"Source\",options:[\"cms\",\"manual\"],optionTitles:[\"CMS Variable\",\"Manual Text\"]},cmsContent:{type:ControlType.String,title:\"CMS Content\",hidden(props){return props.contentSource!==\"cms\";}},manualContent:{type:ControlType.String,title:\"Manual Content\",displayTextArea:true,hidden(props){return props.contentSource!==\"manual\";}},fontFamily:{type:ControlType.String,title:\"Font\"},fontSize:{type:ControlType.Number,title:\"Size\",min:.5,max:6,step:.025,unit:\"rem\"},lineHeight:{type:ControlType.Number,title:\"Line Height\",min:.8,max:3,step:.05},fontWeight:{type:ControlType.Enum,title:\"Weight\",options:[300,400,500,600,700,800],optionTitles:[\"300\",\"400\",\"500\",\"600\",\"700\",\"800\"]},baseColor:{type:ControlType.Color,title:\"Base Color\"},hoverColor:{type:ControlType.Color,title:\"Hover Color\"},transitionDuration:{type:ControlType.Number,title:\"Duration\",min:0,max:2,step:.01,unit:\"s\"},easing:{type:ControlType.Enum,title:\"Easing\",options:[\"linear\",\"ease\",\"ease-in\",\"ease-out\",\"ease-in-out\",\"cubic-bezier(0.16, 1, 0.3, 1)\",\"cubic-bezier(0.76, 0, 0.24, 1)\"],optionTitles:[\"Linear\",\"Ease\",\"Ease In\",\"Ease Out\",\"Ease In Out\",\"Smooth Out\",\"Sharp\"]},hoverBleed:{type:ControlType.Number,title:\"Hover Bleed\",min:0,max:1,step:.025},preserveLineBreaks:{type:ControlType.Boolean,title:\"Preserve Line Breaks\",defaultValue:true},truncateLines:{type:ControlType.Number,title:\"Truncate Lines\",min:0,max:30,step:1}});\nexport const __FramerMetadata__ = {\"exports\":{\"HoverSentenceText\":{\"type\":\"reactComponent\",\"name\":\"HoverSentenceText\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./TextPop.map"],"mappings":"A,yLAAmO,SAASY,EAAY,EAAM,EAAmB,GAAK,CAAC,GAAGC,GAAO,MAAMA,IAAQ,IAAOA,IAAQ,GAAK,MAAM,GAAG,GAAG,OAAOA,GAAQ,UAAU,OAAOA,GAAQ,SAAU,OAAO,OAAOA,CAAK,EAAG,GAAG,MAAM,QAAQA,CAAK,EAAG,OAAOA,EAAM,IAAI,GAAMD,EAAYE,EAAKC,CAAkB,CAAC,CAAC,CAAC,KAAK,EAAE,EAAG,GAAgB,gBAAqBF,CAAK,EAAE,CAAC,IAAMG,EAAQH,EAAYI,EAAY,OAAOD,EAAQ,MAAO,SAASA,EAAQ,KAAK,GAAG,GAAGD,GAAoBE,IAAc,KAAM,MAAM;EAAM,IAAMC,EAAaN,EAAYI,EAAQ,OAAO,SAASD,CAAkB,EAEtvB,OAF2vBA,GAAoBI,EAAmB,IAAIF,CAAW,EAAS,GAAGC,EAAa;;EAEn0BA,CAAa,CAAC,GAAG,OAAOL,GAAQ,SAAS,CAAC,IAAMO,EAASP,EAAYQ,EAAW,OAAOD,EAAS,MAAO,SAASA,EAAS,KAAK,GAAG,GAAGL,GAAoBM,IAAa,KAAM,MAAM;EAAM,GAAGD,EAAS,OAAO,SAAS,CAAC,IAAMF,EAAaN,EAAYQ,EAAS,MAAM,SAASL,CAAkB,EAEpS,OAFySA,GAAoBI,EAAmB,IAAIE,CAAU,EAAS,GAAGH,EAAa;;EAEhXA,CAAa,CAAC,GAAGE,EAAS,SAAS,CAAC,IAAMF,EAAaN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