{"version":3,"file":"FAQList.CuALN7mn.mjs","names":["useRef","useState","useMemo"],"sources":["https:/framerusercontent.com/modules/GK5S8LbqtbVOWXt9QZjS/CnE442YI5PNNU4WKLULJ/FAQList.js"],"sourcesContent":["// FAQList.tsx - a product's FAQ (the CMS \"FAQ\" rich text) drawn as the site's\n// Accordion Small: soft rows, blue question, a plus that turns to a minus, the\n// answer easing open. Headings (h2-h6 or a bold paragraph ending in \"?\") are\n// questions; everything after one until the next is its answer.\n//\n// G1 (2026-09-25): the ONE accordion look (DESIGN-DIRECTION rule 5) - the same\n// values as the Accordion Small component (aL9I1bbzb) on the category pages:\n// Paper fill, radius 16, 12/24 padding, gap 10, question Instrument Sans 700\n// 22 Blue, answer Paragraph Dark Grey. Type from ControlType.Font controls.\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useEffect,useMemo,useRef,useState}from\"react\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";function parsePlain(text){const out=[];let cur=null;for(const raw of text.split(/\\n+/)){const line=raw.trim();if(!line)continue;if(/\\?$/.test(line)&&line.length<160){cur={q:line,a:\"\"};out.push(cur);}else if(cur)cur.a+=`<p>${line.replace(/&/g,\"&amp;\").replace(/</g,\"&lt;\")}</p>`;}return out;}function parse(html){if(!html||typeof window===\"undefined\")return[];// Bound through a toString transform the CMS rich text arrives as plain lines.\nif(!/<[a-z][\\s\\S]*>/i.test(html))return parsePlain(html);const doc=new DOMParser().parseFromString(`<div>${html}</div>`,\"text/html\");const out=[];let cur=null;const isQuestion=el=>/^H[2-6]$/.test(el.tagName)||el.tagName===\"P\"&&/\\?\\s*$/.test(el.textContent||\"\")&&!!el.querySelector(\"strong, b\")&&(el.textContent||\"\").length<160;for(const el of Array.from(doc.body.firstElementChild?.children||[])){const text=(el.textContent||\"\").trim();if(!text)continue;if(isQuestion(el)){cur={q:text,a:\"\"};out.push(cur);}else if(cur){cur.a+=el.outerHTML;}}return out.filter(x=>x.q);}/**\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight auto\n */export default function FAQList(props){const{faq,fill,question,answer,radius,openFirst}=props;const fam=(v,fb)=>v&&typeof v.fontFamily===\"string\"&&v.fontFamily.trim()&&!/^(inter|sans-serif|serif|system-ui)$/i.test(v.fontFamily.split(\",\")[0].replace(/[\"']/g,\"\").trim())?v.fontFamily:fb;const font=fam(props.fontBody,props.font);const qf=props.fontQuestion||{};const bfv=props.fontBody||{};const qFont={fontFamily:fam(qf,props.font),fontWeight:qf.fontWeight||700,fontSize:parseFloat(qf.fontSize)||22,lineHeight:qf.lineHeight||1.4,letterSpacing:qf.letterSpacing||\"-0.01em\"};const aFont={fontFamily:font,fontWeight:bfv.fontWeight||500,fontSize:parseFloat(bfv.fontSize)||16,lineHeight:bfv.lineHeight||1.5,letterSpacing:bfv.letterSpacing||\"-0.02em\"};const isCanvas=RenderTarget.current()===RenderTarget.canvas;// A CMS rich text arrives as rendered content: draw it hidden, read its HTML.\nconst src=useRef(null);const[html,setHtml]=useState(typeof faq===\"string\"?faq:\"\");useEffect(()=>{if(typeof faq===\"string\")setHtml(faq);else if(src.current)setHtml(src.current.innerHTML);},[faq]);const items=useMemo(()=>isCanvas&&!html?SAMPLE:parse(html),[html,isCanvas]);const[open,setOpen]=useState(openFirst?0:null);const hidden=typeof faq===\"string\"?null:/*#__PURE__*/_jsx(\"div\",{ref:src,style:{display:\"none\"},children:faq});if(!items.length)return hidden;return /*#__PURE__*/_jsxs(\"div\",{className:\"bg-faq\",style:{width:\"100%\",display:\"grid\",gap:10},children:[hidden,items.map((it,i)=>{const on=open===i;return /*#__PURE__*/_jsxs(\"div\",{className:\"bg-faq-row\",style:{background:fill,borderRadius:radius},children:[/*#__PURE__*/_jsxs(\"button\",{type:\"button\",\"aria-expanded\":on,onClick:()=>setOpen(on?null:i),style:{width:\"100%\",display:\"flex\",alignItems:\"center\",justifyContent:\"space-between\",gap:32,padding:\"10px 0\",border:0,background:\"transparent\",cursor:\"pointer\",textAlign:\"left\",...qFont,color:question},children:[/*#__PURE__*/_jsx(\"span\",{children:it.q}),/*#__PURE__*/_jsxs(\"span\",{\"aria-hidden\":true,style:{position:\"relative\",width:14,height:14,flex:\"0 0 14px\"},children:[/*#__PURE__*/_jsx(\"span\",{style:{position:\"absolute\",left:0,top:6,width:14,height:2,background:answer,borderRadius:2}}),/*#__PURE__*/_jsx(\"span\",{style:{position:\"absolute\",left:6,top:0,width:2,height:14,background:answer,borderRadius:2,transform:on?\"scaleY(0)\":\"scaleY(1)\",transition:\"transform 550ms cubic-bezier(0.4,0,0.2,1)\"}})]})]}),/*#__PURE__*/_jsx(\"div\",{style:{display:\"grid\",gridTemplateRows:on?\"1fr\":\"0fr\",opacity:on?1:0,transition:\"grid-template-rows 550ms cubic-bezier(0.4,0,0.2,1), opacity 400ms cubic-bezier(0.4,0,0.2,1)\"},children:/*#__PURE__*/_jsx(\"div\",{style:{overflow:\"hidden\"},children:/*#__PURE__*/_jsx(\"div\",{className:\"bg-faq-answer\",style:{padding:\"4px 0 12px\",...aFont,color:answer},dangerouslySetInnerHTML:{__html:it.a}})})})]},i);}),/*#__PURE__*/_jsx(\"style\",{children:`.bg-faq{container-type:inline-size}.bg-faq-row{padding:12px 24px}@container (max-width:520px){.bg-faq-row{padding:12px 20px}}@media (prefers-reduced-motion: reduce){.bg-faq *{transition:none!important}}.bg-faq-answer p{margin:0 0 8px}.bg-faq-answer p:last-child{margin:0}.bg-faq-answer a{color:inherit}`})]});}const SAMPLE=[{q:\"How long do they last outdoors?\",a:\"<p>Printed vinyl is rated for years outdoors, laminated.</p>\"},{q:\"Do I see it before it prints?\",a:\"<p>Always. Every job gets a proof first.</p>\"}];FAQList.defaultProps={faq:\"\",fill:\"rgb(248, 240, 213)\",question:\"rgb(48, 67, 130)\",answer:\"rgb(108, 99, 84)\",radius:16,openFirst:false,font:\"'Instrument Sans', 'Instrument Sans Medium', 'Instrument Sans SemiBold', system-ui, sans-serif\"};addPropertyControls(FAQList,{faq:{type:ControlType.RichText??ControlType.String,title:\"FAQ\",description:\"Bind to the CMS FAQ field\"},fill:{type:ControlType.Color,title:\"Fill\"},question:{type:ControlType.Color,title:\"Question\"},answer:{type:ControlType.Color,title:\"Answer\"},radius:{type:ControlType.Number,title:\"Radius\",min:0,max:40},openFirst:{type:ControlType.Boolean,title:\"First open\"},font:{type:ControlType.String,title:\"Font stack\",description:\"Used when the font controls have no family\"},fontQuestion:{type:ControlType.Font,title:\"Question font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:22,variant:\"Bold\",lineHeight:\"1.4em\",letterSpacing:\"-0.01em\"}},fontBody:{type:ControlType.Font,title:\"Answer font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:16,variant:\"Medium\",lineHeight:\"1.5em\",letterSpacing:\"-0.02em\"}}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"FAQList\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"auto\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"any\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./FAQList.map"],"mappings":"2NAS+K,SAAS,EAAW,EAAK,CAAC,IAAM,EAAI,CAAC,EAAM,EAAI,KAAK,IAAI,IAAM,KAAO,EAAK,MAAM,KAAK,EAAE,CAAC,IAAM,EAAK,EAAI,KAAK,EAAM,IAAiB,MAAM,KAAK,CAAI,GAAG,EAAK,OAAO,KAAK,EAAI,CAAC,EAAE,EAAK,EAAE,EAAE,EAAE,EAAI,KAAK,CAAG,GAAW,IAAI,EAAI,GAAG,MAAM,EAAK,QAAQ,KAAK,OAAO,CAAC,CAAC,QAAQ,KAAK,MAAM,EAAE,OAAM,CAAC,OAAO,CAAI,CAAC,SAAS,EAAM,EAAK,CAAC,GAAG,CAAC,GAAa,IAAS,OAAY,MAAM,CAAC,EACphB,GAAG,CAAC,kBAAkB,KAAK,CAAI,EAAE,OAAO,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