{"version":3,"file":"FAQ.BxD2anKD.mjs","names":["element"],"sources":["https:/framerusercontent.com/modules/fxlmqVk0JRNvpLzQkccw/GMChSG6c39k6dXZJlUgv/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(null);const[hoveredIndex,setHoveredIndex]=React.useState(null);React.useEffect(()=>{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&&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);setFaqs(faqList);}},[richText]);const toggleFAQ=index=>{if(!isCanvas){setOpenIndex(openIndex===index?null:index);}};const isItemOpen=index=>{if(isCanvas)return false;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\",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},exit:{height:0,marginTop:0,opacity:0,transition:{opacity:{duration:.15}}},transition:transition,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.0\\n[via SegmentUI](https://www.segmentUI.com)\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"FAQContainer\",\"slots\":[],\"annotations\":{\"framerDisableUnlink\":\"*\",\"framerIntrinsicWidth\":\"600\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerIntrinsicHeight\":\"400\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL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