{"version":3,"file":"DropdownNavigation.Dcd_b2Bb.mjs","names":["useState","useRef"],"sources":["https:/framerusercontent.com/modules/NDrPCjG8BGqintVBaSyG/h0p48rHF2J8XBpe9emmh/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 * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */export default function DropdownNavigation(props){const{items=[],placeholder,backgroundColor,textColor,borderColor,accentColor,font,borderRadius,padding,shadow,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 an external link or internal\nif(item.link.startsWith(\"http\")||item.link.startsWith(\"mailto\")){window.open(item.link,\"_blank\");}else{// For internal links, we try to use window.location\n// In a real Framer site, this might need specific handling depending on router\nwindow.location.href=item.link;}}};const toggleDropdown=()=>{if(isStatic)return;startTransition(()=>setIsOpen(!isOpen));};const selectedItem=selectedIndex>=0&&selectedIndex<items.length?items[selectedIndex]:null;// Animation variants\nconst menuVariants={closed:{opacity:0,y:-4,scale:.98,transition:{duration:.15,ease:\"easeInOut\"},pointerEvents:\"none\"},open:{opacity:1,y:4,scale:1,transition:{duration:.2,ease:\"easeOut\"},pointerEvents:\"auto\"}};const chevronVariants={closed:{rotate:0},open:{rotate:180}};return /*#__PURE__*/_jsxs(\"div\",{ref:containerRef,style:{width:\"100%\",height:\"100%\",position:\"relative\",zIndex:isOpen?50:1,...font},children:[/*#__PURE__*/_jsxs(motion.button,{onClick:toggleDropdown,style:{width:\"100%\",height:\"100%\",display:\"flex\",alignItems:\"center\",justifyContent:\"space-between\",padding:`0 ${padding}px`,backgroundColor:backgroundColor,color:textColor,border:`1px solid ${borderColor}`,borderRadius:borderRadius,cursor:\"pointer\",outline:\"none\",boxShadow:shadow?\"0 2px 4px rgba(0,0,0,0.05)\":\"none\",textAlign:\"left\",transition:\"border-color 0.2s ease\",...font},whileHover:isStatic?undefined:{borderColor:accentColor,opacity:.95},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,{variants:chevronVariants,animate:isOpen?\"open\":\"closed\",transition:{duration:.2},style:{display:\"flex\",alignItems:\"center\",justifyContent:\"center\",marginLeft:8,opacity:.5},children:/*#__PURE__*/_jsx(\"svg\",{width:\"12\",height:\"12\",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:\"closed\",animate:\"open\",exit:\"closed\",variants:menuVariants,style:{position:\"absolute\",top:\"100%\",left:0,width:\"100%\",backgroundColor:backgroundColor,border:`1px solid ${borderColor}`,borderRadius:borderRadius,boxShadow:\"0 4px 12px rgba(0,0,0,0.1), 0 0 0 1px rgba(0,0,0,0.02)\",overflow:\"hidden\",padding:4,display:\"flex\",flexDirection:\"column\",gap:2,maxHeight:300,overflowY:\"auto\"},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__*/_jsxs(motion.div,{onClick:onClick,onHoverStart:()=>setIsHovered(true),onHoverEnd:()=>setIsHovered(false),style:{padding:`8px ${padding}px`,cursor:\"pointer\",borderRadius:borderRadius,backgroundColor:isSelected?`${accentColor}15`// 15 is roughly 8% opacity in hex\n:\"transparent\",color:isSelected?accentColor:textColor,display:\"flex\",alignItems:\"center\",justifyContent:\"space-between\",position:\"relative\",borderLeft:`2px solid ${isHovered&&!isSelected?`${accentColor}60`// 40% opacity accent border on hover\n:\"transparent\"}`,paddingLeft:`${padding-2}px`,transition:\"border-color 0.2s ease, background-color 0.2s ease\",...font},whileHover:{backgroundColor:isSelected?`${accentColor}15`:`${accentColor}14`},children:[/*#__PURE__*/_jsx(\"span\",{style:{fontWeight:isSelected?500:400,whiteSpace:\"nowrap\",overflow:\"hidden\",textOverflow:\"ellipsis\",opacity:isHovered&&!isSelected?1:.92,transition:\"opacity 0.2s ease\"},children:item.label}),isSelected&&/*#__PURE__*/_jsx(motion.div,{initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},style:{color:accentColor},children:/*#__PURE__*/_jsx(\"svg\",{width:\"12\",height:\"12\",viewBox:\"0 0 12 12\",fill:\"none\",xmlns:\"http://www.w3.org/2000/svg\",children:/*#__PURE__*/_jsx(\"path\",{d:\"M2.5 6L5 8.5L9.5 3.5\",stroke:\"currentColor\",strokeWidth:\"1.5\",strokeLinecap:\"round\",strokeLinejoin:\"round\"})})})]});}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,description:\"Index of initially selected item. -1 for none.\"},placeholder:{type:ControlType.String,title:\"Placeholder\",defaultValue:\"Select Layout...\"},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultValue:{fontSize:14,lineHeight:\"1.4em\"}},backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"#FFFFFF\"},textColor:{type:ControlType.Color,title:\"Text\",defaultValue:\"#111111\"},borderColor:{type:ControlType.Color,title:\"Border\",defaultValue:\"#E5E5E5\"},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},shadow:{type:ControlType.Boolean,title:\"Shadow\",defaultValue:true}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"DropdownNavigation\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"fixed\",\"framerSupportedLayoutWidth\":\"fixed\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./DropdownNavigation.map"],"mappings":"oRAGG,SAAwB,EAAmB,EAAM,CAAC,GAAK,CAAC,QAAM,CAAC,EAAE,cAAY,kBAAgB,YAAU,cAAY,cAAY,OAAK,eAAa,UAAQ,SAAO,wBAAsB,EAAW,CAAC,EAAO,GAAWA,EAAS,EAAK,EAAO,CAAC,EAAc,GAAkBA,EAAS,CAAoB,EAAQ,EAAaC,EAAO,IAAI,EAAQ,EAAS,EAAo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