{"version":3,"file":"MobileMenu.UFe-HcEc.mjs","names":["useState","useRef","useId","useMemo","useCallback"],"sources":["https:/framerusercontent.com/modules/wC9jCMiDN62m7YDRCcKe/PibkN1PNw0sUlKmv1XfP/MobileMenu.js"],"sourcesContent":["// User request: Create a Framer code component MobileMenu: accessible hamburger button opening a right-aligned dropdown with Hungarian links, closes on Escape/outside/link click, with editable labels/URLs and site-matching visual style for mobile header use.\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{startTransition,useCallback,useEffect,useId,useMemo,useRef,useState}from\"react\";// @ts-ignore - Framer runtime provides react-dom at runtime in this environment\nimport{createPortal}from\"react-dom\";import{addPropertyControls,ControlType,Link}from\"framer\";function isInternalFramerPath(url){return/^\\/(?!\\/)/.test(url);}/**\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight auto\n */export default function MobileMenu(props){const{items,textColor,backgroundColor,borderColor,style}=props;const[isOpen,setIsOpen]=useState(false);const[buttonFocused,setButtonFocused]=useState(false);const[focusedLinkIndex,setFocusedLinkIndex]=useState(null);const[menuPosition,setMenuPosition]=useState({top:0,right:0});const rootRef=useRef(null);const buttonRef=useRef(null);const menuRef=useRef(null);const uniqueId=useId();const buttonId=useMemo(()=>`mobile-menu-button-${uniqueId}`,[uniqueId]);const menuId=useMemo(()=>`mobile-menu-dropdown-${uniqueId}`,[uniqueId]);const safeItems=useMemo(()=>{if(!Array.isArray(items)||items.length===0){return[{label:\"Főoldal\",url:\"/\"},{label:\"R\\xf3lam\",url:\"/rolam\"}];}return items;},[items]);const closeMenu=useCallback(()=>{startTransition(()=>{setIsOpen(false);setFocusedLinkIndex(null);});},[]);const toggleMenu=useCallback(()=>{startTransition(()=>{setIsOpen(prev=>!prev);});},[]);const updateMenuPosition=useCallback(()=>{if(typeof window===\"undefined\")return;const button=buttonRef.current;if(!button)return;const rect=button.getBoundingClientRect();startTransition(()=>{setMenuPosition({top:rect.bottom+8,right:Math.max(0,window.innerWidth-rect.right)});});},[]);useEffect(()=>{if(!isOpen)return;if(typeof window===\"undefined\"||typeof document===\"undefined\")return;updateMenuPosition();const onKeyDown=event=>{if(event.key===\"Escape\"){closeMenu();}};const onPointerDown=event=>{const target=event.target;if(!target)return;const clickedInRoot=rootRef.current?rootRef.current.contains(target):false;const clickedInMenu=menuRef.current?menuRef.current.contains(target):false;if(!clickedInRoot&&!clickedInMenu){closeMenu();}};const onViewportChange=()=>{updateMenuPosition();};document.addEventListener(\"keydown\",onKeyDown);document.addEventListener(\"mousedown\",onPointerDown);document.addEventListener(\"touchstart\",onPointerDown);window.addEventListener(\"resize\",onViewportChange);window.addEventListener(\"scroll\",onViewportChange,true);return()=>{document.removeEventListener(\"keydown\",onKeyDown);document.removeEventListener(\"mousedown\",onPointerDown);document.removeEventListener(\"touchstart\",onPointerDown);window.removeEventListener(\"resize\",onViewportChange);window.removeEventListener(\"scroll\",onViewportChange,true);};},[isOpen,closeMenu,updateMenuPosition]);const isBrowser=typeof document!==\"undefined\";return /*#__PURE__*/_jsxs(\"div\",{ref:rootRef,style:{...style,position:\"relative\",width:style?.width??\"100%\",height:style?.height??\"100%\",display:\"flex\",justifyContent:\"flex-end\",alignItems:\"center\",overflow:\"visible\",boxSizing:\"border-box\",fontFamily:\"Inter, sans-serif\"},children:[/*#__PURE__*/_jsx(\"button\",{ref:buttonRef,id:buttonId,type:\"button\",\"aria-haspopup\":\"menu\",\"aria-controls\":menuId,\"aria-expanded\":isOpen,\"aria-label\":isOpen?\"Men\\xfc bez\\xe1r\\xe1sa\":\"Men\\xfc megnyit\\xe1sa\",onClick:toggleMenu,onFocus:()=>{startTransition(()=>setButtonFocused(true));},onBlur:()=>{startTransition(()=>setButtonFocused(false));},style:{width:42,height:42,borderRadius:8,border:`1px solid ${borderColor}`,background:backgroundColor,color:textColor,display:\"flex\",flexDirection:\"column\",justifyContent:\"center\",alignItems:\"center\",gap:5,cursor:\"pointer\",boxSizing:\"border-box\",outline:\"none\",boxShadow:buttonFocused?`0 0 0 2px ${textColor}33`:\"none\"},children:[0,1,2].map(line=>/*#__PURE__*/_jsx(\"span\",{\"aria-hidden\":\"true\",style:{display:\"block\",width:18,height:2,borderRadius:1,background:textColor}},line))}),isOpen&&isBrowser&&/*#__PURE__*/createPortal(/*#__PURE__*/_jsx(\"nav\",{ref:menuRef,id:menuId,\"aria-label\":\"Mobil navig\\xe1ci\\xf3\",style:{position:\"fixed\",top:menuPosition.top,right:menuPosition.right,minWidth:210,width:\"max-content\",maxWidth:\"min(88vw, 320px)\",zIndex:2147483647,background:backgroundColor,border:`1px solid ${borderColor}`,borderRadius:10,boxSizing:\"border-box\",boxShadow:\"0 10px 30px rgba(0,0,0,0.14)\",padding:6},children:/*#__PURE__*/_jsx(\"ul\",{role:\"menu\",\"aria-labelledby\":buttonId,style:{margin:0,padding:0,listStyle:\"none\",display:\"flex\",flexDirection:\"column\",gap:2},children:safeItems.map((item,index)=>/*#__PURE__*/_jsx(\"li\",{role:\"none\",children:isInternalFramerPath(item.url||\"/\")?/*#__PURE__*/_jsx(Link,{href:item.url||\"/\",children:/*#__PURE__*/_jsx(\"a\",{role:\"menuitem\",onClick:closeMenu,onFocus:()=>{startTransition(()=>setFocusedLinkIndex(index));},onBlur:()=>{startTransition(()=>setFocusedLinkIndex(prev=>prev===index?null:prev));},style:{display:\"block\",width:\"100%\",textDecoration:\"none\",color:textColor,fontSize:15,lineHeight:\"1.3em\",letterSpacing:\"-0.01em\",fontWeight:500,borderRadius:8,padding:\"10px 12px\",boxSizing:\"border-box\",outline:\"none\",background:focusedLinkIndex===index?`${textColor}10`:\"transparent\",boxShadow:focusedLinkIndex===index?`0 0 0 2px ${textColor}33 inset`:\"none\"},children:item.label})}):/*#__PURE__*/_jsx(\"a\",{role:\"menuitem\",href:item.url||\"/\",onClick:closeMenu,onFocus:()=>{startTransition(()=>setFocusedLinkIndex(index));},onBlur:()=>{startTransition(()=>setFocusedLinkIndex(prev=>prev===index?null:prev));},style:{display:\"block\",width:\"100%\",textDecoration:\"none\",color:textColor,fontSize:15,lineHeight:\"1.3em\",letterSpacing:\"-0.01em\",fontWeight:500,borderRadius:8,padding:\"10px 12px\",boxSizing:\"border-box\",outline:\"none\",background:focusedLinkIndex===index?`${textColor}10`:\"transparent\",boxShadow:focusedLinkIndex===index?`0 0 0 2px ${textColor}33 inset`:\"none\"},children:item.label})},`${item.label}-${index}`))})}),document.body)]});}addPropertyControls(MobileMenu,{items:{type:ControlType.Array,title:\"Links\",defaultValue:[{label:\"Főoldal\",url:\"/\"},{label:\"R\\xf3lam\",url:\"/rolam\"},{label:\"Hogyan dolgozom\",url:\"/hogyan_dolgozom\"},{label:\"Referenci\\xe1k\",url:\"/referenciak\"},{label:\"GY.I.K.\",url:\"/gyakori-kerdesek\"},{label:\"Kapcsolat\",url:\"/kapcsolat\"}],control:{type:ControlType.Object,controls:{label:{type:ControlType.String,title:\"Label\",defaultValue:\"Men\\xfcpont\"},url:{type:ControlType.String,title:\"URL\",defaultValue:\"/\"}}}},textColor:{type:ControlType.Color,title:\"Text\",defaultValue:\"#24221F\"},backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"#EFEAE1\"},borderColor:{type:ControlType.Color,title:\"Border\",defaultValue:\"#D8D0C2\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"MobileMenu\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"auto\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./MobileMenu.map"],"mappings":"8PAE6F,SAAS,EAAqB,EAAI,CAAC,MAAM,YAAY,KAAK,CAAG,CAAE,CAGzJ,SAAwB,EAAW,EAAM,CAAC,GAAK,CAAC,QAAM,YAAU,kBAAgB,cAAY,SAAO,EAAW,CAAC,EAAO,GAAWA,EAAS,EAAK,EAAO,CAAC,EAAc,GAAkBA,EAAS,EAAK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