{"version":3,"file":"FloatingPillNavigation.CDINin2d.mjs","names":["useState","useRef","__esmMin","init_npm_react_18_3_1","te","de","window","init_ssg_sandbox_shims","p","init_jsx_runtime","ce","_e","motion","init_framer_motion_DhsWWWsN","addPropertyControls","ControlType","init_framer_BWFVvmND","FloatingPillNavigation","props","internalActiveLink","setInternalActiveLink","activeLink","navRef","linkRef","navBorderRadius","setNavBorderRadius","linkBorderRadius","setLinkBorderRadius","updateBorderRadii","navHeight","linkHeight","resizeObserver","linkPadding","font","items","handleClick","label","href","finalHref","target","isActive","item","index","activeTextColor","textColor","activeBackgroundColor","init_FloatingPillNavigation"],"sources":["https:/framerusercontent.com/modules/rl7d7Vf87QGDeF4IBjBw/qwsogf78G8HhJg4I53jE/FloatingPillNavigation.js"],"sourcesContent":["// Pill-shaped navigation with animated background that shifts between links on click\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{motion}from\"framer-motion\";import{useState,startTransition,useEffect,useRef}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function FloatingPillNavigation(props){const{items,backgroundColor,textColor,activeBackgroundColor,activeTextColor,padding,gap,font,activeLink=\"Home\",transition,linkPadding}=props;// Internal state for interactive clicking\nconst[internalActiveLink,setInternalActiveLink]=useState(activeLink);const navRef=useRef(null);const linkRef=useRef(null);const[navBorderRadius,setNavBorderRadius]=useState(50);const[linkBorderRadius,setLinkBorderRadius]=useState(25);// Sync internal state when activeLink prop changes\nuseEffect(()=>{startTransition(()=>{setInternalActiveLink(activeLink);});},[activeLink]);// Calculate border radii based on heights\nuseEffect(()=>{const updateBorderRadii=()=>{if(navRef.current){const navHeight=navRef.current.offsetHeight;setNavBorderRadius(navHeight/2);}if(linkRef.current){const linkHeight=linkRef.current.offsetHeight;setLinkBorderRadius(linkHeight/2);}};updateBorderRadii();// Use ResizeObserver to update when size changes\nconst resizeObserver=new ResizeObserver(updateBorderRadii);if(navRef.current)resizeObserver.observe(navRef.current);if(linkRef.current)resizeObserver.observe(linkRef.current);return()=>resizeObserver.disconnect();},[linkPadding,font,items]);const handleClick=(label,href,target)=>{startTransition(()=>{setInternalActiveLink(label);});// Navigate if href is provided\nif(href&&typeof window!==\"undefined\"){// Add https:// if the URL doesn't have a protocol and isn't a relative path\nlet finalHref=href;if(!href.match(/^(https?:\\/\\/|mailto:|tel:|#|\\/)/)){finalHref=`https://${href}`;}if(target===\"_blank\"){window.open(finalHref,\"_blank\");}else{window.location.href=finalHref;}}};return /*#__PURE__*/_jsx(\"nav\",{ref:navRef,style:{display:\"inline-flex\",backgroundColor,borderRadius:navBorderRadius,padding,gap,position:\"relative\",width:\"max-content\",userSelect:\"none\",WebkitUserSelect:\"none\",MozUserSelect:\"none\"},children:items.map((item,index)=>{const isActive=item.label===internalActiveLink;return /*#__PURE__*/_jsxs(\"div\",{ref:index===0?linkRef:null,onClick:()=>handleClick(item.label,item.href,item.target),style:{position:\"relative\",padding:linkPadding,textDecoration:\"none\",color:isActive?activeTextColor:textColor,cursor:\"pointer\",zIndex:1,transition:\"color 0.3s ease\",userSelect:\"none\",WebkitUserSelect:\"none\",MozUserSelect:\"none\",...font},children:[isActive&&/*#__PURE__*/_jsx(motion.div,{layoutId:\"activeBackground\",style:{position:\"absolute\",top:0,left:0,right:0,bottom:0,backgroundColor:activeBackgroundColor,borderRadius:linkBorderRadius,zIndex:-1},transition:transition}),item.label]},index);})});}addPropertyControls(FloatingPillNavigation,{activeLink:{type:ControlType.String,title:\"Active Link\",defaultValue:\"All products\",description:\"Enter the label of the link you want to be active initially\"},transition:{type:ControlType.Transition,title:\"Transition\",defaultValue:{type:\"spring\",stiffness:800,damping:60,mass:1}},linkPadding:{type:ControlType.Padding,title:\"Link Padding\",defaultValue:\"12px 22px 12px 22px\"},items:{type:ControlType.Array,control:{type:ControlType.Object,controls:{label:{type:ControlType.String,defaultValue:\"Link\"},href:{type:ControlType.String,title:\"Link To\",placeholder:\"/page or #section\",description:\"Optional: Link to a page or section\"},target:{type:ControlType.Enum,title:\"Open In\",options:[\"_self\",\"_blank\"],optionTitles:[\"Same Tab\",\"New Tab\"],defaultValue:\"_self\",hidden:props=>!props.href}}},defaultValue:[{label:\"All products\"},{label:\"Laptops\"},{label:\"Desktops\"},{label:\"Displays\"}]},backgroundColor:{type:ControlType.Color,defaultValue:\"#E8E8ED\"},textColor:{type:ControlType.Color,defaultValue:\"#000000\",title:\"Inactive Text\"},activeBackgroundColor:{type:ControlType.Color,defaultValue:\"#1D1D1F\",title:\"Active BG\"},activeTextColor:{type:ControlType.Color,defaultValue:\"#FFFFFF\",title:\"Active Text\"},padding:{type:ControlType.Number,defaultValue:6,min:0,max:20,step:1,unit:\"px\"},gap:{type:ControlType.Number,defaultValue:0,min:0,max:20,step:1,unit:\"px\"},font:{type:ControlType.Font,controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"17px\",variant:\"Regular\",letterSpacing:\"-0.37px\",lineHeight:\"20px\"}}});FloatingPillNavigation.displayName=\"Floating Pill Navigation\";\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"FloatingPillNavigation\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"auto\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./FloatingPillNavigation.map"],"mappings":"A,sQAIG,SAAwBiB,EAAuB,EAAM,CAAC,GAAK,CAAC,QAAM,kBAAgB,YAAU,wBAAsB,kBAAgB,UAAQ,MAAI,OAAK,aAAW,OAAO,aAAW,eAAaC,EAC3L,CAACC,EAAmBC,GAAuBpB,EAASqB,CAAU,EAAQC,EAAOrB,EAAO,IAAI,EAAQsB,EAAQtB,EAAO,IAAI,EAAO,CAACuB,EAAgBC,GAAoBzB,EAAS,EAAE,EAAO,CAAC0B,EAAiBC,GAAqB3B,EAAS,EAAE,E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