{"version":3,"file":"FAQ.DNwETiRr.mjs","names":["React.useState","React.useRef","React.useCallback","element"],"sources":["https:/framerusercontent.com/modules/fxlmqVk0JRNvpLzQkccw/4NzBwC3whPou0UQ7AJ7q/FAQ.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";import{motion,AnimatePresence}from\"framer-motion\";/**\n * @framerDisableUnlink\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerIntrinsicWidth 600\n * @framerSupportedLayoutHeight any-prefer-fixed\n * @framerIntrinsicHeight 400\n */export default function FAQContainer(props){const{richText,questionFont,answerFont,containerSpacing,qaSpacing,padding,border,borderRadius,shadow,appearance:{backgroundColor,hoverBackgroundColor,activeBackgroundColor,questionColor,answerColor},icon:{type:iconType,size,color},transition}=props;const isCanvas=RenderTarget.current()===RenderTarget.canvas;const[faqs,setFaqs]=React.useState([]);const[openIndex,setOpenIndex]=React.useState(isCanvas?0:null);const[hoveredIndex,setHoveredIndex]=React.useState(null);const didInitialize=React.useRef(false);// Add global style for links to match text color\nReact.useEffect(()=>{if(typeof document!==\"undefined\"){const styleEl=document.createElement(\"style\");styleEl.innerHTML=`\n               .faq-container a {\n                   color: inherit;\n                   text-decoration: underline;\n               }\n           `;document.head.appendChild(styleEl);return()=>{document.head.removeChild(styleEl);};}},[]);const processRichText=React.useCallback(()=>{const extractQA=element=>{const qaList=[];let currentQA={};const processContent=element=>{if(element.props&&element.props.children){React.Children.forEach(element.props.children,child=>{if(child.type&&typeof child.type===\"string\"&&child.type.match(/h[1-6]/)){if(currentQA.question){qaList.push({...currentQA});}currentQA={question:child.props.children,answer:\"\"};}else if(child.type===\"p\"&&currentQA.question){currentQA.answer=child.props.children;}if(child.props&&child.props.children){processContent(child);}});}};processContent(element);if(currentQA.question){qaList.push(currentQA);}return qaList;};if(richText&&richText.props&&Array.isArray(richText.props.children)){const faqList=extractQA(richText);if(faqList.length>0){setFaqs(faqList);return true;}}return false;},[richText]);// Process rich text when component mounts\nReact.useEffect(()=>{const hasContent=processRichText();// Use default content if no content from rich text\nif(!hasContent||isCanvas){setFaqs(prevFaqs=>{if(prevFaqs.length===0){return[{question:\"What is this component?\",answer:\"This is a FAQ accordion component that displays questions and answers.\"},{question:\"How do I add content?\",answer:\"Use the Rich Text editor to add h1-h6 elements for questions and paragraphs for answers.\"}];}return prevFaqs;});}didInitialize.current=true;},[]);// Process rich text when it changes\nReact.useEffect(()=>{if(didInitialize.current){processRichText();}},[richText,processRichText]);const toggleFAQ=index=>{if(!isCanvas){setOpenIndex(openIndex===index?null:index);}};const isItemOpen=index=>{if(isCanvas)return index===0;return openIndex===index;};const getBackgroundColor=index=>{if(isItemOpen(index))return activeBackgroundColor;if(hoveredIndex===index)return hoverBackgroundColor;return backgroundColor;};const renderIcon=isOpen=>{if(iconType===\"plus\"){return /*#__PURE__*/_jsx(\"div\",{style:{fontSize:`${size}px`,lineHeight:1,color:color,width:`${size}px`,height:`${size}px`,display:\"flex\",alignItems:\"center\",justifyContent:\"center\"},children:isOpen?\"−\":\"+\"});}else{return /*#__PURE__*/_jsx(\"svg\",{width:size,height:size,viewBox:\"0 0 24 24\",fill:\"none\",stroke:color,strokeWidth:\"2\",style:{transform:isOpen?\"rotate(180deg)\":\"rotate(0)\",transition:\"transform 0.3s ease\"},children:/*#__PURE__*/_jsx(\"path\",{d:\"M6 9l6 6 6-6\"})});}};return /*#__PURE__*/_jsx(motion.div,{role:\"region\",\"aria-label\":\"Frequently Asked Questions\",className:\"faq-container\",style:{width:\"100%\",display:\"flex\",flexDirection:\"column\",gap:containerSpacing},children:/*#__PURE__*/_jsx(AnimatePresence,{initial:false,children:faqs.map((faq,index)=>/*#__PURE__*/_jsxs(motion.section,{layout:true,initial:false,style:{padding,...border,borderRadius,boxShadow:shadow,cursor:isCanvas?\"default\":\"pointer\",backgroundColor:getBackgroundColor(index),overflow:\"hidden\"},onClick:()=>toggleFAQ(index),onMouseEnter:()=>setHoveredIndex(index),onMouseLeave:()=>setHoveredIndex(null),children:[/*#__PURE__*/_jsxs(motion.div,{layout:true,style:{display:\"flex\",justifyContent:\"space-between\",alignItems:\"center\",color:questionColor,...questionFont},children:[/*#__PURE__*/_jsx(\"span\",{children:faq.question}),renderIcon(isItemOpen(index))]}),/*#__PURE__*/_jsx(AnimatePresence,{initial:false,children:isItemOpen(index)&&/*#__PURE__*/_jsx(motion.div,{initial:{height:0,marginTop:0,opacity:0},animate:{height:\"auto\",marginTop:qaSpacing,opacity:1,transition:transition},exit:{height:0,marginTop:0,opacity:0,transition:{...transition,opacity:{duration:transition.type===\"spring\"?.15:transition.duration*.5||.15}}},style:{color:answerColor,...answerFont},children:faq.answer})})]},index))})});}FAQContainer.defaultProps={richText:null,containerSpacing:10,qaSpacing:15,padding:\"20px\",border:{borderWidth:1,borderStyle:\"solid\",borderColor:\"#EEEEEE\"},borderRadius:\"8px\",shadow:\"none\",appearance:{backgroundColor:\"#FFFFFF\",hoverBackgroundColor:\"#F5F5F5\",activeBackgroundColor:\"#F8F8F8\",questionColor:\"#000000\",answerColor:\"#666666\"},icon:{type:\"chevron\",size:24,color:\"#000000\"},transition:{type:\"spring\",stiffness:500,damping:30}};addPropertyControls(FAQContainer,{richText:{type:ControlType.RichText,title:\"FAQ Content\"},questionFont:{type:ControlType.Font,controls:\"extended\",title:\"Question Font\"},answerFont:{type:ControlType.Font,controls:\"extended\",title:\"Answer Font\"},containerSpacing:{type:ControlType.Number,title:\"Container Spacing\",min:0,max:100},qaSpacing:{type:ControlType.Number,title:\"Q&A Spacing\",min:0,max:100},padding:{type:ControlType.Padding,title:\"Padding\"},border:{type:ControlType.Border,title:\"Border\"},borderRadius:{type:ControlType.BorderRadius,title:\"Border Radius\"},shadow:{type:ControlType.BoxShadow,title:\"Shadow\"},appearance:{type:ControlType.Object,title:\"Appearance\",controls:{backgroundColor:{type:ControlType.Color,title:\"Background\"},hoverBackgroundColor:{type:ControlType.Color,title:\"Hover Background\"},activeBackgroundColor:{type:ControlType.Color,title:\"Active Background\"},questionColor:{type:ControlType.Color,title:\"Question Color\"},answerColor:{type:ControlType.Color,title:\"Answer Color\"}}},icon:{type:ControlType.Object,title:\"Icon\",controls:{type:{type:ControlType.Enum,title:\"Type\",options:[\"plus\",\"chevron\"]},size:{type:ControlType.Number,title:\"Size\",min:12,max:48,step:2},color:{type:ControlType.Color,title:\"Color\"}}},transition:{type:ControlType.Transition,title:\"Animation\",description:\"v1.1\\n[via SegmentUI](https://www.segmentUI.com)\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"FAQContainer\",\"slots\":[],\"annotations\":{\"framerIntrinsicWidth\":\"600\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerDisableUnlink\":\"*\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerIntrinsicHeight\":\"400\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./FAQ.map"],"mappings":"+ZAOG,SAAwB,EAAa,EAAM,CAAC,GAAK,CAAC,WAAS,eAAa,aAAW,mBAAiB,YAAU,UAAQ,SAAO,eAAa,SAAO,WAAW,CAAC,kBAAgB,uBAAqB,wBAAsB,gBAAc,eAAa,KAAK,CAAC,KAAK,EAAS,OAAK,SAAO,cAAY,EAAY,EAAS,EAAa,SAAS,GAAG,EAAa,OAAY,CAAC,EAAK,GAASA,EAAe,EAAE,CAAC,CAAM,CAAC,EAAU,GAAcA,EAAe,EAAS,EAAE,KAAK,CAAM,CAAC,EAAa,GAAiBA,EAAe,KAAK,CAAO,EAAcC,EAAa,GAAM,CACziB,MAAoB,CAAC,GAAG,OAAO,SAAW,IAAY,CAAC,IAAM,EAAQ,SAAS,cAAc,QAAQ,CAKpD,MALqD,GAAQ,UAAU;;;;;aAK1G,SAAS,KAAK,YAAY,EAAQ,KAAW,CAAC,SAAS,KAAK,YAAY,EAAQ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