{
  "version": 3,
  "sources": ["ssg:https://framerusercontent.com/modules/LekjJfddy7Emp9IJKbcV/2wHBxmtJcJzXV80A6oN4/TruncatingText.js"],
  "sourcesContent": ["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,useRef,useEffect}from\"react\";import{motion}from\"framer-motion\";import{addPropertyControls,ControlType}from\"framer\";/**\n * @framerDisableUnlink\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight auto\n */export default function TruncatedText(props){const{text,maxLines,expandable,style,font,buttonStuff,transition,elementType,buttonAlignment,showActionButtons,mainTextColors={}}=props;const[expanded,setExpanded]=useState(false);const{useMultiColor=true,color=\"#FFFFFFD5\",expandedColor=\"#ffffff\"}=mainTextColors;const resolvedColor=useMultiColor&&expandable&&expanded?expandedColor:color;const resolvedCollapsedColor=useMultiColor?color:resolvedColor;const wrapperRef=useRef(null);const fullTextRef=useRef(null);const truncatedTextRef=useRef(null);const[heights,setHeights]=useState({truncated:0,full:0});const[showTruncated,setShowTruncated]=useState(true);const[currentHeight,setCurrentHeight]=useState(0);const[isAnimating,setIsAnimating]=useState(false);useEffect(()=>{if(fullTextRef.current&&truncatedTextRef.current){const full=fullTextRef.current.offsetHeight;const truncated=truncatedTextRef.current.offsetHeight;setHeights({full,truncated});setCurrentHeight(truncated);}},[text,font,maxLines]);useEffect(()=>{if(expanded){setShowTruncated(false);setCurrentHeight(heights.full);}else{setIsAnimating(true);setCurrentHeight(heights.truncated);setTimeout(()=>{setShowTruncated(true);setIsAnimating(false);},transition.duration*1e3);}},[expanded,heights,transition.duration]);const handleClick=()=>{if(!expandable)return;setExpanded(prev=>!prev);};const getTruncatedStyle=()=>{return{overflow:\"hidden\",display:\"-webkit-box\",WebkitLineClamp:maxLines,WebkitBoxOrient:\"vertical\"};};const getActionButtonStyle=()=>{const baseStyle={marginTop:`${buttonStuff.actionButtonsGap}px`,cursor:\"pointer\"};const buttonFont=buttonStuff.font&&Object.keys(buttonStuff.font).length>0?buttonStuff.font:font;return{...baseStyle,...buttonFont};};const TextElement=elementType||\"p\";const MotionTextElement=motion(TextElement);return /*#__PURE__*/_jsxs(\"div\",{style:{position:\"relative\",...style},children:[/*#__PURE__*/_jsx(\"div\",{ref:fullTextRef,style:{position:\"absolute\",visibility:\"hidden\",pointerEvents:\"none\",opacity:0,...font},children:/*#__PURE__*/_jsx(TextElement,{style:{margin:0},children:text})}),/*#__PURE__*/_jsx(\"div\",{ref:truncatedTextRef,style:{position:\"absolute\",visibility:\"hidden\",pointerEvents:\"none\",opacity:0,...font,...getTruncatedStyle()},children:/*#__PURE__*/_jsx(TextElement,{style:{margin:0},children:text})}),/*#__PURE__*/_jsx(motion.div,{animate:{height:currentHeight},transition:transition,style:{overflow:\"hidden\"},ref:wrapperRef,children:/*#__PURE__*/_jsx(\"div\",{style:{position:\"relative\"},children:showTruncated?/*#__PURE__*/_jsx(TextElement,{style:{...getTruncatedStyle(),color:resolvedCollapsedColor,...font,cursor:expandable?\"pointer\":\"auto\",margin:0,position:\"relative\",zIndex:2,opacity:1},onClick:expandable?handleClick:undefined,children:parseSimpleMarkdown(text)}):/*#__PURE__*/_jsx(motion.div,{initial:{opacity:1,color:resolvedCollapsedColor},animate:{opacity:1,color:resolvedColor},transition:transition,style:{position:\"relative\",zIndex:1},children:/*#__PURE__*/_jsx(TextElement,{style:{...font,cursor:expandable?\"pointer\":\"auto\",margin:0},onClick:expandable?handleClick:undefined,children:parseSimpleMarkdown(text)})})})}),expandable&&showActionButtons&&/*#__PURE__*/_jsx(motion.div,{style:{display:\"flex\",justifyContent:buttonStuff.buttonAlignment===\"center\"?\"center\":buttonStuff.buttonAlignment===\"right\"?\"flex-end\":\"flex-start\"},children:/*#__PURE__*/_jsx(motion.div,{style:getActionButtonStyle(),onClick:handleClick,initial:{color:expanded?buttonStuff.showLessButton.collapseColor||resolvedColor:buttonStuff.showMoreButton.color||resolvedCollapsedColor},animate:{color:expanded?buttonStuff.showLessButton.collapseColor||resolvedColor:buttonStuff.showMoreButton.color||resolvedCollapsedColor},transition:transition,children:expanded?buttonStuff.showLessButton.collapseLabelText:buttonStuff.showMoreButton.expandLabelText})})]});}TruncatedText.displayName=\"Smart Truncate\";// Keep the same property controls\naddPropertyControls(TruncatedText,{expandable:{type:ControlType.Boolean,title:\"Expandable\",defaultValue:true,enabledTitle:\"Yes\",disabledTitle:\"No\"},text:{type:ControlType.String,title:\"Text\",defaultValue:\"Great UX is invisible, but behind the scenes, every detail matters. This text block supports truncation with smooth transitions and can be expanded to reveal more insights when needed. Ideal for previews, FAQs, or content teasers.\",displayTextArea:true,description:\"Supports `***bold***`, `_italic_`, and `\\\\n` for line breaks.\"},maxLines:{type:ControlType.Number,title:\"Max Lines\",defaultValue:2,min:1,max:10,step:1},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultFontType:\"sans-serif\",displayFontSize:true,displayTextAlignment:true,defaultValue:{fontSize:16,lineHeight:1.4}},mainTextColors:{type:ControlType.Object,title:\"Text Color\",icon:\"color\",buttonTitle:\"Style\",controls:{useMultiColor:{type:ControlType.Boolean,title:\"Text Color\",defaultValue:false,enabledTitle:\"Multi\",disabledTitle:\"Single\"},color:{type:ControlType.Color,title:\"Default Color\",defaultValue:\"#FFFFFFD5\"},expandedColor:{type:ControlType.Color,title:\"Expanded Color\",defaultValue:\"#ffffff\",description:\"Apply secondary color on expansion \\n\\nOnly works when Expandable\",hidden:props=>!props.useMultiColor}}},transition:{type:ControlType.Transition,title:\"Transition\",defaultValue:{type:\"tween\",duration:.4,ease:\"easeOut\"},description:\"You can always set this to Instant for no transition\",hidden:props=>!props.expandable},showActionButtons:{type:ControlType.Boolean,title:\"Button\",defaultValue:true,enabledTitle:\"Yes\",disabledTitle:\"No\",hidden:props=>!props.expandable},buttonStuff:{type:ControlType.Object,title:\"Options\",icon:\"boolean\",buttonTitle:\"Button\",controls:{font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",optional:true,description:\"Leave empty to match text font\"},showMoreButton:{type:ControlType.Object,title:\"See More\",controls:{expandLabelText:{type:ControlType.String,title:\"Label\",defaultValue:\"See more\",displayFontSize:true,displayTextAlignment:true},color:{type:ControlType.Color,title:\"Color\",optional:true,description:\"Leave empty to match text color\"}}},showLessButton:{type:ControlType.Object,title:\"See Less\",controls:{collapseLabelText:{type:ControlType.String,title:\"Label\",defaultValue:\"See less\",displayFontSize:true,displayTextAlignment:true},collapseColor:{type:ControlType.Color,title:\"Color\",optional:true,description:\"Leave empty to match text color\"}}},actionButtonsGap:{type:ControlType.Number,title:\"Gap\",defaultValue:8,min:0,max:40,step:1,unit:\"px\"},buttonAlignment:{type:ControlType.Enum,title:\"Button Alignment\",options:[\"left\",\"center\",\"right\"],optionTitles:[\"Left\",\"Center\",\"Right\"],displaySegmentedControl:true,defaultValue:\"left\"}},hidden:props=>!props.expandable||!props.showActionButtons},elementType:{type:ControlType.Enum,title:\"Tag\",options:[\"p\",\"span\"],optionTitles:[\"P\",\"Span\"],defaultValue:\"p\",displaySegmentedControl:true,description:\"Component by [elvar.supply](https://elvar.surf/go/components).\"}});function parseSimpleMarkdown(text){const parts=text.split(/(\\*\\*.*?\\*\\*|_.*?_|\\\\n)/g);return parts.map((part,i)=>{if(part.startsWith(\"**\")&&part.endsWith(\"**\")){return /*#__PURE__*/_jsx(\"strong\",{children:part.slice(2,-2)},i);}if(part.startsWith(\"_\")&&part.endsWith(\"_\")){return /*#__PURE__*/_jsx(\"em\",{children:part.slice(1,-1)},i);}if(part===\"\\\\n\"){return /*#__PURE__*/_jsx(\"br\",{},i);}return /*#__PURE__*/_jsx(\"span\",{children:part},i);});}\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"TruncatedText\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"auto\",\"framerDisableUnlink\":\"* @framerSupportedLayoutWidth any\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./TruncatingText.map"],
  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AC,EAAuBL,EAAK,OAAO,CAAC,SAASI,CAAI,EAAEC,CAAC,CAAG,CAAE",
  "names": ["TruncatedText", "props", "text", "maxLines", "expandable", "style", "font", "buttonStuff", "transition", "elementType", "buttonAlignment", "showActionButtons", "mainTextColors", "expanded", "setExpanded", "ye", "useMultiColor", "color", "expandedColor", "resolvedColor", "resolvedCollapsedColor", "wrapperRef", "pe", "fullTextRef", "truncatedTextRef", "heights", "setHeights", "showTruncated", "setShowTruncated", "currentHeight", "setCurrentHeight", "isAnimating", "setIsAnimating", "ue", "full", "truncated", "handleClick", "prev", "getTruncatedStyle", "getActionButtonStyle", "baseStyle", "buttonFont", "TextElement", "MotionTextElement", "motion", "u", "p", "parseSimpleMarkdown", "addPropertyControls", "ControlType", "part", "i"]
}
