{"version":3,"file":"ReadMore.D_vvB0SA.mjs","names":["useState","useRef"],"sources":["https:/framerusercontent.com/modules/rp5mJXc4kK1dOg0iujby/iSQ1vNUUPEs3JBX3U1ct/ReadMore.js"],"sourcesContent":["/*\n * Written by: Ingrid Chu\n * Email: y1chu@ucsd.edu\n * Phone (TW): +886 965-709-210\n * Phone (US): +1 909 450-3017\n */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\";export default function ReadMoreExpander(props){const{fullText,charLimit,contentTextColor,toggleTextColor,toggleHoverColor,fontStyle,fontSize,isChinese}=props;const[isExpanded,setIsExpanded]=useState(false);const[isHovered,setIsHovered]=useState(false);const[height,setHeight]=useState(\"auto\");const contentRef=useRef(null);const needsTruncation=fullText.length>charLimit;const displayShortText=needsTruncation?fullText.slice(0,charLimit).trim()+\"...\":fullText;useEffect(()=>{if(contentRef.current){setHeight(contentRef.current.scrollHeight);}},[isExpanded,fullText,charLimit,fontSize,fontStyle,isChinese]);const containerStyle={width:\"100%\",display:\"flex\",flexDirection:\"column\",justifyContent:\"flex-start\",alignItems:\"flex-start\",/* FIX: Added \"creamfont\" to the font stack */fontFamily:`\"${fontStyle}\", \"creamfont\", sans-serif`,// Conditional Line Height based on Checkbox\nlineHeight:isChinese?\"1.4em\":\"1.2em\"};const textWrapperStyle={width:\"100%\",overflow:\"hidden\",position:\"relative\"};// Force font size directly on the text element\nconst textStyle={display:\"block\",whiteSpace:\"pre-wrap\",width:\"100%\",color:contentTextColor,fontSize:`${fontSize}px`};const buttonStyle={cursor:\"pointer\",display:needsTruncation?\"block\":\"none\",marginTop:\"1.5em\",transition:\"color 0.2s ease-in-out\",color:isHovered?toggleHoverColor:toggleTextColor,width:\"fit-content\",userSelect:\"none\",textDecoration:\"underline\",fontSize:`${fontSize}px`};return /*#__PURE__*/_jsxs(\"div\",{style:containerStyle,children:[/*#__PURE__*/_jsx(motion.div,{style:textWrapperStyle,initial:false,animate:{height:height},transition:{type:\"spring\",stiffness:250,damping:30},children:/*#__PURE__*/_jsx(\"span\",{ref:contentRef,style:textStyle,className:\"framer-text\",children:isExpanded?fullText:displayShortText})}),/*#__PURE__*/_jsx(motion.span,{layout:true,style:buttonStyle,onClick:()=>setIsExpanded(!isExpanded),onMouseEnter:()=>setIsHovered(true),onMouseLeave:()=>setIsHovered(false),children:isExpanded?\"Read Less\":\"Read More\"})]});}ReadMoreExpander.defaultProps={fullText:\"Enter your long text here...\",charLimit:160,contentTextColor:\"#FFFFFF\",toggleTextColor:\"#E6C15C\",toggleHoverColor:\"#FFFFFF\",fontStyle:\"Carisma Classic 400 Regular\",fontSize:20,isChinese:false};addPropertyControls(ReadMoreExpander,{fullText:{type:ControlType.String,title:\"Text Content\",displayTextArea:true},charLimit:{type:ControlType.Number,title:\"Char Limit\",min:1,max:2e3,defaultValue:160,displayStepper:true},isChinese:{type:ControlType.Boolean,title:\"Chinese Text?\",defaultValue:false},contentTextColor:{type:ControlType.Color,title:\"Content Color\"},fontStyle:{type:ControlType.Enum,title:\"Font Style\",options:[\"Carisma Classic 300 Light\",\"Carisma Classic 400 Regular\",\"Carisma Classic 500 Medium\"],optionTitles:[\"300 Light\",\"400 Regular\",\"500 Medium\"]},fontSize:{type:ControlType.Number,title:\"Font Size\",defaultValue:20},toggleTextColor:{type:ControlType.Color,title:\"Toggle Color\"},toggleHoverColor:{type:ControlType.Color,title:\"Toggle Hover\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ReadMoreExpander\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ReadMore.map"],"mappings":"gPAK+L,SAAwB,EAAiB,EAAM,CAAC,GAAK,CAAC,WAAS,YAAU,mBAAiB,kBAAgB,mBAAiB,YAAU,WAAS,aAAW,EAAW,CAAC,EAAW,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