{"version":3,"file":"HeaderDropdown.BceYfaeC.mjs","names":["useState","useRef","useMemo","useCallback"],"sources":["https:/framerusercontent.com/modules/7qbxDwwrIZQT5jmCwevk/aoEcFeHsS9w67eHDauTv/HeaderDropdown.js"],"sourcesContent":["// Create a small Framer code component `HeaderDropdown.tsx` for an accessible responsive click/tap dropdown trigger labeled 'Oppkjøring / slokkeøvelse' with exact links Forespør oppkjøring /oppkjoring, Forespør slokkeøvelse /slokkeovelse, Forespør kurs /kursforesporsel. Styled Inter 16px semibold dark navy #0F2C41; menu white shadow, radius 9; no overlapping on mobile (menu rendered in flow on narrow screens); keyboard and outside click closing. Keep all other code unchanged. Provide component name/path after creation.\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useCallback,useEffect,useMemo,useRef,useState,startTransition}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function HeaderDropdown(props){const{label,menuType,textColor,menuBackground,shadowColor,borderRadius,mobileBreakpoint,font}=props;const[isOpen,setIsOpen]=useState(false);const[isMobile,setIsMobile]=useState(false);const rootRef=useRef(null);const resolvedFontFamily=font.fontFamily??\"Inter, sans-serif\";const links=useMemo(()=>{if(menuType===\"services\"){return[{title:\"Mistet bevis – Statens vegvesen\",href:\"https://kurskomp.vegvesen.no/Portal/Login\"},{title:\"Mistet bevis – Sentralregisteret\",href:\"https://sentralregisteret.no/kompetanseregisteret/endre-bevis/\"},{title:\"Bevis varme arbeider\",href:\"https://app.superoffice.com/Cust24532/CS/scripts/customer.fcgi?_sf=0%20&action=safeParse&includeId=bvisframefork&key=sbZNK1XruRCcPXJ2&page=certificatepage&custSessionKey=&lang=\"}];}return[{title:\"Foresp\\xf8r oppkj\\xf8ring\",href:\"/oppkjoring\"},{title:\"Foresp\\xf8r slokke\\xf8velse\",href:\"/slokkeovelse\"},{title:\"Foresp\\xf8r kurs\",href:\"/kursforesporsel\"}];},[menuType]);const closeMenu=useCallback(()=>{startTransition(()=>setIsOpen(false));},[]);const toggleMenu=useCallback(()=>{startTransition(()=>setIsOpen(prev=>!prev));},[]);useEffect(()=>{if(typeof window===\"undefined\")return;const updateViewport=()=>{const nextIsMobile=window.innerWidth<=mobileBreakpoint;startTransition(()=>setIsMobile(nextIsMobile));};updateViewport();window.addEventListener(\"resize\",updateViewport);return()=>window.removeEventListener(\"resize\",updateViewport);},[mobileBreakpoint]);useEffect(()=>{if(!isOpen||typeof document===\"undefined\")return;const onPointerDown=event=>{const target=event.target;if(!target)return;if(rootRef.current&&!rootRef.current.contains(target)){closeMenu();}};const onKeyDown=event=>{if(event.key===\"Escape\")closeMenu();};document.addEventListener(\"pointerdown\",onPointerDown);document.addEventListener(\"keydown\",onKeyDown);return()=>{document.removeEventListener(\"pointerdown\",onPointerDown);document.removeEventListener(\"keydown\",onKeyDown);};},[isOpen,closeMenu]);return /*#__PURE__*/_jsxs(\"div\",{ref:rootRef,style:{position:\"relative\",display:\"inline-flex\",flexDirection:\"column\",width:isMobile?\"100%\":\"auto\",color:textColor,minWidth:\"max-content\"},children:[/*#__PURE__*/_jsx(\"button\",{type:\"button\",\"aria-haspopup\":\"menu\",\"aria-expanded\":isOpen,\"aria-label\":label,onClick:toggleMenu,style:{border:\"none\",background:\"transparent\",color:textColor,cursor:\"pointer\",padding:0,margin:0,textAlign:\"left\",fontFamily:resolvedFontFamily,fontSize:font.fontSize,lineHeight:font.lineHeight,letterSpacing:font.letterSpacing,fontWeight:font.fontWeight,fontStyle:font.fontStyle,width:\"max-content\"},children:label}),isOpen&&/*#__PURE__*/_jsx(\"div\",{role:\"menu\",\"aria-label\":\"Kursmeny\",style:{position:isMobile?\"relative\":\"absolute\",top:isMobile?\"auto\":\"calc(100% + 8px)\",left:0,right:isMobile?0:\"auto\",zIndex:20,display:\"flex\",flexDirection:\"column\",gap:2,padding:8,marginTop:isMobile?8:0,minWidth:isMobile?\"100%\":260,background:menuBackground,borderRadius,boxShadow:`0px 8px 24px ${shadowColor}`},children:links.map(link=>/*#__PURE__*/_jsx(\"a\",{href:link.href,target:menuType===\"services\"?\"_blank\":undefined,rel:menuType===\"services\"?\"noopener noreferrer\":undefined,role:\"menuitem\",onClick:closeMenu,style:{color:textColor,textDecoration:\"none\",padding:\"10px 12px\",borderRadius:6,fontFamily:resolvedFontFamily,fontSize:font.fontSize,lineHeight:font.lineHeight,letterSpacing:font.letterSpacing,fontWeight:font.fontWeight,fontStyle:font.fontStyle,whiteSpace:\"nowrap\"},children:link.title},link.href))})]});}addPropertyControls(HeaderDropdown,{label:{type:ControlType.String,title:\"Label\",defaultValue:\"Oppkj\\xf8ring / slokke\\xf8velse\"},menuType:{type:ControlType.Enum,title:\"Menu\",defaultValue:\"requests\",options:[\"requests\",\"services\"],optionTitles:[\"Requests\",\"Services\"]},textColor:{type:ControlType.Color,title:\"Text\",defaultValue:\"#0F2C41\"},menuBackground:{type:ControlType.Color,title:\"Menu BG\",defaultValue:\"#FFFFFF\"},shadowColor:{type:ControlType.Color,title:\"Shadow\",defaultValue:\"rgba(15, 44, 65, 0.18)\"},borderRadius:{type:ControlType.Number,title:\"Radius\",defaultValue:9,min:0,max:40,step:1},mobileBreakpoint:{type:ControlType.Number,title:\"Mobile ≤\",defaultValue:768,min:320,max:1200,step:1},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"16px\",variant:\"Semibold\",lineHeight:\"1.2em\",letterSpacing:\"0em\"}}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"HeaderDropdown\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"auto\",\"framerSupportedLayoutWidth\":\"auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./HeaderDropdown.map"],"mappings":"kOAIG,SAAwB,EAAe,EAAM,CAAC,GAAK,CAAC,QAAM,WAAS,YAAU,iBA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