{"version":3,"file":"FAQ.D6WCFMwi.mjs","names":["React.useState","React.useRef","React.useCallback","__esmMin","j","z","init_npm_react_18_3_1","_e","ne","p","K","init_jsx_runtime","ce","de","motion","AnimatePresence","init_framer_motion_DhsWWWsN","addPropertyControls","init_framer_BCdLsbZT","RenderTarget","ControlType","FAQContainer","iconType","props","isCanvas","faqs","setFaqs","openIndex","setOpenIndex","hoveredIndex","setHoveredIndex","didInitialize","styleEl","processRichText","extractQA","qaList","currentQA","answerElements","isHeading","child","saveCurrentQA","processChildren","children","element","richText","faqList","prevFaqs","toggleFAQ","index","isItemOpen","getBackgroundColor","activeBackgroundColor","hoverBackgroundColor","backgroundColor","renderIcon","size","isOpen","color","renderAnswer","answer","idx","containerSpacing","border","shadow","questionColor","questionFont","faq","qaSpacing","transition","answerColor","answerFont","init_FAQ"],"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":"A,4RAQG,SAAwBqB,EAAa,EAAM,CAAC,GAAK,CAAC,WAAS,eAAa,aAAW,mBAAiB,YAAU,UAAQ,SAAO,eAAa,SAAO,WAAW,CAAC,kBAAgB,uBAAqB,wBAAsB,gBAAc,eAAa,KAAK,CAAC,KAAKC,EAAS,OAAK,SAAO,cAAYC,EAAYC,EAASL,EAAa,QAAQ,IAAIA,EAAa,OAAY,CAACM,EAAKC,GAAS1B,EAAe,CAAC,CAAC,EAAO,CAAC2B,EAAUC,GAAc5B,EAAewB,EAAS,EAAE,IAAI,EAAO,CAACK,EAAaC,GAAiB9B,EAAe,IAAI,EAAQ+B,EAAc9B,EAAa,EAAK,EAAEW,MAAoB,CAAC,GAAG,OAAO,SAAW,IAAY,CAAC,IAAMoB,EAAQ,SAAS,cAAc,OAAO,EAqB5lB,MArB8lB,GAAQ,UAAU;;;;;;;;;;;;;;;;;;;;;cAqBnpB,SAAS,KA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