{"version":3,"file":"CaseStudyNav.CmeVIlaQ.mjs","names":["useState","useRef"],"sources":["https:/framerusercontent.com/modules/SpiAC8R4Ao5Aw9R3Gipu/u62H97Sw9mZE6Lq3dVBV/CaseStudyNav.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,useEffect,useRef}from\"react\";import{createPortal}from\"react-dom\";import{addPropertyControls,ControlType}from\"framer\";/**\n * CASE STUDY FLOATING NAV\n *\n * Drop one instance on each case-study page.\n * In the right-hand properties panel, edit:\n *   - Nav Items  -> the label + scroll target for THIS page\n *\n * Scroll targets:\n *   Type the section's HTML id with a leading \"#\", e.g. \"#overview\".\n *   To create that id on a Framer section, drop the companion\n *   <SectionAnchor> component (below) at the top of the section\n *   and give it the matching id (\"overview\", no \"#\").\n */// shared shadow stack from your spec (default + hover are identical)\nconst SHADOW=[\"0 0 0 2px #0F0F0F\",\"0 2px 5px 1px rgba(10, 10, 10, 0.6)\",\"inset 2px 4px 3px 0 #2B2B2B\",\"inset -2px -3px 3px 0 rgba(36, 36, 36, 0.5)\"].join(\", \");export default function CaseStudyNav(props){const{items,buttonSize,iconColor,buttonColor,buttonHoverColor,overlayPillColor,pillHoverColor,textColor,fontFamily,fontSize,position,offset,floating}=props;const[mounted,setMounted]=useState(false);useEffect(()=>setMounted(true),[]);const[open,setOpen]=useState(false);const[hoverBtn,setHoverBtn]=useState(false);const[activeId,setActiveId]=useState(null);const closeTimer=useRef(null);// keep open while moving between button and overlay\nconst handleEnter=()=>{if(closeTimer.current)clearTimeout(closeTimer.current);setOpen(true);};const handleLeave=()=>{closeTimer.current=setTimeout(()=>setOpen(false),120);};// active-section tracking via IntersectionObserver\nuseEffect(()=>{const targets=items.map(it=>it.target?.replace(\"#\",\"\")).filter(Boolean);if(targets.length===0)return;const els=targets.map(id=>document.getElementById(id)).filter(Boolean);if(els.length===0)return;const obs=new IntersectionObserver(entries=>{entries.forEach(entry=>{if(entry.isIntersecting)setActiveId(entry.target.id);});},{rootMargin:\"-40% 0px -55% 0px\",threshold:0});els.forEach(el=>obs.observe(el));return()=>obs.disconnect();},[items]);const scrollTo=target=>{const id=target?.replace(\"#\",\"\");const el=document.getElementById(id);if(el)el.scrollIntoView({behavior:\"smooth\",block:\"start\"});setOpen(false);};// positioning: fixed to viewport when floating, otherwise inline\n// (let Framer place/pin the component itself)\nconst posStyle=floating?{position:\"fixed\",zIndex:9999}:{position:\"relative\"};if(floating){if(position===\"Bottom Right\"){posStyle.bottom=offset;posStyle.right=offset;posStyle.alignItems=\"flex-end\";}else if(position===\"Bottom Left\"){posStyle.bottom=offset;posStyle.left=offset;posStyle.alignItems=\"flex-start\";}else if(position===\"Top Right\"){posStyle.top=offset;posStyle.right=offset;posStyle.alignItems=\"flex-end\";}else{posStyle.top=offset;posStyle.left=offset;posStyle.alignItems=\"flex-start\";}}else{posStyle.alignItems=position===\"Bottom Right\"||position===\"Top Right\"?\"flex-end\":\"flex-start\";}const openUpward=position===\"Bottom Right\"||position===\"Bottom Left\";const tree=/*#__PURE__*/_jsxs(\"div\",{style:{display:\"flex\",flexDirection:\"column\",gap:12,...posStyle},onMouseEnter:handleEnter,onMouseLeave:handleLeave,children:[open&&/*#__PURE__*/_jsx(\"div\",{style:{display:\"flex\",flexDirection:\"column\",gap:10,order:openUpward?0:2,alignItems:posStyle.alignItems,animation:\"csnav-fade 160ms ease-out\"},children:items.map((item,i)=>{const isActive=activeId&&item.target?.replace(\"#\",\"\")===activeId;return /*#__PURE__*/_jsx(\"div\",{onClick:()=>scrollTo(item.target),style:{cursor:\"pointer\",background:isActive?pillHoverColor:overlayPillColor,color:textColor,fontFamily,fontSize,fontWeight:600,padding:\"12px 22px\",borderRadius:14,whiteSpace:\"nowrap\",boxShadow:SHADOW,transition:\"background 160ms ease\"},onMouseEnter:e=>e.currentTarget.style.background=pillHoverColor,onMouseLeave:e=>e.currentTarget.style.background=isActive?pillHoverColor:overlayPillColor,children:item.label},i);})}),/*#__PURE__*/_jsx(\"button\",{onMouseEnter:()=>setHoverBtn(true),onMouseLeave:()=>setHoverBtn(false),style:{order:openUpward?1:0,width:buttonSize,height:buttonSize,borderRadius:\"50%\",border:\"none\",cursor:\"pointer\",background:hoverBtn?buttonHoverColor:buttonColor,boxShadow:SHADOW,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",transition:\"background 160ms ease\",padding:0},\"aria-label\":\"Section navigation\",children:/*#__PURE__*/_jsxs(\"svg\",{width:buttonSize*.5,height:buttonSize*.5,viewBox:\"0 0 24 24\",fill:\"none\",stroke:iconColor,strokeWidth:2.5,strokeLinecap:\"round\",children:[/*#__PURE__*/_jsx(\"line\",{x1:\"3\",y1:\"6\",x2:\"21\",y2:\"6\"}),/*#__PURE__*/_jsx(\"line\",{x1:\"3\",y1:\"12\",x2:\"21\",y2:\"12\"}),/*#__PURE__*/_jsx(\"line\",{x1:\"3\",y1:\"18\",x2:\"21\",y2:\"18\"})]})}),/*#__PURE__*/_jsx(\"style\",{children:`\n                @keyframes csnav-fade {\n                    from { opacity: 0; transform: translateY(6px); }\n                    to   { opacity: 1; transform: translateY(0); }\n                }\n            `})]});// When floating, render into a body-level portal so the fixed\n// positioning escapes Framer's component wrapper and pins to the\n// viewport reliably. On the Framer canvas (no document body portal\n// target during SSR), fall back to inline until mounted.\nif(floating){if(!mounted||typeof document===\"undefined\")return null;return /*#__PURE__*/createPortal(tree,document.body);}return tree;}CaseStudyNav.defaultProps={items:[{label:\"Overview\",target:\"#overview\"},{label:\"Problem\",target:\"#problem\"},{label:\"Process\",target:\"#process\"},{label:\"Outcome\",target:\"#outcome\"}],buttonSize:72,iconColor:\"#31CC7E\",buttonColor:\"#262626\",buttonHoverColor:\"#2D2D2D\",pillHoverColor:\"#2D2D2D\",overlayPillColor:\"#262626\",textColor:\"#31CC7E\",fontFamily:\"Inter, sans-serif\",fontSize:18,position:\"Bottom Right\",offset:32,floating:true};addPropertyControls(CaseStudyNav,{items:{type:ControlType.Array,title:\"Nav Items\",control:{type:ControlType.Object,controls:{label:{type:ControlType.String,title:\"Label\",defaultValue:\"Section\"},target:{type:ControlType.String,title:\"Scroll To\",defaultValue:\"#section\",placeholder:\"#section-id\"}}}},floating:{type:ControlType.Boolean,title:\"Floating\",enabledTitle:\"Fixed\",disabledTitle:\"Inline\",defaultValue:true},position:{type:ControlType.Enum,title:\"Position\",options:[\"Bottom Right\",\"Bottom Left\",\"Top Right\",\"Top Left\"],defaultValue:\"Bottom Right\"},offset:{type:ControlType.Number,title:\"Offset\",min:0,max:120,defaultValue:32},buttonSize:{type:ControlType.Number,title:\"Button Size\",min:40,max:120,defaultValue:72},buttonColor:{type:ControlType.Color,title:\"Button\",defaultValue:\"#262626\"},buttonHoverColor:{type:ControlType.Color,title:\"Button Hover\",defaultValue:\"#2D2D2D\"},overlayPillColor:{type:ControlType.Color,title:\"Pill\",defaultValue:\"#262626\"},pillHoverColor:{type:ControlType.Color,title:\"Pill Hover\",defaultValue:\"#2D2D2D\"},iconColor:{type:ControlType.Color,title:\"Icon\",defaultValue:\"#31CC7E\"},textColor:{type:ControlType.Color,title:\"Text\",defaultValue:\"#31CC7E\"},fontSize:{type:ControlType.Number,title:\"Font Size\",min:10,max:36,defaultValue:18}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"CaseStudyNav\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./CaseStudyNav.map"],"mappings":"6MAagK,SAAwB,EAAa,EAAM,CAAC,GAAK,CAAC,QAAM,aAAW,YAAU,cAAY,mBAAiB,mBAAiB,iBAAe,YAAU,aAAW,WAAS,WAAS,SAAO,YAAU,EAAW,CAAC,EAAQ,GAAYA,EAAS,GAAM,CAAC,MAAc,EAAW,GAAK,CAAC,EAAE,CAAC,CAAC,GAAK,CAAC,EAAK,GAASA,EAAS,GAAM,CAAM,CAAC,EAAS,GAAaA,EAAS,GAAM,CAAM,C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