{"version":3,"file":"DropdownNavigation.DiulPfYN.mjs","names":["useState","useRef"],"sources":["https:/framerusercontent.com/modules/0l66JoNiTf5oJg0aN7wK/pwP36XUKIWc76mncrDfg/DropdownNavigation.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";import{AnimatePresence,motion}from\"framer-motion\";import{useEffect,useRef,useState,startTransition}from\"react\";/**\n * Change the font type to this website's font type, remove the shadow and the border\n * \n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function DropdownNavigation(props){const{items=[],placeholder,backgroundColor,textColor,accentColor,font,borderRadius,padding,initialSelectedIndex}=props;const[isOpen,setIsOpen]=useState(false);const[selectedIndex,setSelectedIndex]=useState(initialSelectedIndex);const containerRef=useRef(null);const isStatic=useIsStaticRenderer();useEffect(()=>{setSelectedIndex(initialSelectedIndex);},[initialSelectedIndex]);// Close dropdown when clicking outside\nuseEffect(()=>{if(isStatic||!isOpen)return;const handleClickOutside=event=>{if(containerRef.current&&!containerRef.current.contains(event.target)){startTransition(()=>setIsOpen(false));}};document.addEventListener(\"mousedown\",handleClickOutside);return()=>{document.removeEventListener(\"mousedown\",handleClickOutside);};},[isStatic,isOpen]);const handleSelect=(index,item)=>{startTransition(()=>{setSelectedIndex(index);setIsOpen(false);});// Handle navigation if a link is provided\nif(item.link&&!isStatic){// Check if it's a Framer editor URL with a node parameter\nconst url=new URL(item.link,window.location.href);const nodeId=url.searchParams.get(\"node\");if(nodeId){// Try to find the element by data-framer-name or id\nconst targetElement=document.querySelector(`[data-framer-name=\"${nodeId}\"]`)||document.querySelector(`[id=\"${nodeId}\"]`)||document.querySelector(`#${nodeId}`);if(targetElement){targetElement.scrollIntoView({behavior:\"smooth\",block:\"start\"});return;}}// If it's a hash link (e.g., #section-name)\nif(item.link.startsWith(\"#\")){const targetElement=document.querySelector(item.link);if(targetElement){targetElement.scrollIntoView({behavior:\"smooth\",block:\"start\"});return;}}// Otherwise navigate to the URL\nwindow.location.href=item.link;}};const toggleDropdown=()=>{if(isStatic)return;startTransition(()=>setIsOpen(!isOpen));};const selectedItem=selectedIndex>=0&&selectedIndex<items.length?items[selectedIndex]:null;return /*#__PURE__*/_jsxs(\"div\",{ref:containerRef,style:{width:\"max-content\",minWidth:200,height:\"auto\",position:\"relative\",zIndex:isOpen?9999:1,overflow:\"visible\",fontFamily:\"Manrope, sans-serif\",...font},children:[/*#__PURE__*/_jsx(\"link\",{href:\"https://fonts.googleapis.com/css2?family=Manrope:wght@200..800&display=swap\",rel:\"stylesheet\"}),/*#__PURE__*/_jsxs(motion.button,{onClick:toggleDropdown,onMouseDown:e=>e.preventDefault(),style:{width:\"100%\",height:\"auto\",display:\"flex\",alignItems:\"center\",justifyContent:\"space-between\",padding:`0 ${padding}px`,backgroundColor:backgroundColor,color:textColor,border:\"none\",borderRadius:borderRadius,cursor:\"pointer\",outline:\"none\",textAlign:\"left\",transition:\"opacity 0.2s ease\",pointerEvents:\"auto\",fontFamily:\"Manrope, sans-serif\",...font},whileHover:isStatic?undefined:{opacity:.85},whileTap:{scale:.99},children:[/*#__PURE__*/_jsx(\"span\",{style:{whiteSpace:\"nowrap\",overflow:\"hidden\",textOverflow:\"ellipsis\",opacity:selectedItem?1:.6},children:selectedItem?selectedItem.label:placeholder}),/*#__PURE__*/_jsx(motion.div,{animate:{rotate:isOpen?180:0},transition:{duration:.2},style:{display:\"flex\",alignItems:\"center\",justifyContent:\"center\",marginLeft:8,opacity:.5},children:/*#__PURE__*/_jsx(\"svg\",{width:\"16\",height:\"16\",viewBox:\"0 0 12 12\",fill:\"none\",xmlns:\"http://www.w3.org/2000/svg\",children:/*#__PURE__*/_jsx(\"path\",{d:\"M2.5 4.5L6 8L9.5 4.5\",stroke:\"currentColor\",strokeWidth:\"1.5\",strokeLinecap:\"round\",strokeLinejoin:\"round\"})})})]}),/*#__PURE__*/_jsx(AnimatePresence,{children:isOpen&&/*#__PURE__*/_jsx(motion.div,{initial:{opacity:0,y:-4,scale:.98},animate:{opacity:1,y:4,scale:1},exit:{opacity:0,y:-4,scale:.98},transition:{duration:.2,ease:[0,0,.2,1]},style:{position:\"absolute\",top:\"100%\",left:0,width:\"100%\",minWidth:\"100%\",backgroundColor:backgroundColor,border:\"none\",borderRadius:borderRadius,overflow:\"visible\",padding:4,display:\"flex\",flexDirection:\"column\",gap:2,maxHeight:300,overflowY:\"auto\",pointerEvents:\"auto\",zIndex:1e4,boxShadow:\"0 4px 12px rgba(0, 0, 0, 0.15)\"},children:items.map((item,index)=>/*#__PURE__*/_jsx(DropdownItem,{item:item,isSelected:index===selectedIndex,onClick:()=>handleSelect(index,item),accentColor:accentColor,textColor:textColor,borderRadius:Math.max(0,borderRadius-2),padding:padding,font:font},item.id||index))})})]});}function DropdownItem({item,isSelected,onClick,accentColor,textColor,borderRadius,padding,font}){const[isHovered,setIsHovered]=useState(false);return /*#__PURE__*/_jsx(motion.div,{onClick:onClick,onHoverStart:()=>setIsHovered(true),onHoverEnd:()=>setIsHovered(false),style:{padding:`8px ${padding}px`,cursor:\"pointer\",borderRadius:borderRadius,backgroundColor:isSelected?\"#E0E0E0\":\"transparent\",color:textColor,display:\"flex\",alignItems:\"center\",justifyContent:\"space-between\",position:\"relative\",borderLeft:`2px solid ${isHovered&&!isSelected?`${accentColor}60`:\"transparent\"}`,paddingLeft:`${padding-2}px`,transition:\"border-color 0.2s ease, background-color 0.2s ease\",fontFamily:\"Manrope, sans-serif\",...font},whileHover:{backgroundColor:isSelected?\"#E0E0E0\":\"#F5F5F5\"},children:/*#__PURE__*/_jsx(\"span\",{style:{fontWeight:isSelected?700:400,whiteSpace:\"nowrap\",overflow:\"hidden\",textOverflow:\"ellipsis\",opacity:isHovered&&!isSelected?1:.92,transition:\"opacity 0.2s ease\"},children:item.label})});}addPropertyControls(DropdownNavigation,{items:{type:ControlType.Array,title:\"Options\",control:{type:ControlType.Object,controls:{label:{type:ControlType.String,defaultValue:\"Option Label\"},link:{type:ControlType.Link,title:\"Link\"}}},defaultValue:[{label:\"Layout A\",link:\"\"},{label:\"Layout B\",link:\"\"},{label:\"Layout C\",link:\"\"}]},initialSelectedIndex:{type:ControlType.Number,title:\"Selected\",defaultValue:-1,min:-1,displayStepper:true},placeholder:{type:ControlType.String,title:\"Placeholder\",defaultValue:\"Select Layout...\"},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:20,lineHeight:\"1.75em\"}},backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"#FFFFFF\"},textColor:{type:ControlType.Color,title:\"Text\",defaultValue:\"#111111\"},accentColor:{type:ControlType.Color,title:\"Accent\",defaultValue:\"#0099FF\"},borderRadius:{type:ControlType.Number,title:\"Radius\",defaultValue:8,min:0,max:20},padding:{type:ControlType.Number,title:\"Padding\",defaultValue:12,min:4,max:32}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"DropdownNavigation\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"auto\",\"framerSupportedLayoutWidth\":\"auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./DropdownNavigation.map"],"mappings":"0QAKG,SAAwB,EAAmB,EAAM,CAAC,GAAK,CAAC,QAAM,CAAC,EAAE,cAAY,kBAAgB,YAAU,cAAY,OAAK,eAAa,UAAQ,wBAAsB,EAAW,CAAC,EAAO,GAAWA,EAAS,EAAK,EAAO,CAAC,EAAc,GAAkBA,EAAS,CAAoB,EAAQ,EAAaC,EAAO,IAAI,EAAQ,EAAS,EAAoB,EAAE,MAAc,CAAC,EAAiB,CAAoB,CAAE,EAAE,CAAC,CAAoB,CAAC,EAC5a,MAAc,CAAC,GAAG,GAAU,CAAC,EAAO,OAAO,IAAM,EAAmB,GAAO,CAAI,EAAa,SAAS,CAAC,EAAa,QAAQ,SAAS,EAAM,MAA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