{"version":3,"file":"FAQ.73blo9i6.mjs","names":["React.useState","React.useRef","React.useCallback"],"sources":["https:/framerusercontent.com/modules/fxlmqVk0JRNvpLzQkccw/7P7GvRWFXRySZoyIwFjS/FAQ.js"],"sourcesContent":["// @ts-nocheck\nimport{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);React.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                .faq-answer ul, .faq-answer ol {\n                    margin: 0.5em 0;\n                    padding-left: 1.5em;\n                }\n                .faq-answer li {\n                    margin: 0.25em 0;\n                }\n                .faq-answer p {\n                    margin: 0.5em 0;\n                }\n                .faq-answer p:first-child {\n                    margin-top: 0;\n                }\n                .faq-answer p:last-child {\n                    margin-bottom: 0;\n                }\n            `;document.head.appendChild(styleEl);return()=>{document.head.removeChild(styleEl);};}},[]);const processRichText=React.useCallback(()=>{const extractQA=element=>{const qaList=[];let currentQA=null;let answerElements=[];const isHeading=child=>{return child&&child.type&&typeof child.type===\"string\"&&child.type.match(/^h[1-6]$/);};const saveCurrentQA=()=>{if(currentQA&&answerElements.length>0){currentQA.answer=answerElements;qaList.push({...currentQA});}};const processChildren=children=>{React.Children.forEach(children,child=>{if(!child)return;if(isHeading(child)){saveCurrentQA();currentQA={question:child.props.children,answer:[]};answerElements=[];}else if(currentQA){if(child.type===\"p\"||child.type===\"ul\"||child.type===\"ol\"||child.type===\"blockquote\"||child.type===\"pre\"){answerElements.push(child);}else if(child.props&&child.props.children){processChildren(child.props.children);}}else if(child.props&&child.props.children){processChildren(child.props.children);}});};if(element&&element.props&&element.props.children){processChildren(element.props.children);saveCurrentQA();}return qaList;};if(richText&&richText.props){const faqList=extractQA(richText);if(faqList.length>0){setFaqs(faqList);return true;}}return false;},[richText]);React.useEffect(()=>{const hasContent=processRichText();if(!hasContent||isCanvas){setFaqs(prevFaqs=>{if(prevFaqs.length===0){return[{question:\"What is this component?\",answer:[/*#__PURE__*/_jsx(\"p\",{children:\"This is a FAQ accordion component that displays questions and answers.\"},\"p1\")]},{question:\"How do I add content?\",answer:[/*#__PURE__*/_jsx(\"p\",{children:\"Use the Rich Text editor to add content:\"},\"p1\"),/*#__PURE__*/_jsxs(\"ul\",{children:[/*#__PURE__*/_jsx(\"li\",{children:\"Use h1-h6 elements for questions\"}),/*#__PURE__*/_jsx(\"li\",{children:\"Add paragraphs for answer text\"}),/*#__PURE__*/_jsx(\"li\",{children:\"Include bullet points and lists\"})]},\"ul1\")]}];}return prevFaqs;});}didInitialize.current=true;},[]);React.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\"})});}};const renderAnswer=answer=>{if(Array.isArray(answer)){return answer.map((element,idx)=>{if(/*#__PURE__*/React.isValidElement(element)){return /*#__PURE__*/React.cloneElement(element,{key:idx});}return /*#__PURE__*/_jsx(\"p\",{children:element},idx);});}return /*#__PURE__*/_jsx(\"p\",{children:answer});};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,{className:\"faq-answer\",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:renderAnswer(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.2\\n[via SegmentUI](https://www.segmentUI.com)\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"FAQContainer\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerDisableUnlink\":\"*\",\"framerContractVersion\":\"1\",\"framerIntrinsicHeight\":\"400\",\"framerIntrinsicWidth\":\"600\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./FAQ.map"],"mappings":"2RAQG,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,QAAQ,IAAI,EAAa,OAAY,CAAC,EAAK,GAASA,EAAe,CAAC,CAAC,EAAO,CAAC,EAAU,GAAcA,EAAe,EAAS,EAAE,IAAI,EAAO,CAAC,EAAa,GAAiBA,EAAe,IAAI,EAAQ,EAAcC,EAAa,EAAK,EAAE,MAAoB,CAAC,GAAG,OAAO,SAAW,IAAY,CAAC,IAAM,EAAQ,SAAS,cAAc,OAAO,EAqB5lB,MArB8lB,GAAQ,UAAU;;;;;;;;;;;;;;;;;;;;;cAqBnpB,SAAS,KAAK,YAAY,CAAO,MAAY,CAAC,SAAS,KAAK,YAAY,CAAO,CAAE,CAAE,CAAC,EAAE,CAAC,CAAC,EAAE,IAAM,EAAgBC,MAAsB,CAAC,IAAM,EAAU,GAAS,CAAC,IAAM,EAAO,CAAC,EAAM,EAAU,KAAS,EAAe,CAAC,EAAQ,EAAU,GAAe,GAAO,EAAM,MAAM,OAAO,EAAM,MAAO,UAAU,EAAM,KAAK,MAAM,UAAU,EAAU,MAAkB,CAAI,GAAW,EAAe,OAAO,IAAG,EAAU,OAAO,EAAe,EAAO,KAAK,CAAC,GAAG,CAAS,CAAC,EAAG,EAAQ,EAAgB,GAAU,CAAC,EAAe,QAAQ,EAAS,GAAO,CAAK,IAAgB,EAAU,CAAK,GAAG,EAAc,EAAE,EAAU,CA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