{"version":3,"file":"AnchorMenu.Dva4F5PD.mjs","names":["useState","useRef"],"sources":["https:/framerusercontent.com/modules/usGO8cDRId8zXEjl7Jyo/DJFqJoQa0uDjbdTWJxxr/AnchorMenu.js"],"sourcesContent":["// Sticky anchor link menu that positions below main navigation\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,useEffect,useRef,startTransition}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * Sticky anchor link menu that positions below main navigation\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight auto\n */export default function AnchorMenu(props){const{links,backgroundColor,textColor,activeColor,hoverColor,font,padding,borderRadius,shadow,topOffset,alignment,mobileBreakpoint,spacing}=props;const[activeSection,setActiveSection]=useState(\"\");const[isSticky,setIsSticky]=useState(false);const[isMobile,setIsMobile]=useState(false);const menuRef=useRef(null);const scrollContainerRef=useRef(null);// Check if we're on mobile\nuseEffect(()=>{if(typeof window===\"undefined\")return;const checkMobile=()=>{startTransition(()=>setIsMobile(window.innerWidth<=mobileBreakpoint));};checkMobile();window.addEventListener(\"resize\",checkMobile);return()=>window.removeEventListener(\"resize\",checkMobile);},[mobileBreakpoint]);// Handle scroll to anchor\nconst handleLinkClick=anchor=>{if(typeof window!==\"undefined\"){const element=document.getElementById(anchor);if(element){const offsetTop=element.offsetTop-topOffset-80// Account for menu height\n;window.scrollTo({top:offsetTop,behavior:\"smooth\"});}}};// Track active section based on scroll position\nuseEffect(()=>{if(typeof window===\"undefined\")return;const handleScroll=()=>{const scrollPosition=window.scrollY+topOffset+100;// Find the current section\nlet currentSection=\"\";links.forEach(link=>{const element=document.getElementById(link.anchor);if(element&&element.offsetTop<=scrollPosition){currentSection=link.anchor;}});startTransition(()=>setActiveSection(currentSection));};window.addEventListener(\"scroll\",handleScroll);handleScroll()// Initial check\n;return()=>{window.removeEventListener(\"scroll\",handleScroll);};},[links,topOffset]);// Auto-scroll to keep active item visible\nuseEffect(()=>{if(!activeSection||!scrollContainerRef.current||!isMobile)return;const activeIndex=links.findIndex(link=>link.anchor===activeSection);if(activeIndex===-1)return;const scrollContainer=scrollContainerRef.current;const activeButton=scrollContainer.children[activeIndex];if(activeButton){const containerRect=scrollContainer.getBoundingClientRect();const buttonRect=activeButton.getBoundingClientRect();// Check if button is out of view\nconst isOutOfView=buttonRect.left<containerRect.left||buttonRect.right>containerRect.right;if(isOutOfView){// Calculate scroll position to center the active item\nconst buttonCenter=activeButton.offsetLeft+activeButton.offsetWidth/2;const containerCenter=scrollContainer.offsetWidth/2;const scrollLeft=buttonCenter-containerCenter;scrollContainer.scrollTo({left:Math.max(0,scrollLeft),behavior:\"smooth\"});}}},[activeSection,links,isMobile]);const isFixedWidth=props?.style&&props.style.width===\"100%\";const menuStyle={...props.style,position:isSticky?\"fixed\":\"relative\",top:isSticky?`${topOffset}px`:\"auto\",left:isSticky?0:\"auto\",right:isSticky?0:\"auto\",width:isSticky?\"100%\":props.style?.width||\"100%\",zIndex:100,backgroundColor,borderRadius:isSticky?0:borderRadius,boxShadow:shadow?\"0 2px 8px rgba(0,0,0,0.1)\":\"none\",padding:`${padding}px`,transition:\"all 0.2s ease\",minHeight:\"60px\",height:\"auto\",...font};const scrollContainerStyle={display:\"flex\",gap:`${spacing}px`,alignItems:\"center\",justifyContent:isMobile?\"flex-start\":alignment===\"left\"?\"flex-start\":alignment===\"right\"?\"flex-end\":\"center\",flexWrap:isMobile?\"nowrap\":\"wrap\",overflowX:isMobile?\"auto\":\"visible\",overflowY:\"hidden\",scrollSnapType:isMobile?\"x mandatory\":\"none\",scrollBehavior:\"smooth\",WebkitOverflowScrolling:\"touch\",// Hide scrollbar on mobile for cleaner look\nscrollbarWidth:\"none\",msOverflowStyle:\"none\"};const buttonStyle=isActive=>({background:\"none\",border:\"none\",padding:\"8px 16px\",borderRadius:\"6px\",cursor:\"pointer\",color:isActive?activeColor:textColor,backgroundColor:isActive?`${activeColor}20`:\"transparent\",transition:\"all 0.2s ease\",whiteSpace:\"nowrap\",flexShrink:0,scrollSnapAlign:isMobile?\"start\":\"none\",minWidth:isMobile?\"auto\":\"unset\",...font});return /*#__PURE__*/_jsxs(\"nav\",{ref:menuRef,style:menuStyle,role:\"navigation\",\"aria-label\":\"Page sections\",children:[/*#__PURE__*/_jsx(\"div\",{ref:scrollContainerRef,style:scrollContainerStyle,className:\"scroll-container\",children:links.map((link,index)=>{const isActive=activeSection===link.anchor;return /*#__PURE__*/_jsx(\"button\",{onClick:()=>handleLinkClick(link.anchor),style:buttonStyle(isActive),onMouseEnter:e=>{if(!isActive){e.currentTarget.style.color=hoverColor;e.currentTarget.style.backgroundColor=`${hoverColor}10`;}},onMouseLeave:e=>{if(!isActive){e.currentTarget.style.color=textColor;e.currentTarget.style.backgroundColor=\"transparent\";}},\"aria-current\":isActive?\"page\":undefined,children:link.label},index);})}),isMobile&&links.length>3&&/*#__PURE__*/_jsx(\"style\",{dangerouslySetInnerHTML:{__html:`\n                        .scroll-container::-webkit-scrollbar {\n                            display: none;\n                        }\n                        .scroll-container {\n                            scrollbar-width: none;\n                            -ms-overflow-style: none;\n                        }\n                        .scroll-container::after {\n                            content: '';\n                            position: absolute;\n                            right: 0;\n                            top: 0;\n                            bottom: 0;\n                            width: 20px;\n                            background: linear-gradient(to right, transparent, ${backgroundColor});\n                            pointer-events: none;\n                            opacity: 0.8;\n                        }\n                    `}})]});}addPropertyControls(AnchorMenu,{links:{type:ControlType.Array,title:\"Navigation Links\",control:{type:ControlType.Object,controls:{label:{type:ControlType.String,title:\"Label\",defaultValue:\"Section\"},anchor:{type:ControlType.String,title:\"Anchor ID\",defaultValue:\"section\"}}},defaultValue:[{label:\"About\",anchor:\"about\"},{label:\"Services\",anchor:\"services\"},{label:\"Portfolio\",anchor:\"portfolio\"},{label:\"Contact\",anchor:\"contact\"},{label:\"Blog\",anchor:\"blog\"}]},alignment:{type:ControlType.Enum,title:\"Alignment\",options:[\"left\",\"center\",\"right\"],optionTitles:[\"Left\",\"Center\",\"Right\"],defaultValue:\"center\",displaySegmentedControl:true},spacing:{type:ControlType.Number,title:\"Item Spacing\",defaultValue:8,min:0,max:32,step:2,unit:\"px\"},mobileBreakpoint:{type:ControlType.Number,title:\"Mobile Breakpoint\",defaultValue:768,min:320,max:1024,step:16,unit:\"px\"},backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"#FFFFFF\"},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#000000\"},activeColor:{type:ControlType.Color,title:\"Active Color\",defaultValue:\"#0099FF\"},hoverColor:{type:ControlType.Color,title:\"Hover Color\",defaultValue:\"#0066FF\"},font:{type:ControlType.Font,title:\"Font\",defaultValue:{fontSize:\"14px\",variant:\"Medium\",letterSpacing:\"-0.01em\",lineHeight:\"1em\"},controls:\"extended\",defaultFontType:\"sans-serif\"},padding:{type:ControlType.Number,title:\"Padding\",defaultValue:16,min:8,max:32,step:4,unit:\"px\"},borderRadius:{type:ControlType.Number,title:\"Border Radius\",defaultValue:8,min:0,max:24,step:2,unit:\"px\"},shadow:{type:ControlType.Boolean,title:\"Shadow\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\"},topOffset:{type:ControlType.Number,title:\"Top Offset\",defaultValue:80,min:0,max:200,step:10,unit:\"px\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"AnchorMenu\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"auto\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./AnchorMenu.map"],"mappings":"wUAMG,SAAwB,EAAW,EAAM,CAAC,GAAK,CAAC,QAAM,kBAAgB,YAAU,cAAY,aAAW,OAAK,UAAQ,eAAa,SAAO,YAAU,YAAU,mBAAiB,WAAS,EAAW,CAAC,EAAc,GAAkBA,EAAS,GAAG,CAAM,CAAC,EAAS,GAAaA,EAAS,GAAM,C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