{"version":3,"file":"SideNavBehavior.Cpmy4oAU.mjs","names":["useRef"],"sources":["https:/framerusercontent.com/modules/tZreyMlzzpDqQwtnKNPC/dCDbOgVLSb2jI7BoEIn3/SideNavBehavior.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";import{useEffect,useRef}from\"react\";/**\n * SIDE NAV BEHAVIOUR\n *\n * An invisible helper layer. It draws nothing on the published site — it takes\n * the table-of-contents rows you designed in the sidebar and gives them\n * hover, click-to-scroll, and scroll-spy highlighting. It also makes the\n * \"BackToTop\" text clickable.\n *\n * Because the rows are real layers you drew, you keep full control of their\n * fill, padding, type and alignment in Framer. This component only adds\n * behaviour on top; it never creates or restyles the layout.\n *\n * Where to put it:\n *   Anywhere on the case study page. It locates the sidebar itself by finding\n *   the \"BackToTop\" layer and climbing to the frame that also holds the first\n *   table-of-contents row.\n *\n * The row list:\n *   Set as a plain string, so it can be configured per instance from the\n *   properties panel (array controls cannot be). One pair per row:\n *\n *     Row layer name=Section layer name; …\n *\n *   The default is the ATC case study's list. The design-system case study\n *   passes its own.\n *\n * How it matches layers:\n *   By Framer layer name, which Framer renders as data-framer-name. Matching\n *   ignores case, spaces and punctuation, so \"04 Structure\" and \"04Structure\"\n *   both resolve. Row lookups are scoped to the sidebar and section lookups\n *   exclude it, so rows and sections may safely share a name.\n *\n * @framerIntrinsicWidth 96\n * @framerIntrinsicHeight 24\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */const ATC_ROWS=\"01 Context selected=Frame 427320234;\"+\"02 How we worked=02 How we worked;\"+\"03 Child onboarding=03 Child onboarding;\"+\"04 Information architecture=04 Structure;\"+\"05 A wireframe we outgrew=05 A wireframe we outgrew;\"+\"06 Owning beyond redesign=07 What came after;\"+\"07 Outcomes=08 Outcomes;\"+\"08 Reflection=09 Reflection\";const parseRows=function(value){return(value||\"\").split(\";\").map(function(chunk){return chunk.trim();}).filter(Boolean).map(function(chunk){const at=chunk.indexOf(\"=\");if(at<0)return null;const row=chunk.slice(0,at).trim();const section=chunk.slice(at+1).trim();if(!row)return null;return{row:row,section:section};}).filter(Boolean);};const normalise=function(s){return(s||\"\").toLowerCase().replace(/[^a-z0-9]/g,\"\");};const findIn=function(scope,name,skip){const target=normalise(name);const all=scope.querySelectorAll(\"[data-framer-name]\");for(let i=0;i<all.length;i++){const el=all[i];if(skip&&skip.contains(el))continue;if(normalise(el.getAttribute(\"data-framer-name\")||\"\")===target){return el;}}return null;};export default function SideNavBehavior(props){const{rows,activeBackground,hoverBackground,activeTextColor,inactiveTextColor,scrollOffset,style}=props;const ref=useRef(null);const onCanvas=RenderTarget.current()===RenderTarget.canvas;useEffect(()=>{if(onCanvas)return;if(typeof document===\"undefined\")return;const ROWS=parseRows(rows);if(ROWS.length===0)return;// --- Find the sidebar ------------------------------------------------\nconst backToTop=document.querySelector('[data-framer-name=\"BackToTop\"]');let panel=backToTop?backToTop.parentElement:null;while(panel&&!findIn(panel,ROWS[0].row,null)){panel=panel.parentElement;}if(!panel){const firstRow=findIn(document,ROWS[0].row,null);panel=firstRow?firstRow.parentElement:null;}if(!panel)return;const sidebar=panel;const pairs=[];ROWS.forEach(function(item){const row=findIn(sidebar,item.row,null);if(!row)return;pairs.push({row:row,section:findIn(document,item.section,sidebar)});});if(pairs.length===0)return;const undo=[];const paint=function(el,color,weight){const nodes=[el].concat(Array.prototype.slice.call(el.querySelectorAll(\"*\")));nodes.forEach(function(n){if(!n.style)return;n.style.setProperty(\"color\",color,\"important\");n.style.setProperty(\"--framer-text-color\",color,\"important\");n.style.setProperty(\"font-weight\",weight,\"important\");n.style.setProperty(\"--framer-font-weight\",weight,\"important\");});};let active=0;let hover=-1;const renderRow=function(i){const el=pairs[i].row;const isActive=i===active;const isHover=i===hover&&!isActive;el.style.backgroundColor=isActive?activeBackground:isHover?hoverBackground:\"transparent\";el.setAttribute(\"aria-current\",isActive?\"true\":\"false\");paint(el,isActive?activeTextColor:inactiveTextColor,isActive?\"600\":\"400\");};const renderAll=function(){for(let i=0;i<pairs.length;i++)renderRow(i);};pairs.forEach(function(pair,i){const el=pair.row;const prev=el.style.cssText;undo.push(function(){el.style.cssText=prev;});el.style.cursor=\"pointer\";el.style.transition=\"background-color 220ms ease, color 220ms ease\";el.style.userSelect=\"none\";el.setAttribute(\"role\",\"link\");el.setAttribute(\"tabindex\",\"0\");const go=function(){const target=pair.section;if(!target)return;const reduce=typeof window.matchMedia===\"function\"&&window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;const y=target.getBoundingClientRect().top+window.scrollY-(scrollOffset||0);window.scrollTo({top:y,behavior:reduce?\"auto\":\"smooth\"});};const onEnter=function(){hover=i;renderRow(i);};const onLeave=function(){const was=hover;hover=-1;if(was>=0)renderRow(was);};const onKey=function(e){if(e.key===\"Enter\"||e.key===\" \"){e.preventDefault();go();}};el.addEventListener(\"click\",go);el.addEventListener(\"mouseenter\",onEnter);el.addEventListener(\"mouseleave\",onLeave);el.addEventListener(\"keydown\",onKey);undo.push(function(){el.removeEventListener(\"click\",go);el.removeEventListener(\"mouseenter\",onEnter);el.removeEventListener(\"mouseleave\",onLeave);el.removeEventListener(\"keydown\",onKey);});});// --- Back to top -----------------------------------------------------\nif(backToTop){const prevBt=backToTop.style.cssText;undo.push(function(){backToTop.style.cssText=prevBt;});backToTop.style.cursor=\"pointer\";backToTop.style.transition=\"opacity 220ms ease\";backToTop.setAttribute(\"role\",\"button\");backToTop.setAttribute(\"tabindex\",\"0\");const toTop=function(){const reduce=typeof window.matchMedia===\"function\"&&window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;window.scrollTo({top:0,behavior:reduce?\"auto\":\"smooth\"});};const btEnter=function(){backToTop.style.opacity=\"0.6\";};const btLeave=function(){backToTop.style.opacity=\"1\";};const btKey=function(e){if(e.key===\"Enter\"||e.key===\" \"){e.preventDefault();toTop();}};backToTop.addEventListener(\"click\",toTop);backToTop.addEventListener(\"mouseenter\",btEnter);backToTop.addEventListener(\"mouseleave\",btLeave);backToTop.addEventListener(\"keydown\",btKey);undo.push(function(){backToTop.removeEventListener(\"click\",toTop);backToTop.removeEventListener(\"mouseenter\",btEnter);backToTop.removeEventListener(\"mouseleave\",btLeave);backToTop.removeEventListener(\"keydown\",btKey);});}// --- Scroll spy ------------------------------------------------------\nlet frame=0;const measure=function(){frame=0;// The line the reader's eye is on: a third down the viewport.\nconst line=window.scrollY+window.innerHeight*.33;let current=0;pairs.forEach(function(pair,i){if(!pair.section)return;const top=pair.section.getBoundingClientRect().top+window.scrollY;if(top<=line)current=i;});if(current!==active){const prev=active;active=current;renderRow(prev);renderRow(current);}};const onScroll=function(){if(frame)return;frame=requestAnimationFrame(measure);};renderAll();measure();window.addEventListener(\"scroll\",onScroll,{passive:true});window.addEventListener(\"resize\",onScroll);undo.push(function(){window.removeEventListener(\"scroll\",onScroll);window.removeEventListener(\"resize\",onScroll);if(frame)cancelAnimationFrame(frame);});return function(){undo.forEach(function(fn){fn();});};},[onCanvas,rows,activeBackground,hoverBackground,activeTextColor,inactiveTextColor,scrollOffset]);if(onCanvas){return /*#__PURE__*/_jsx(\"div\",{ref:ref,style:{...style,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",padding:\"6px 10px\",borderRadius:6,border:\"1px dashed rgb(148, 145, 138)\",background:\"rgba(249, 232, 189, 0.9)\",fontFamily:\"Inter, sans-serif\",fontSize:10,fontWeight:500,lineHeight:\"12px\",letterSpacing:\"0.06em\",textTransform:\"uppercase\",color:\"rgb(97, 96, 92)\",whiteSpace:\"nowrap\"},children:\"Side nav\"});}return /*#__PURE__*/_jsx(\"div\",{ref:ref,style:{...style,width:0,height:0}});}SideNavBehavior.defaultProps={rows:ATC_ROWS,activeBackground:\"rgb(249, 232, 189)\",hoverBackground:\"rgba(249, 232, 189, 0.45)\",activeTextColor:\"rgb(26, 26, 23)\",inactiveTextColor:\"rgb(97, 96, 92)\",scrollOffset:40};addPropertyControls(SideNavBehavior,{rows:{type:ControlType.String,title:\"Rows\",displayTextArea:true,defaultValue:ATC_ROWS,description:\"Row layer name=Section layer name; one pair per row\"},activeBackground:{type:ControlType.Color,title:\"Active fill\",defaultValue:\"rgb(249, 232, 189)\"},hoverBackground:{type:ControlType.Color,title:\"Hover fill\",defaultValue:\"rgba(249, 232, 189, 0.45)\"},activeTextColor:{type:ControlType.Color,title:\"Active text\",defaultValue:\"rgb(26, 26, 23)\"},inactiveTextColor:{type:ControlType.Color,title:\"Idle text\",defaultValue:\"rgb(97, 96, 92)\"},scrollOffset:{type:ControlType.Number,title:\"Scroll offset\",min:0,max:300,step:4,unit:\"px\",defaultValue:40}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"SideNavBehavior\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./SideNavBehavior.map"],"mappings":"sMAoC8hC,SAAwB,EAAgB,EAAM,CAAC,GAAK,CAAC,OAAK,mBAAiB,kBAAgB,kBAAgB,oBAAkB,eAAa,SAAO,EAAY,EAAIA,EAAO,IAAI,EAAQ,EAAS,EAAa,QAAQ,IAAI,EAAa,OAIrC,OAJ4C,MAAc,CAAoB,GAAhB,GAAmB,OAAO,SAAW,IAAY,OAAO,IAAM,EAAK,EAAU,CAAI,EAAE,GAAG,EAAK,SAAS,EAAE,OACh4C,IAAM,EAAU,SAAS,cAAc,gCAAgC,EAAM,EAAM,EAAU,EAAU,cAAc,KAAK,KAAM,GAAO,CAAC,EAAO,EAAM,EAAK,EAAE,CAAC,IAAI,IAAI,GAAG,EAAM,EAAM,cAAe,GAAG,CAAC,EAAM,CAAC,IAAM,EAAS,EAAO,SAAS,EAAK,EAAE,CAAC,IAAI,IAAI,EAAE,EAAM,EAAS,EAAS,cAAc,IAAK,CAAC,GAAG,CAAC,EAAM,OAAO,IAAM,EAAQ,EAAY,EAAM,CAAC,EAA4J,GAA1J,EAAK,QAAQ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