'use client' import * as React from 'react' import { cn } from '../../internal/utils' import { NavigationContext, useNavigationContext, type NavigationSize, type NavigationVariant, type NavigationActiveLink, type NavigationContextValue, } from './navigation-context' type NavigationBaseProps = Omit, 'aria-orientation'> & { /** * Scales link text, padding, and icons. * @default 'md' */ size?: NavigationSize /** * The `value` of the current link. Stamps the match with `aria-current="page"`. * @default null */ activeLink?: NavigationActiveLink } // `orientation` discriminates the union, so both branches repeat the same prop // docs - TypeScript surfaces whichever branch the consumer's usage narrows to. type NavigationProps = NavigationBaseProps & ( | { /** Lay the links out as a row or a column. @default 'horizontal' */ orientation?: 'horizontal' /** Active/hover styling. `indicator` is vertical-only. @default 'pill' */ variant?: Extract } | { /** Lay the links out as a row or a column. @default 'horizontal' */ orientation: 'vertical' /** Active/hover styling. `indicator` is vertical-only. @default 'pill' */ variant?: Extract } ) function Navigation({ className, orientation = 'horizontal', variant = 'pill', size = 'md', activeLink = null, ...props }: NavigationProps) { const ctx = React.useMemo( () => ({ orientation, variant: variant as NavigationVariant, size, activeLink }), [orientation, variant, size, activeLink], ) return (