{"version":3,"file":"MenuTabs.CCszFuUo.mjs","names":["useState","useRef"],"sources":["https:/framerusercontent.com/modules/buV64T3y0MxxWzZFVf2B/0zopANhcklJibfqdd2hV/MenuTabs.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useRef,useState}from\"react\";import{addPropertyControls,ControlType}from\"framer\";// Framer renders every breakpoint into the DOM and hides the inactive ones, so a\n// plain querySelector can return an off-screen copy sitting at position 0. Always\n// pick the visible match.\nfunction findVisible(name){if(typeof document===\"undefined\")return null;const all=Array.from(document.querySelectorAll('[data-framer-name=\"'+name+'\"]'));return all.find(el=>{const anyEl=el;const shown=typeof anyEl.checkVisibility===\"function\"?anyEl.checkVisibility():el.offsetParent!==null;return shown&&el.getBoundingClientRect().width>0;})||null;}// Section tabs for a long menu. Framer's DSL has no in-page scroll link\n// (onTap does not persist and href only takes URLs), so the jump is done here.\n// Targets are matched on data-framer-name, which Framer emits for named layers.\n/**\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n * @framerIntrinsicWidth 600\n * @framerIntrinsicHeight 40\n * @framerDisableUnlink\n */export default function MenuTabs(props){const{labels=\"The Table, Salads, Flatbreads, Entrees, Desserts\",targets=\"For the Table, Soups & Salads, Flatbreads, Entrees, Desserts\",accent=\"rgb(128, 96, 52)\",idle=\"rgba(28, 22, 17, 0.68)\",active=\"rgb(28, 22, 17)\",offset=120,gap=26,edge=0,center=true,top=30}=props;const L=String(labels).split(\",\").map(s=>s.trim()).filter(Boolean);const T=String(targets).split(\",\").map(s=>s.trim()).filter(Boolean);const[current,setCurrent]=useState(0);const ref=useRef(null);// follow the reader: whichever section owns the top of the viewport wins\nuseEffect(()=>{if(typeof document===\"undefined\")return;const nodes=T.map(n=>findVisible(n));const onScroll=()=>{let idx=0;nodes.forEach((el,i)=>{if(el&&el.getBoundingClientRect().top<=offset+12)idx=i;});setCurrent(idx);};onScroll();window.addEventListener(\"scroll\",onScroll,{passive:true});return()=>window.removeEventListener(\"scroll\",onScroll);},[labels,targets,offset]);const jump=i=>{const el=findVisible(T[i]);if(!el)return;const reduce=window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;const y=el.getBoundingClientRect().top+window.scrollY-offset;// A native smooth scroll gets cancelled here — the page has its own scroll\n// handlers that interrupt it — so the easing is driven manually instead.\nif(reduce){window.scrollTo(0,y);return;}const start=window.scrollY;const dist=y-start;const dur=Math.min(700,Math.max(280,Math.abs(dist)*.5));let t0=0;const step=ts=>{if(!t0)t0=ts;const p=Math.min(1,(ts-t0)/dur);const ease=1-Math.pow(1-p,3);window.scrollTo(0,start+dist*ease);if(p<1)requestAnimationFrame(step);};requestAnimationFrame(step);};return /*#__PURE__*/_jsx(\"div\",{ref:ref,style:{position:\"relative\",width:\"100%\",display:\"flex\",flexWrap:\"nowrap\",justifyContent:\"flex-start\",gap:0,// a single scrolling row beats a ragged two-row wrap on a phone\noverflowX:\"auto\",overflowY:\"hidden\",scrollbarWidth:\"none\",msOverflowStyle:\"none\",WebkitOverflowScrolling:\"touch\",scrollSnapType:\"x proximity\",padding:top+\"px \"+edge+\"px 2px\",fontFamily:'\"Gothic A1\", \"Gothic A1 Placeholder\", sans-serif'},children:/*#__PURE__*/_jsx(\"div\",{style:{display:\"flex\",gap:gap+\"px\",margin:center?\"0 auto\":0,flex:\"0 0 auto\"},children:L.map((label,i)=>/*#__PURE__*/_jsx(\"button\",{type:\"button\",onClick:()=>jump(i),\"aria-current\":current===i?\"true\":undefined,style:{appearance:\"none\",background:\"none\",border:0,cursor:\"pointer\",padding:\"0 0 9px\",margin:0,flex:\"0 0 auto\",whiteSpace:\"nowrap\",scrollSnapAlign:\"start\",fontSize:13,fontWeight:600,letterSpacing:\"0.18em\",textTransform:\"uppercase\",color:current===i?active:idle,borderBottom:\"1px solid \"+(current===i?accent:\"transparent\"),transition:\"color .25s ease, border-color .25s ease\"},children:label},label))})});}addPropertyControls(MenuTabs,{labels:{type:ControlType.String,title:\"Labels\",defaultValue:\"The Table, Salads, Flatbreads, Entrees, Desserts\"},targets:{type:ControlType.String,title:\"Targets\",defaultValue:\"For the Table, Soups & Salads, Flatbreads, Entrees, Desserts\"},accent:{type:ControlType.Color,title:\"Accent\",defaultValue:\"rgb(128, 96, 52)\"},idle:{type:ControlType.Color,title:\"Idle\",defaultValue:\"rgba(28, 22, 17, 0.68)\"},active:{type:ControlType.Color,title:\"Active\",defaultValue:\"rgb(28, 22, 17)\"},offset:{type:ControlType.Number,title:\"Header offset\",min:0,max:240,step:4,defaultValue:120},gap:{type:ControlType.Number,title:\"Gap\",min:8,max:60,step:2,defaultValue:26},edge:{type:ControlType.Number,title:\"Edge pad\",min:0,max:48,step:2,defaultValue:0},top:{type:ControlType.Number,title:\"Space above\",min:0,max:64,step:2,defaultValue:30},center:{type:ControlType.Boolean,title:\"Centre\",defaultValue:true}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"MenuTabs\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"any\",\"framerDisableUnlink\":\"\",\"framerContractVersion\":\"1\",\"framerIntrinsicWidth\":\"600\",\"framerSupportedLayoutWidth\":\"any\",\"framerIntrinsicHeight\":\"40\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./MenuTabs.map"],"mappings":"sMAGA,SAAS,EAAY,EAAK,CAA+H,OAA3H,OAAO,SAAW,IAAmB,KAAe,MAAM,KAAK,SAAS,iBAAiB,sBAAsB,EAAK,IAAI,CAAY,CAAC,CAAC,KAAK,GAAI,CAAC,IAAM,EAAM,EAAwG,OAAzF,OAAO,EAAM,iBAAkB,WAAW,EAAM,gBAAgB,EAAE,EAAG,eAAe,OAAmB,EAAG,sBAAsB,CAAC,CAAC,MAAM,CAAE,CAAC,GAAG,IAAK,CASzV,SAAwB,EAAS,EAAM,CAAC,GAAK,CAAC,SAAO,mDAAmD,UAAQ,+DAA+D,SAAO,mBAAmB,OAAK,yBAAyB,SAAO,k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