{"version":3,"file":"faqmm.sOdb5JsI.mjs","names":["useState","useRef"],"sources":["https:/framerusercontent.com/modules/AK2LOXcwd5BqxVTlBM3C/7BYnbPkdX85sjeAXYLr5/faqmm.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,useRef,useEffect}from\"react\";import{addPropertyControls,ControlType}from\"framer\";export function FAQ({faqs,questionColor,answerColor,questionBackground,answerBackground,questionPadding,answerPadding,gap,fontSize,fontWeight,borderRadius,fontFamily,borderColor,lineColor,faqLimit,answerFontSize}){const[openIndex,setOpenIndex]=useState(null);const[showAll,setShowAll]=useState(false);const[height,setHeight]=useState(null);const answerRefs=useRef([]);const toggleFAQ=index=>{setOpenIndex(openIndex===index?null:index);};const handleViewAllClick=()=>{setShowAll(!showAll);};const displayFaqs=showAll?faqs:faqs.slice(0,faqLimit);// Update height of the answer when openIndex changes\nuseEffect(()=>{if(openIndex!==null&&answerRefs.current[openIndex]){setHeight(answerRefs.current[openIndex]?.scrollHeight)// Get the scrollHeight of the content\n;}else{setHeight(0)// Reset height when closed\n;}},[openIndex]);return /*#__PURE__*/_jsxs(\"div\",{style:{display:\"flex\",flexDirection:\"column\",gap},children:[displayFaqs.map((faq,index)=>/*#__PURE__*/_jsxs(\"div\",{style:{background:questionBackground,borderRadius,padding:questionPadding,cursor:\"pointer\",border:`1px solid ${borderColor}`,marginBottom:\"30px\",display:\"flex\",flexDirection:\"column\"},onClick:()=>toggleFAQ(index),tabIndex:0,children:[/*#__PURE__*/_jsxs(\"div\",{style:{color:questionColor,fontSize,fontWeight,fontFamily,display:\"flex\",justifyContent:\"space-between\",alignItems:\"center\"},children:[/*#__PURE__*/_jsx(\"div\",{children:faq.question}),/*#__PURE__*/_jsx(\"div\",{style:{fontSize:\"20px\",fontWeight:\"300\",letterSpacing:\"0.2px\",color:\"#8791FF\"},children:openIndex===index?\"-\":\"+\"})]}),/*#__PURE__*/_jsx(\"div\",{ref:el=>answerRefs.current[index]=el,style:{color:answerColor,background:answerBackground,padding:answerPadding,fontSize:answerFontSize,borderRadius,transition:\"max-height 0.3s ease\",maxHeight:openIndex===index?`${height}px`:\"0\",overflow:\"hidden\",marginTop:openIndex===index?`18px`:\"0px\",fontFamily:\"Inter\",letterSpacing:\"0.2px\",lineHeight:\"140%\"},children:faq.answer.split(\"\\\\n\").map((paragraph,i)=>/*#__PURE__*/_jsx(\"p\",{style:{margin:\"0 0 10px\"},children:paragraph},i))}),/*#__PURE__*/_jsx(\"div\",{style:{borderBottom:`1px solid ${lineColor}`,marginTop:\"24px\"}})]},index)),!showAll&&faqs.length>faqLimit&&/*#__PURE__*/_jsx(\"div\",{style:{textAlign:\"center\",marginTop:\"10px\"},children:/*#__PURE__*/_jsx(\"button\",{onClick:handleViewAllClick,style:{padding:\"12px 30px\",backgroundColor:\"#232C34\",fontSize:\"16px\",fontWeight:\"400\",color:\"#ffffff\",border:\"none\",borderRadius:\"6px\"},children:\"View All\"})})]});}// Default Props\nFAQ.defaultProps={faqs:[{question:\"What is Framer?\",answer:\"Framer is a design tool.\\\\nIt helps in creating prototypes and designs.\"},{question:\"Why use Framer?\",answer:\"It simplifies design and coding.\\\\nFramer is perfect for rapid prototyping.\"}],questionColor:\"#000000\",answerColor:\"#333333\",questionBackground:\"#f7f7f7\",answerBackground:\"#eaeaea\",questionPadding:\"10px\",answerPadding:\"10px\",gap:\"10px\",fontSize:\"16px\",fontWeight:\"300\",letterSpacing:\"0.2px\",borderRadius:\"5px\",fontFamily:\"Arial, sans-serif\",borderColor:\"#ddd\",lineColor:\"#ccc\",faqLimit:3,answerFontSize:\"14px\"};// Property Controls for Framer\naddPropertyControls(FAQ,{faqs:{type:ControlType.Array,title:\"FAQs\",propertyControl:{type:ControlType.Object,controls:{question:{type:ControlType.String,title:\"Question\"},answer:{type:ControlType.String,title:\"Answer\"}}}},questionColor:{type:ControlType.Color,title:\"Question Color\"},answerColor:{type:ControlType.Color,title:\"Answer Color\"},questionBackground:{type:ControlType.Color,title:\"Question BG\"},answerBackground:{type:ControlType.Color,title:\"Answer BG\"},questionPadding:{type:ControlType.String,title:\"Question Padding\"},answerPadding:{type:ControlType.String,title:\"Answer Padding\"},gap:{type:ControlType.String,title:\"Gap Between FAQs\"},fontSize:{type:ControlType.String,title:\"Font Size\"},fontWeight:{type:ControlType.String,title:\"Font Weight\"},borderRadius:{type:ControlType.String,title:\"Border Radius\"},fontFamily:{type:ControlType.String,title:\"Font Family\"},borderColor:{type:ControlType.Color,title:\"Border Color\"},lineColor:{type:ControlType.Color,title:\"Line Color\"},faqLimit:{type:ControlType.Number,title:\"FAQ Limit\"},answerFontSize:{type:ControlType.String,title:\"Answer Font Size\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"FAQ\":{\"type\":\"reactComponent\",\"name\":\"FAQ\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./faqmm.map"],"mappings":"gMAA0J,SAAgB,EAAI,CAAC,OAAK,gBAAc,cAAY,qBAAmB,mBAAiB,kBAAgB,gBAAc,MAAI,WAAS,aAAW,eAAa,aAAW,cAAY,YAAU,WAAS,kBAAgB,CAAC,GAAK,CAAC,EAAU,GAAcA,EAAS,KAAK,CAAM,CAAC,EAAQ,GAAYA,EAAS,GAAM,CAAM,CAAC,EAAO,GAAWA,EAAS,KAAK,CAAO,EAAWC,EAAO,EAAE,CAAC,CAAO,EAAU,GAAO,CAAC,EAAa,IAAY,EAAM,KAAK,EAAM,EAAS,MAAuB,CAAC,EAAW,CAAC,EAAQ,EAAS,EAAY,EAAQ,EAAK,EAAK,MAAM,EAAE,EAAS,CAGxqB,OAFjB,MAAc,CAAI,IAAY,MAAM,EAAW,QAAQ,GAAY,EAAU,EAAW,QAAQ,IAAY,aAAa,CAClH,EAAU,EAAE,EACf,CAAC,EAAU,CAAC,CAAqB,EAAM,MAAM,CAAC,MAAM,CAAC,QAAQ,OAAO,cAAc,SAAS,MAAI,C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