{"version":3,"file":"ExpandableText.BNBJen4j.mjs","names":["useState","startTransition"],"sources":["https:/framerusercontent.com/modules/nFSX4nmzX0ez6qhyzaOt/vyd1XUQvTn2tvc8MZKmc/ExpandableText.js"],"sourcesContent":["// Text area with 2-line clamp and expandable/collapsible read more button\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,startTransition}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * ExpandableText\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function ExpandableText(props){const{text,readMoreLabel,readLessLabel,font,color,background,buttonColor,buttonTextColor,borderRadius,style}=props;const[expanded,setExpanded]=useState(false);const[showButton,setShowButton]=useState(false);const textRef=el=>{if(!el)return;// Check if text overflows 2 lines\nconst lineHeight=parseFloat(getComputedStyle(el).lineHeight);const maxHeight=lineHeight*2;setShowButton(el.scrollHeight>maxHeight+1);};return /*#__PURE__*/_jsxs(\"div\",{style:{...style,background,color,borderRadius,padding:props.padding,position:\"relative\",display:\"flex\",flexDirection:\"column\",gap:props.gap,...font},children:[/*#__PURE__*/_jsx(\"div\",{ref:textRef,style:{display:expanded?undefined:\"-webkit-box\",WebkitBoxOrient:expanded?undefined:\"vertical\",WebkitLineClamp:expanded?undefined:2,maxHeight:expanded?undefined:`calc(${font?.lineHeight||\"1.3em\"} * 2)`,overflow:expanded?undefined:\"hidden\",whiteSpace:\"normal\",textOverflow:expanded?undefined:\"ellipsis\",...font},\"aria-expanded\":expanded,children:text}),showButton&&/*#__PURE__*/_jsx(\"button\",{type:\"button\",style:{alignSelf:\"flex-start\",background:buttonColor,color:buttonTextColor,border:\"none\",borderRadius:6,padding:props.buttonPadding,cursor:\"pointer\",...props.buttonFont,fontSize:props.buttonFont?.fontSize||15,marginTop:4},onClick:()=>startTransition(()=>setExpanded(v=>!v)),\"aria-expanded\":expanded,children:expanded?readLessLabel:readMoreLabel})]});}addPropertyControls(ExpandableText,{text:{type:ControlType.String,title:\"Text\",defaultValue:\"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque euismod, urna eu tincidunt consectetur, nisi nisl aliquam enim, eget aliquam massa nisl quis neque. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.\",displayTextArea:true},readMoreLabel:{type:ControlType.String,title:\"Read More Label\",defaultValue:\"Read more\"},readLessLabel:{type:ControlType.String,title:\"Read Less Label\",defaultValue:\"Read less\"},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"15px\",variant:\"Medium\",letterSpacing:\"-0.01em\",lineHeight:\"1.3em\"}},color:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#000000\"},background:{type:ControlType.Color,title:\"Background\",defaultValue:\"#FFFFFF\"},buttonColor:{type:ControlType.Color,title:\"Button Color\",defaultValue:\"#111111\"},buttonTextColor:{type:ControlType.Color,title:\"Button Text\",defaultValue:\"#FFFFFF\"},borderRadius:{type:ControlType.Number,title:\"Radius\",defaultValue:8,min:0,max:32},padding:{type:ControlType.Number,title:\"Padding\",defaultValue:16,min:0,max:64},buttonPadding:{type:ControlType.String,title:\"Button Padding\",defaultValue:\"6px 14px\",placeholder:\"e.g. 6px 14px\"},buttonFont:{type:ControlType.Font,title:\"Button Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"14px\",variant:\"Semibold\",letterSpacing:\"-0.01em\",lineHeight:\"1em\"}},gap:{type:ControlType.Number,title:\"Gap\",defaultValue:8,min:0,max:48}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ExpandableText\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ExpandableText.map"],"mappings":"mLAMG,SAA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