@radix-ui/react-navigation-menu 1.2.19 → 1.2.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/index.ts", "../src/navigation-menu.tsx"],
4
- "sourcesContent": ["'use client';\nexport {\n createNavigationMenuScope,\n //\n NavigationMenu,\n NavigationMenuSub,\n NavigationMenuList,\n NavigationMenuItem,\n NavigationMenuTrigger,\n NavigationMenuLink,\n NavigationMenuIndicator,\n NavigationMenuContent,\n NavigationMenuViewport,\n //\n Root,\n Sub,\n List,\n Item,\n Trigger,\n Link,\n Indicator,\n Content,\n Viewport,\n} from './navigation-menu';\nexport type {\n NavigationMenuProps,\n NavigationMenuSubProps,\n NavigationMenuListProps,\n NavigationMenuItemProps,\n NavigationMenuTriggerProps,\n NavigationMenuLinkProps,\n NavigationMenuIndicatorProps,\n NavigationMenuContentProps,\n NavigationMenuViewportProps,\n} from './navigation-menu';\n", "import * as React from 'react';\nimport * as ReactDOM from 'react-dom';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { Primitive, dispatchDiscreteCustomEvent } from '@radix-ui/react-primitive';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { useDirection } from '@radix-ui/react-direction';\nimport { Presence } from '@radix-ui/react-presence';\nimport { useId } from '@radix-ui/react-id';\nimport { createCollection } from '@radix-ui/react-collection';\nimport { DismissableLayer } from '@radix-ui/react-dismissable-layer';\nimport { usePrevious } from '@radix-ui/react-use-previous';\nimport { useLayoutEffect } from '@radix-ui/react-use-layout-effect';\nimport { useCallbackRef } from '@radix-ui/react-use-callback-ref';\nimport * as VisuallyHiddenPrimitive from '@radix-ui/react-visually-hidden';\n\nimport type { Scope } from '@radix-ui/react-context';\n\ntype Orientation = 'vertical' | 'horizontal';\ntype Direction = 'ltr' | 'rtl';\n\n/* -------------------------------------------------------------------------------------------------\n * NavigationMenu\n * -----------------------------------------------------------------------------------------------*/\n\nconst NAVIGATION_MENU_NAME = 'NavigationMenu';\n\nconst [Collection, useCollection, createCollectionScope] = createCollection<\n NavigationMenuTriggerElement,\n { value: string }\n>(NAVIGATION_MENU_NAME);\n\nconst [FocusGroupCollection, useFocusGroupCollection, createFocusGroupCollectionScope] =\n createCollection<FocusGroupItemElement, {}>(NAVIGATION_MENU_NAME);\n\ntype ScopedProps<P> = P & { __scopeNavigationMenu?: Scope };\nconst [createNavigationMenuContext, createNavigationMenuScope] = createContextScope(\n NAVIGATION_MENU_NAME,\n [createCollectionScope, createFocusGroupCollectionScope],\n);\n\ntype ContentData = {\n ref?: React.Ref<ViewportContentMounterElement>;\n} & ViewportContentMounterProps;\n\ntype NavigationMenuContextValue = {\n isRootMenu: boolean;\n value: string;\n previousValue: string;\n baseId: string;\n dir: Direction;\n orientation: Orientation;\n rootNavigationMenu: NavigationMenuElement | null;\n indicatorTrack: HTMLDivElement | null;\n onIndicatorTrackChange(indicatorTrack: HTMLDivElement | null): void;\n viewport: NavigationMenuViewportElement | null;\n onViewportChange(viewport: NavigationMenuViewportElement | null): void;\n onViewportContentChange(contentValue: string, contentData: ContentData): void;\n onViewportContentRemove(contentValue: string): void;\n onTriggerEnter(itemValue: string): void;\n onTriggerLeave(): void;\n onContentEnter(): void;\n onContentLeave(): void;\n onItemSelect(itemValue: string): void;\n onItemDismiss(): void;\n};\n\nconst [NavigationMenuProviderImpl, useNavigationMenuContext] =\n createNavigationMenuContext<NavigationMenuContextValue>(NAVIGATION_MENU_NAME);\n\nconst [ViewportContentProvider, useViewportContentContext] = createNavigationMenuContext<{\n items: Map<string, ContentData>;\n}>(NAVIGATION_MENU_NAME);\n\ntype NavigationMenuElement = React.ComponentRef<typeof Primitive.nav>;\ntype PrimitiveNavProps = React.ComponentPropsWithoutRef<typeof Primitive.nav>;\ninterface NavigationMenuProps\n extends\n Omit<NavigationMenuProviderProps, keyof NavigationMenuProviderPrivateProps>,\n PrimitiveNavProps {\n value?: string;\n defaultValue?: string;\n onValueChange?: (value: string) => void;\n dir?: Direction;\n orientation?: Orientation;\n /**\n * The duration from when the pointer enters the trigger until the tooltip gets opened.\n * @defaultValue 200\n */\n delayDuration?: number;\n /**\n * How much time a user has to enter another trigger without incurring a delay again.\n * @defaultValue 300\n */\n skipDelayDuration?: number;\n}\n\nconst NavigationMenu = /* @__PURE__ */ React.forwardRef<NavigationMenuElement, NavigationMenuProps>(\n function NavigationMenu(props: ScopedProps<NavigationMenuProps>, forwardedRef) {\n const {\n __scopeNavigationMenu,\n value: valueProp,\n onValueChange,\n defaultValue,\n delayDuration = 200,\n skipDelayDuration = 300,\n orientation = 'horizontal',\n dir,\n ...NavigationMenuProps\n } = props;\n const [navigationMenu, setNavigationMenu] = React.useState<NavigationMenuElement | null>(null);\n const composedRef = useComposedRefs(forwardedRef, setNavigationMenu);\n const direction = useDirection(dir);\n const openTimerRef = React.useRef(0);\n const closeTimerRef = React.useRef(0);\n const skipDelayTimerRef = React.useRef(0);\n const [isOpenDelayed, setIsOpenDelayed] = React.useState(true);\n const [value, setValue] = useControllableState({\n prop: valueProp,\n onChange: (value) => {\n const isOpen = value !== '';\n const hasSkipDelayDuration = skipDelayDuration > 0;\n\n if (isOpen) {\n window.clearTimeout(skipDelayTimerRef.current);\n if (hasSkipDelayDuration) setIsOpenDelayed(false);\n } else {\n window.clearTimeout(skipDelayTimerRef.current);\n skipDelayTimerRef.current = window.setTimeout(\n () => setIsOpenDelayed(true),\n skipDelayDuration,\n );\n }\n\n onValueChange?.(value);\n },\n defaultProp: defaultValue ?? '',\n caller: NAVIGATION_MENU_NAME,\n });\n\n const startCloseTimer = React.useCallback(() => {\n window.clearTimeout(closeTimerRef.current);\n closeTimerRef.current = window.setTimeout(() => setValue(''), 150);\n }, [setValue]);\n\n const handleOpen = React.useCallback(\n (itemValue: string) => {\n window.clearTimeout(closeTimerRef.current);\n setValue(itemValue);\n },\n [setValue],\n );\n\n const handleDelayedOpen = React.useCallback(\n (itemValue: string) => {\n const isOpenItem = value === itemValue;\n if (isOpenItem) {\n // If the item is already open (e.g. we're transitioning from the content to the trigger)\n // then we want to clear the close timer immediately.\n window.clearTimeout(closeTimerRef.current);\n } else {\n openTimerRef.current = window.setTimeout(() => {\n window.clearTimeout(closeTimerRef.current);\n setValue(itemValue);\n }, delayDuration);\n }\n },\n [value, setValue, delayDuration],\n );\n\n React.useEffect(() => {\n return () => {\n window.clearTimeout(openTimerRef.current);\n window.clearTimeout(closeTimerRef.current);\n window.clearTimeout(skipDelayTimerRef.current);\n };\n }, []);\n\n return (\n <NavigationMenuProvider\n scope={__scopeNavigationMenu}\n isRootMenu={true}\n value={value}\n dir={direction}\n orientation={orientation}\n rootNavigationMenu={navigationMenu}\n onTriggerEnter={(itemValue) => {\n window.clearTimeout(openTimerRef.current);\n if (isOpenDelayed) handleDelayedOpen(itemValue);\n else handleOpen(itemValue);\n }}\n onTriggerLeave={() => {\n window.clearTimeout(openTimerRef.current);\n startCloseTimer();\n }}\n onContentEnter={() => window.clearTimeout(closeTimerRef.current)}\n onContentLeave={startCloseTimer}\n onItemSelect={(itemValue) => {\n setValue((prevValue) => (prevValue === itemValue ? '' : itemValue));\n }}\n onItemDismiss={() => setValue('')}\n >\n <Primitive.nav\n aria-label=\"Main\"\n data-orientation={orientation}\n dir={direction}\n {...NavigationMenuProps}\n ref={composedRef}\n />\n </NavigationMenuProvider>\n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * NavigationMenuSub\n * -----------------------------------------------------------------------------------------------*/\n\nconst SUB_NAME = 'NavigationMenuSub';\n\ntype NavigationMenuSubElement = React.ComponentRef<typeof Primitive.div>;\ntype PrimitiveDivProps = React.ComponentPropsWithoutRef<typeof Primitive.div>;\ninterface NavigationMenuSubProps\n extends\n Omit<NavigationMenuProviderProps, keyof NavigationMenuProviderPrivateProps>,\n PrimitiveDivProps {\n value?: string;\n defaultValue?: string;\n onValueChange?: (value: string) => void;\n orientation?: Orientation;\n}\n\nconst NavigationMenuSub = /* @__PURE__ */ React.forwardRef<\n NavigationMenuSubElement,\n NavigationMenuSubProps\n>(\n // blank line to reduce diff noise\n function NavigationMenuSub(props: ScopedProps<NavigationMenuSubProps>, forwardedRef) {\n const {\n __scopeNavigationMenu,\n value: valueProp,\n onValueChange,\n defaultValue,\n orientation = 'horizontal',\n ...subProps\n } = props;\n const context = useNavigationMenuContext(SUB_NAME, __scopeNavigationMenu);\n const [value, setValue] = useControllableState({\n prop: valueProp,\n onChange: onValueChange,\n defaultProp: defaultValue ?? '',\n caller: SUB_NAME,\n });\n\n return (\n <NavigationMenuProvider\n scope={__scopeNavigationMenu}\n isRootMenu={false}\n value={value}\n dir={context.dir}\n orientation={orientation}\n rootNavigationMenu={context.rootNavigationMenu}\n onTriggerEnter={(itemValue) => setValue(itemValue)}\n onItemSelect={(itemValue) => setValue(itemValue)}\n onItemDismiss={() => setValue('')}\n >\n <Primitive.div data-orientation={orientation} {...subProps} ref={forwardedRef} />\n </NavigationMenuProvider>\n );\n },\n);\n\n/* -----------------------------------------------------------------------------------------------*/\n\ninterface NavigationMenuProviderPrivateProps {\n isRootMenu: boolean;\n scope: Scope;\n children: React.ReactNode;\n orientation: Orientation;\n dir: Direction;\n rootNavigationMenu: NavigationMenuElement | null;\n value: string;\n onTriggerEnter(itemValue: string): void;\n onTriggerLeave?(): void;\n onContentEnter?(): void;\n onContentLeave?(): void;\n onItemSelect(itemValue: string): void;\n onItemDismiss(): void;\n}\n\ninterface NavigationMenuProviderProps extends NavigationMenuProviderPrivateProps {}\n\nconst NavigationMenuProvider: React.FC<NavigationMenuProviderProps> = (\n props: ScopedProps<NavigationMenuProviderProps>,\n) => {\n const {\n scope,\n isRootMenu,\n rootNavigationMenu,\n dir,\n orientation,\n children,\n value,\n onItemSelect,\n onItemDismiss,\n onTriggerEnter,\n onTriggerLeave,\n onContentEnter,\n onContentLeave,\n } = props;\n const [viewport, setViewport] = React.useState<NavigationMenuViewportElement | null>(null);\n const [viewportContent, setViewportContent] = React.useState<Map<string, ContentData>>(new Map());\n const [indicatorTrack, setIndicatorTrack] = React.useState<HTMLDivElement | null>(null);\n\n return (\n <NavigationMenuProviderImpl\n scope={scope}\n isRootMenu={isRootMenu}\n rootNavigationMenu={rootNavigationMenu}\n value={value}\n previousValue={usePrevious(value)}\n baseId={useId()}\n dir={dir}\n orientation={orientation}\n viewport={viewport}\n onViewportChange={setViewport}\n indicatorTrack={indicatorTrack}\n onIndicatorTrackChange={setIndicatorTrack}\n onTriggerEnter={useCallbackRef(onTriggerEnter)}\n onTriggerLeave={useCallbackRef(onTriggerLeave)}\n onContentEnter={useCallbackRef(onContentEnter)}\n onContentLeave={useCallbackRef(onContentLeave)}\n onItemSelect={useCallbackRef(onItemSelect)}\n onItemDismiss={useCallbackRef(onItemDismiss)}\n onViewportContentChange={React.useCallback((contentValue, contentData) => {\n setViewportContent((prevContent) => {\n prevContent.set(contentValue, contentData);\n return new Map(prevContent);\n });\n }, [])}\n onViewportContentRemove={React.useCallback((contentValue) => {\n setViewportContent((prevContent) => {\n if (!prevContent.has(contentValue)) return prevContent;\n prevContent.delete(contentValue);\n return new Map(prevContent);\n });\n }, [])}\n >\n <Collection.Provider scope={scope}>\n <ViewportContentProvider scope={scope} items={viewportContent}>\n {children}\n </ViewportContentProvider>\n </Collection.Provider>\n </NavigationMenuProviderImpl>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * NavigationMenuList\n * -----------------------------------------------------------------------------------------------*/\n\nconst LIST_NAME = 'NavigationMenuList';\n\ntype NavigationMenuListElement = React.ComponentRef<typeof Primitive.ul>;\ntype PrimitiveUnorderedListProps = React.ComponentPropsWithoutRef<typeof Primitive.ul>;\ninterface NavigationMenuListProps extends PrimitiveUnorderedListProps {}\n\nconst NavigationMenuList = /* @__PURE__ */ React.forwardRef<\n NavigationMenuListElement,\n NavigationMenuListProps\n>(\n // blank line to reduce diff noise\n function NavigationMenuList(props: ScopedProps<NavigationMenuListProps>, forwardedRef) {\n const { __scopeNavigationMenu, ...listProps } = props;\n const context = useNavigationMenuContext(LIST_NAME, __scopeNavigationMenu);\n\n const list = (\n <Primitive.ul data-orientation={context.orientation} {...listProps} ref={forwardedRef} />\n );\n\n return (\n <Primitive.div style={{ position: 'relative' }} ref={context.onIndicatorTrackChange}>\n <Collection.Slot scope={__scopeNavigationMenu}>\n {context.isRootMenu ? <FocusGroup asChild>{list}</FocusGroup> : list}\n </Collection.Slot>\n </Primitive.div>\n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * NavigationMenuItem\n * -----------------------------------------------------------------------------------------------*/\n\nconst ITEM_NAME = 'NavigationMenuItem';\n\ntype FocusProxyElement = React.ComponentRef<typeof VisuallyHiddenPrimitive.Root>;\n\ntype NavigationMenuItemContextValue = {\n value: string;\n triggerRef: React.RefObject<NavigationMenuTriggerElement | null>;\n contentRef: React.RefObject<NavigationMenuContentElement | null>;\n focusProxyRef: React.RefObject<FocusProxyElement | null>;\n wasEscapeCloseRef: React.MutableRefObject<boolean>;\n onEntryKeyDown(): void;\n onFocusProxyEnter(side: 'start' | 'end'): void;\n onRootContentClose(): void;\n onContentFocusOutside(): void;\n};\n\nconst [NavigationMenuItemContextProvider, useNavigationMenuItemContext] =\n createNavigationMenuContext<NavigationMenuItemContextValue>(ITEM_NAME);\n\ntype NavigationMenuItemElement = React.ComponentRef<typeof Primitive.li>;\ntype PrimitiveListItemProps = React.ComponentPropsWithoutRef<typeof Primitive.li>;\ninterface NavigationMenuItemProps extends PrimitiveListItemProps {\n value?: string;\n}\n\nconst NavigationMenuItem = /* @__PURE__ */ React.forwardRef<\n NavigationMenuItemElement,\n NavigationMenuItemProps\n>(\n // blank line to reduce diff noise\n function NavigationMenuItem(props: ScopedProps<NavigationMenuItemProps>, forwardedRef) {\n const { __scopeNavigationMenu, value: valueProp, ...itemProps } = props;\n const autoValue = useId();\n // We need to provide an initial deterministic value as `useId` will return\n // empty string on the first render and we don't want to match our internal \"closed\" value.\n const value = valueProp || autoValue || 'LEGACY_REACT_AUTO_VALUE';\n const contentRef = React.useRef<NavigationMenuContentElement>(null);\n const triggerRef = React.useRef<NavigationMenuTriggerElement>(null);\n const focusProxyRef = React.useRef<FocusProxyElement>(null);\n const restoreContentTabOrderRef = React.useRef(() => {});\n const wasEscapeCloseRef = React.useRef(false);\n\n const handleContentEntry = React.useCallback((side = 'start') => {\n if (contentRef.current) {\n restoreContentTabOrderRef.current();\n const candidates = getTabbableCandidates(contentRef.current);\n if (candidates.length) focusFirst(side === 'start' ? candidates : candidates.reverse());\n }\n }, []);\n\n const handleContentExit = React.useCallback(() => {\n if (contentRef.current) {\n const candidates = getTabbableCandidates(contentRef.current);\n if (candidates.length) restoreContentTabOrderRef.current = removeFromTabOrder(candidates);\n }\n }, []);\n\n return (\n <NavigationMenuItemContextProvider\n scope={__scopeNavigationMenu}\n value={value}\n triggerRef={triggerRef}\n contentRef={contentRef}\n focusProxyRef={focusProxyRef}\n wasEscapeCloseRef={wasEscapeCloseRef}\n onEntryKeyDown={handleContentEntry}\n onFocusProxyEnter={handleContentEntry}\n onRootContentClose={handleContentExit}\n onContentFocusOutside={handleContentExit}\n >\n <Primitive.li {...itemProps} ref={forwardedRef} />\n </NavigationMenuItemContextProvider>\n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * NavigationMenuTrigger\n * -----------------------------------------------------------------------------------------------*/\n\nconst TRIGGER_NAME = 'NavigationMenuTrigger';\n\ntype NavigationMenuTriggerElement = React.ComponentRef<typeof Primitive.button>;\ntype PrimitiveButtonProps = React.ComponentPropsWithoutRef<typeof Primitive.button>;\ninterface NavigationMenuTriggerProps extends PrimitiveButtonProps {}\n\nconst NavigationMenuTrigger = /* @__PURE__ */ React.forwardRef<\n NavigationMenuTriggerElement,\n NavigationMenuTriggerProps\n>(function NavigationMenuTrigger(props: ScopedProps<NavigationMenuTriggerProps>, forwardedRef) {\n const { __scopeNavigationMenu, disabled, ...triggerProps } = props;\n const context = useNavigationMenuContext(TRIGGER_NAME, props.__scopeNavigationMenu);\n const itemContext = useNavigationMenuItemContext(TRIGGER_NAME, props.__scopeNavigationMenu);\n const ref = React.useRef<NavigationMenuTriggerElement>(null);\n const composedRefs = useComposedRefs(ref, itemContext.triggerRef, forwardedRef);\n const triggerId = makeTriggerId(context.baseId, itemContext.value);\n const contentId = makeContentId(context.baseId, itemContext.value);\n const hasPointerMoveOpenedRef = React.useRef(false);\n const wasClickCloseRef = React.useRef(false);\n const open = itemContext.value === context.value;\n\n return (\n <>\n <Collection.ItemSlot scope={__scopeNavigationMenu} value={itemContext.value}>\n <FocusGroupItem asChild>\n <Primitive.button\n id={triggerId}\n disabled={disabled}\n data-disabled={disabled ? '' : undefined}\n data-state={getOpenState(open)}\n aria-expanded={open}\n aria-controls={open ? contentId : undefined}\n {...triggerProps}\n ref={composedRefs}\n onPointerEnter={composeEventHandlers(props.onPointerEnter, () => {\n wasClickCloseRef.current = false;\n itemContext.wasEscapeCloseRef.current = false;\n })}\n onPointerMove={composeEventHandlers(\n props.onPointerMove,\n whenMouse(() => {\n if (\n disabled ||\n wasClickCloseRef.current ||\n itemContext.wasEscapeCloseRef.current ||\n hasPointerMoveOpenedRef.current\n )\n return;\n context.onTriggerEnter(itemContext.value);\n hasPointerMoveOpenedRef.current = true;\n }),\n )}\n onPointerLeave={composeEventHandlers(\n props.onPointerLeave,\n whenMouse(() => {\n if (disabled) return;\n context.onTriggerLeave();\n hasPointerMoveOpenedRef.current = false;\n }),\n )}\n onClick={composeEventHandlers(props.onClick, () => {\n context.onItemSelect(itemContext.value);\n wasClickCloseRef.current = open;\n })}\n onKeyDown={composeEventHandlers(props.onKeyDown, (event) => {\n const verticalEntryKey = context.dir === 'rtl' ? 'ArrowLeft' : 'ArrowRight';\n const entryKey = { horizontal: 'ArrowDown', vertical: verticalEntryKey }[\n context.orientation\n ];\n if (open && event.key === entryKey) {\n itemContext.onEntryKeyDown();\n // Prevent FocusGroupItem from handling the event\n event.preventDefault();\n }\n })}\n />\n </FocusGroupItem>\n </Collection.ItemSlot>\n\n {/* Proxy tab order between trigger and content */}\n {open && (\n <>\n <VisuallyHiddenPrimitive.Root\n aria-hidden\n tabIndex={0}\n ref={itemContext.focusProxyRef}\n onFocus={(event) => {\n const content = itemContext.contentRef.current;\n const prevFocusedElement = event.relatedTarget as HTMLElement | null;\n const wasTriggerFocused = prevFocusedElement === ref.current;\n const wasFocusFromContent = content?.contains(prevFocusedElement);\n\n if (wasTriggerFocused || !wasFocusFromContent) {\n itemContext.onFocusProxyEnter(wasTriggerFocused ? 'start' : 'end');\n }\n }}\n />\n\n {/* Restructure a11y tree to make content accessible to screen reader when using the viewport */}\n {context.viewport && <span aria-owns={contentId} />}\n </>\n )}\n </>\n );\n});\n\n/* -------------------------------------------------------------------------------------------------\n * NavigationMenuLink\n * -----------------------------------------------------------------------------------------------*/\nconst LINK_SELECT = 'navigationMenu.linkSelect';\n\ntype NavigationMenuLinkElement = React.ComponentRef<typeof Primitive.a>;\ntype PrimitiveLinkProps = React.ComponentPropsWithoutRef<typeof Primitive.a>;\ninterface NavigationMenuLinkProps extends Omit<PrimitiveLinkProps, 'onSelect'> {\n active?: boolean;\n onSelect?: (event: Event) => void;\n}\n\nconst NavigationMenuLink = /* @__PURE__ */ React.forwardRef<\n NavigationMenuLinkElement,\n NavigationMenuLinkProps\n>(\n // blank line to reduce diff noise\n function NavigationMenuLink(props: ScopedProps<NavigationMenuLinkProps>, forwardedRef) {\n const { __scopeNavigationMenu, active, onSelect, ...linkProps } = props;\n\n return (\n <FocusGroupItem asChild>\n <Primitive.a\n data-active={active ? '' : undefined}\n aria-current={active ? 'page' : undefined}\n {...linkProps}\n ref={forwardedRef}\n onClick={composeEventHandlers(\n props.onClick,\n (event) => {\n const target = event.target as HTMLElement;\n const linkSelectEvent = new CustomEvent(LINK_SELECT, {\n bubbles: true,\n cancelable: true,\n });\n target.addEventListener(LINK_SELECT, (event) => onSelect?.(event), { once: true });\n dispatchDiscreteCustomEvent(target, linkSelectEvent);\n\n if (!linkSelectEvent.defaultPrevented && !event.metaKey) {\n const rootContentDismissEvent = new CustomEvent(ROOT_CONTENT_DISMISS, {\n bubbles: true,\n cancelable: true,\n });\n dispatchDiscreteCustomEvent(target, rootContentDismissEvent);\n }\n },\n { checkForDefaultPrevented: false },\n )}\n />\n </FocusGroupItem>\n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * NavigationMenuIndicator\n * -----------------------------------------------------------------------------------------------*/\n\nconst INDICATOR_NAME = 'NavigationMenuIndicator';\n\ntype NavigationMenuIndicatorElement = NavigationMenuIndicatorImplElement;\ninterface NavigationMenuIndicatorProps extends NavigationMenuIndicatorImplProps {\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true;\n}\n\nconst NavigationMenuIndicator = /* @__PURE__ */ React.forwardRef<\n NavigationMenuIndicatorElement,\n NavigationMenuIndicatorProps\n>(function NavigationMenuIndicator(props: ScopedProps<NavigationMenuIndicatorProps>, forwardedRef) {\n const { forceMount, ...indicatorProps } = props;\n const context = useNavigationMenuContext(INDICATOR_NAME, props.__scopeNavigationMenu);\n const isVisible = Boolean(context.value);\n\n return context.indicatorTrack\n ? ReactDOM.createPortal(\n <Presence present={forceMount || isVisible}>\n <NavigationMenuIndicatorImpl {...indicatorProps} ref={forwardedRef} />\n </Presence>,\n context.indicatorTrack,\n )\n : null;\n});\n\ntype NavigationMenuIndicatorImplElement = React.ComponentRef<typeof Primitive.div>;\ninterface NavigationMenuIndicatorImplProps extends PrimitiveDivProps {}\n\nconst NavigationMenuIndicatorImpl = /* @__PURE__ */ React.forwardRef<\n NavigationMenuIndicatorImplElement,\n NavigationMenuIndicatorImplProps\n>(function NavigationMenuIndicatorImpl(\n props: ScopedProps<NavigationMenuIndicatorImplProps>,\n forwardedRef,\n) {\n const { __scopeNavigationMenu, ...indicatorProps } = props;\n const context = useNavigationMenuContext(INDICATOR_NAME, __scopeNavigationMenu);\n const getItems = useCollection(__scopeNavigationMenu);\n const [activeTrigger, setActiveTrigger] = React.useState<NavigationMenuTriggerElement | null>(\n null,\n );\n const [position, setPosition] = React.useState<{ size: number; offset: number } | null>(null);\n const isHorizontal = context.orientation === 'horizontal';\n const isVisible = Boolean(context.value);\n\n React.useEffect(() => {\n const items = getItems();\n const triggerNode = items.find((item) => item.value === context.value)?.ref.current;\n if (triggerNode) setActiveTrigger(triggerNode);\n }, [getItems, context.value]);\n\n /**\n * Update position when the indicator or parent track size changes\n */\n const handlePositionChange = () => {\n if (activeTrigger) {\n setPosition({\n size: isHorizontal ? activeTrigger.offsetWidth : activeTrigger.offsetHeight,\n offset: isHorizontal ? activeTrigger.offsetLeft : activeTrigger.offsetTop,\n });\n }\n };\n useResizeObserver(activeTrigger, handlePositionChange);\n useResizeObserver(context.indicatorTrack, handlePositionChange);\n\n // We need to wait for the indicator position to be available before rendering to\n // snap immediately into position rather than transitioning from initial\n return position ? (\n <Primitive.div\n aria-hidden\n data-state={isVisible ? 'visible' : 'hidden'}\n data-orientation={context.orientation}\n {...indicatorProps}\n ref={forwardedRef}\n style={{\n position: 'absolute',\n ...(isHorizontal\n ? {\n left: 0,\n width: position.size + 'px',\n transform: `translateX(${position.offset}px)`,\n '--radix-navigation-menu-indicator-translate-x': `${position.offset}px`,\n }\n : {\n top: 0,\n height: position.size + 'px',\n transform: `translateY(${position.offset}px)`,\n '--radix-navigation-menu-indicator-translate-y': `${position.offset}px`,\n }),\n ...indicatorProps.style,\n }}\n />\n ) : null;\n});\n\n/* -------------------------------------------------------------------------------------------------\n * NavigationMenuContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'NavigationMenuContent';\n\ntype NavigationMenuContentElement = NavigationMenuContentImplElement;\ninterface NavigationMenuContentProps extends Omit<\n NavigationMenuContentImplProps,\n keyof NavigationMenuContentImplPrivateProps\n> {\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true;\n}\n\nconst NavigationMenuContent = /* @__PURE__ */ React.forwardRef<\n NavigationMenuContentElement,\n NavigationMenuContentProps\n>(function NavigationMenuContent(props: ScopedProps<NavigationMenuContentProps>, forwardedRef) {\n const { forceMount, ...contentProps } = props;\n const context = useNavigationMenuContext(CONTENT_NAME, props.__scopeNavigationMenu);\n const itemContext = useNavigationMenuItemContext(CONTENT_NAME, props.__scopeNavigationMenu);\n const composedRefs = useComposedRefs(itemContext.contentRef, forwardedRef);\n const open = itemContext.value === context.value;\n\n const commonProps = {\n value: itemContext.value,\n triggerRef: itemContext.triggerRef,\n focusProxyRef: itemContext.focusProxyRef,\n wasEscapeCloseRef: itemContext.wasEscapeCloseRef,\n onContentFocusOutside: itemContext.onContentFocusOutside,\n onRootContentClose: itemContext.onRootContentClose,\n ...contentProps,\n };\n\n return !context.viewport ? (\n <Presence present={forceMount || open}>\n <NavigationMenuContentImpl\n data-state={getOpenState(open)}\n {...commonProps}\n ref={composedRefs}\n onPointerEnter={composeEventHandlers(props.onPointerEnter, context.onContentEnter)}\n onPointerLeave={composeEventHandlers(\n props.onPointerLeave,\n whenMouse(context.onContentLeave),\n )}\n style={{\n // Prevent interaction when animating out\n pointerEvents: !open && context.isRootMenu ? 'none' : undefined,\n ...commonProps.style,\n }}\n />\n </Presence>\n ) : (\n <ViewportContentMounter forceMount={forceMount} {...commonProps} ref={composedRefs} />\n );\n});\n\n/* -----------------------------------------------------------------------------------------------*/\n\ntype ViewportContentMounterElement = NavigationMenuContentImplElement;\ninterface ViewportContentMounterProps extends NavigationMenuContentImplProps {\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true;\n}\n\nconst ViewportContentMounter = /* @__PURE__ */ React.forwardRef<\n ViewportContentMounterElement,\n ViewportContentMounterProps\n>(function ViewportContentMounter(props: ScopedProps<ViewportContentMounterProps>, forwardedRef) {\n const context = useNavigationMenuContext(CONTENT_NAME, props.__scopeNavigationMenu);\n const { onViewportContentChange, onViewportContentRemove } = context;\n\n useLayoutEffect(() => {\n onViewportContentChange(props.value, {\n ref: forwardedRef,\n ...props,\n });\n }, [props, forwardedRef, onViewportContentChange]);\n\n useLayoutEffect(() => {\n return () => onViewportContentRemove(props.value);\n }, [props.value, onViewportContentRemove]);\n\n // Content is proxied into the viewport\n return null;\n});\n\n/* -----------------------------------------------------------------------------------------------*/\n\nconst ROOT_CONTENT_DISMISS = 'navigationMenu.rootContentDismiss';\n\ntype MotionAttribute = 'to-start' | 'to-end' | 'from-start' | 'from-end';\ntype NavigationMenuContentImplElement = React.ComponentRef<typeof DismissableLayer>;\ntype DismissableLayerProps = React.ComponentPropsWithoutRef<typeof DismissableLayer>;\n\ninterface NavigationMenuContentImplPrivateProps {\n value: string;\n triggerRef: React.RefObject<NavigationMenuTriggerElement | null>;\n focusProxyRef: React.RefObject<FocusProxyElement | null>;\n wasEscapeCloseRef: React.MutableRefObject<boolean>;\n onContentFocusOutside(): void;\n onRootContentClose(): void;\n}\ninterface NavigationMenuContentImplProps\n extends\n Omit<DismissableLayerProps, 'onDismiss' | 'disableOutsidePointerEvents'>,\n NavigationMenuContentImplPrivateProps {}\n\nconst NavigationMenuContentImpl = /* @__PURE__ */ React.forwardRef<\n NavigationMenuContentImplElement,\n NavigationMenuContentImplProps\n>(function NavigationMenuContentImpl(\n props: ScopedProps<NavigationMenuContentImplProps>,\n forwardedRef,\n) {\n const {\n __scopeNavigationMenu,\n value,\n triggerRef,\n focusProxyRef,\n wasEscapeCloseRef,\n onRootContentClose,\n onContentFocusOutside,\n ...contentProps\n } = props;\n const context = useNavigationMenuContext(CONTENT_NAME, __scopeNavigationMenu);\n const ref = React.useRef<NavigationMenuContentImplElement>(null);\n const composedRefs = useComposedRefs(ref, forwardedRef);\n const triggerId = makeTriggerId(context.baseId, value);\n const contentId = makeContentId(context.baseId, value);\n const getItems = useCollection(__scopeNavigationMenu);\n const prevMotionAttributeRef = React.useRef<MotionAttribute | null>(null);\n\n const { onItemDismiss } = context;\n\n React.useEffect(() => {\n const content = ref.current;\n\n // Bubble dismiss to the root content node and focus its trigger\n if (context.isRootMenu && content) {\n const handleClose = () => {\n onItemDismiss();\n onRootContentClose();\n if (content.contains(document.activeElement)) triggerRef.current?.focus();\n };\n content.addEventListener(ROOT_CONTENT_DISMISS, handleClose);\n return () => content.removeEventListener(ROOT_CONTENT_DISMISS, handleClose);\n }\n }, [context.isRootMenu, props.value, triggerRef, onItemDismiss, onRootContentClose]);\n\n const motionAttribute = React.useMemo(() => {\n const items = getItems();\n const values = items.map((item) => item.value);\n if (context.dir === 'rtl') values.reverse();\n const index = values.indexOf(context.value);\n const prevIndex = values.indexOf(context.previousValue);\n const isSelected = value === context.value;\n const wasSelected = prevIndex === values.indexOf(value);\n\n // We only want to update selected and the last selected content\n // this avoids animations being interrupted outside of that range\n if (!isSelected && !wasSelected) return prevMotionAttributeRef.current;\n\n const attribute = (() => {\n // Don't provide a direction on the initial open\n if (index !== prevIndex) {\n // If we're moving to this item from another\n if (isSelected && prevIndex !== -1) return index > prevIndex ? 'from-end' : 'from-start';\n // If we're leaving this item for another\n if (wasSelected && index !== -1) return index > prevIndex ? 'to-start' : 'to-end';\n }\n // Otherwise we're entering from closed or leaving the list\n // entirely and should not animate in any direction\n return null;\n })();\n\n prevMotionAttributeRef.current = attribute;\n return attribute;\n }, [context.previousValue, context.value, context.dir, getItems, value]);\n\n return (\n <FocusGroup asChild>\n <DismissableLayer\n id={contentId}\n aria-labelledby={triggerId}\n data-motion={motionAttribute}\n data-orientation={context.orientation}\n {...contentProps}\n ref={composedRefs}\n disableOutsidePointerEvents={false}\n onDismiss={() => {\n const rootContentDismissEvent = new Event(ROOT_CONTENT_DISMISS, {\n bubbles: true,\n cancelable: true,\n });\n ref.current?.dispatchEvent(rootContentDismissEvent);\n }}\n onFocusOutside={composeEventHandlers(props.onFocusOutside, (event) => {\n onContentFocusOutside();\n const target = event.target as HTMLElement;\n // Only dismiss content when focus moves outside of the menu\n if (context.rootNavigationMenu?.contains(target)) event.preventDefault();\n })}\n onPointerDownOutside={composeEventHandlers(props.onPointerDownOutside, (event) => {\n const target = event.target as HTMLElement;\n const isTrigger = getItems().some((item) => item.ref.current?.contains(target));\n const isRootViewport = context.isRootMenu && context.viewport?.contains(target);\n if (isTrigger || isRootViewport || !context.isRootMenu) event.preventDefault();\n })}\n onKeyDown={composeEventHandlers(props.onKeyDown, (event) => {\n const isMetaKey = event.altKey || event.ctrlKey || event.metaKey;\n const isTabKey = event.key === 'Tab' && !isMetaKey;\n if (isTabKey) {\n const candidates = getTabbableCandidates(event.currentTarget);\n const focusedElement = document.activeElement;\n const index = candidates.findIndex((candidate) => candidate === focusedElement);\n const isMovingBackwards = event.shiftKey;\n const nextCandidates = isMovingBackwards\n ? candidates.slice(0, index).reverse()\n : candidates.slice(index + 1, candidates.length);\n\n if (focusFirst(nextCandidates)) {\n // prevent browser tab keydown because we've handled focus\n event.preventDefault();\n } else {\n // If we can't focus that means we're at the edges\n // so focus the proxy and let browser handle\n // tab/shift+tab keypress on the proxy instead\n focusProxyRef.current?.focus();\n }\n }\n })}\n onEscapeKeyDown={composeEventHandlers(props.onEscapeKeyDown, (_event) => {\n // prevent the dropdown from reopening\n // after the escape key has been pressed\n wasEscapeCloseRef.current = true;\n })}\n />\n </FocusGroup>\n );\n});\n\n/* -------------------------------------------------------------------------------------------------\n * NavigationMenuViewport\n * -----------------------------------------------------------------------------------------------*/\n\nconst VIEWPORT_NAME = 'NavigationMenuViewport';\n\ntype NavigationMenuViewportElement = NavigationMenuViewportImplElement;\ninterface NavigationMenuViewportProps extends Omit<\n NavigationMenuViewportImplProps,\n 'activeContentValue'\n> {\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true;\n}\n\nconst NavigationMenuViewport = /* @__PURE__ */ React.forwardRef<\n NavigationMenuViewportElement,\n NavigationMenuViewportProps\n>(function NavigationMenuViewport(props: ScopedProps<NavigationMenuViewportProps>, forwardedRef) {\n const { forceMount, ...viewportProps } = props;\n const context = useNavigationMenuContext(VIEWPORT_NAME, props.__scopeNavigationMenu);\n const open = Boolean(context.value);\n\n return (\n <Presence present={forceMount || open}>\n <NavigationMenuViewportImpl {...viewportProps} ref={forwardedRef} />\n </Presence>\n );\n});\n\n/* -----------------------------------------------------------------------------------------------*/\n\ntype NavigationMenuViewportImplElement = React.ComponentRef<typeof Primitive.div>;\ninterface NavigationMenuViewportImplProps extends PrimitiveDivProps {}\n\nconst NavigationMenuViewportImpl = /* @__PURE__ */ React.forwardRef<\n NavigationMenuViewportImplElement,\n NavigationMenuViewportImplProps\n>(function NavigationMenuViewportImpl(\n props: ScopedProps<NavigationMenuViewportImplProps>,\n forwardedRef,\n) {\n const { __scopeNavigationMenu, children, ...viewportImplProps } = props;\n const context = useNavigationMenuContext(VIEWPORT_NAME, __scopeNavigationMenu);\n const composedRefs = useComposedRefs(forwardedRef, context.onViewportChange);\n const viewportContentContext = useViewportContentContext(\n CONTENT_NAME,\n props.__scopeNavigationMenu,\n );\n const [size, setSize] = React.useState<{ width: number; height: number } | null>(null);\n const [content, setContent] = React.useState<NavigationMenuContentElement | null>(null);\n const viewportWidth = size ? size?.width + 'px' : undefined;\n const viewportHeight = size ? size?.height + 'px' : undefined;\n const open = Boolean(context.value);\n // We persist the last active content value as the viewport may be animating out\n // and we want the content to remain mounted for the lifecycle of the viewport.\n const activeContentValue = open ? context.value : context.previousValue;\n\n /**\n * Update viewport size to match the active content node.\n * We prefer offset dimensions over `getBoundingClientRect` as the latter respects CSS transform.\n * For example, if content animates in from `scale(0.5)` the dimensions would be anything\n * from `0.5` to `1` of the intended size.\n */\n const handleSizeChange = () => {\n if (content) setSize({ width: content.offsetWidth, height: content.offsetHeight });\n };\n useResizeObserver(content, handleSizeChange);\n\n return (\n <Primitive.div\n data-state={getOpenState(open)}\n data-orientation={context.orientation}\n {...viewportImplProps}\n ref={composedRefs}\n style={{\n // Prevent interaction when animating out\n pointerEvents: !open && context.isRootMenu ? 'none' : undefined,\n '--radix-navigation-menu-viewport-width': viewportWidth,\n '--radix-navigation-menu-viewport-height': viewportHeight,\n ...viewportImplProps.style,\n }}\n onPointerEnter={composeEventHandlers(props.onPointerEnter, context.onContentEnter)}\n onPointerLeave={composeEventHandlers(props.onPointerLeave, whenMouse(context.onContentLeave))}\n >\n {Array.from(viewportContentContext.items).map(([value, { ref, forceMount, ...props }]) => {\n const isActive = activeContentValue === value;\n return (\n <Presence key={value} present={forceMount || isActive}>\n <NavigationMenuViewportItem\n {...props}\n contentRef={ref}\n isActive={isActive}\n onActiveContentChange={setContent}\n />\n </Presence>\n );\n })}\n </Primitive.div>\n );\n});\n\n/* -----------------------------------------------------------------------------------------------*/\n\ninterface NavigationMenuViewportItemProps extends NavigationMenuContentImplProps {\n contentRef?: React.Ref<ViewportContentMounterElement>;\n isActive: boolean;\n onActiveContentChange: (node: NavigationMenuContentElement | null) => void;\n}\n\nconst NavigationMenuViewportItem = ({\n contentRef,\n isActive,\n onActiveContentChange,\n ...props\n}: ScopedProps<NavigationMenuViewportItemProps>) => {\n const handleContentChange = React.useCallback(\n (node: NavigationMenuContentElement | null) => {\n // We only want to update the stored node when another is available\n // as we need to smoothly transition between them.\n if (isActive && node) {\n onActiveContentChange(node);\n }\n },\n [isActive, onActiveContentChange],\n );\n const composedRefs = useComposedRefs(contentRef, handleContentChange);\n return <NavigationMenuContentImpl {...props} ref={composedRefs} />;\n};\n\n/* -----------------------------------------------------------------------------------------------*/\n\nconst FOCUS_GROUP_NAME = 'FocusGroup';\n\ntype FocusGroupElement = React.ComponentRef<typeof Primitive.div>;\ninterface FocusGroupProps extends PrimitiveDivProps {}\n\nconst FocusGroup = /* @__PURE__ */ React.forwardRef<FocusGroupElement, FocusGroupProps>(\n function FocusGroup(props: ScopedProps<FocusGroupProps>, forwardedRef) {\n const { __scopeNavigationMenu, ...groupProps } = props;\n const context = useNavigationMenuContext(FOCUS_GROUP_NAME, __scopeNavigationMenu);\n\n return (\n <FocusGroupCollection.Provider scope={__scopeNavigationMenu}>\n <FocusGroupCollection.Slot scope={__scopeNavigationMenu}>\n <Primitive.div dir={context.dir} {...groupProps} ref={forwardedRef} />\n </FocusGroupCollection.Slot>\n </FocusGroupCollection.Provider>\n );\n },\n);\n\n/* -----------------------------------------------------------------------------------------------*/\n\nconst ARROW_KEYS = ['ArrowRight', 'ArrowLeft', 'ArrowUp', 'ArrowDown'];\nconst FOCUS_GROUP_ITEM_NAME = 'FocusGroupItem';\n\ntype FocusGroupItemElement = React.ComponentRef<typeof Primitive.button>;\ninterface FocusGroupItemProps extends PrimitiveButtonProps {}\n\nconst FocusGroupItem = /* @__PURE__ */ React.forwardRef<FocusGroupItemElement, FocusGroupItemProps>(\n function FocusGroupItem(props: ScopedProps<FocusGroupItemProps>, forwardedRef) {\n const { __scopeNavigationMenu, ...groupProps } = props;\n const getItems = useFocusGroupCollection(__scopeNavigationMenu);\n const context = useNavigationMenuContext(FOCUS_GROUP_ITEM_NAME, __scopeNavigationMenu);\n\n return (\n <FocusGroupCollection.ItemSlot scope={__scopeNavigationMenu}>\n <Primitive.button\n {...groupProps}\n ref={forwardedRef}\n onKeyDown={composeEventHandlers(props.onKeyDown, (event) => {\n const isFocusNavigationKey = ['Home', 'End', ...ARROW_KEYS].includes(event.key);\n if (isFocusNavigationKey) {\n let candidateNodes = getItems().map((item) => item.ref.current!);\n const prevItemKey = context.dir === 'rtl' ? 'ArrowRight' : 'ArrowLeft';\n const prevKeys = [prevItemKey, 'ArrowUp', 'End'];\n if (prevKeys.includes(event.key)) candidateNodes.reverse();\n if (ARROW_KEYS.includes(event.key)) {\n const currentIndex = candidateNodes.indexOf(event.currentTarget);\n candidateNodes = candidateNodes.slice(currentIndex + 1);\n }\n /**\n * Imperative focus during keydown is risky so we prevent React's batching updates\n * to avoid potential bugs. See: https://github.com/facebook/react/issues/20332\n */\n setTimeout(() => focusFirst(candidateNodes));\n\n // Prevent page scroll while navigating\n event.preventDefault();\n }\n })}\n />\n </FocusGroupCollection.ItemSlot>\n );\n },\n);\n\n/**\n * Returns a list of potential tabbable candidates.\n *\n * NOTE: This is only a close approximation. For example it doesn't take into account cases like when\n * elements are not visible. This cannot be worked out easily by just reading a property, but rather\n * necessitate runtime knowledge (computed styles, etc). We deal with these cases separately.\n *\n * See: https://developer.mozilla.org/en-US/docs/Web/API/TreeWalker\n * Credit: https://github.com/discord/focus-layers/blob/master/src/util/wrapFocus.tsx#L1\n */\nfunction getTabbableCandidates(container: HTMLElement) {\n const nodes: HTMLElement[] = [];\n const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {\n acceptNode: (node: any) => {\n const isHiddenInput = node.tagName === 'INPUT' && node.type === 'hidden';\n if (node.disabled || node.hidden || isHiddenInput) return NodeFilter.FILTER_SKIP;\n // `.tabIndex` is not the same as the `tabindex` attribute. It works on the\n // runtime's understanding of tabbability, so this automatically accounts\n // for any kind of element that could be tabbed to.\n return node.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;\n },\n });\n while (walker.nextNode()) nodes.push(walker.currentNode as HTMLElement);\n // we do not take into account the order of nodes with positive `tabIndex` as it\n // hinders accessibility to have tab order different from visual order.\n return nodes;\n}\n\nfunction focusFirst(candidates: HTMLElement[]) {\n const previouslyFocusedElement = document.activeElement;\n return candidates.some((candidate) => {\n // if focus is already where we want to go, we don't want to keep going through the candidates\n if (candidate === previouslyFocusedElement) return true;\n candidate.focus();\n return document.activeElement !== previouslyFocusedElement;\n });\n}\n\nfunction removeFromTabOrder(candidates: HTMLElement[]) {\n candidates.forEach((candidate) => {\n candidate.dataset.tabindex = candidate.getAttribute('tabindex') || '';\n candidate.setAttribute('tabindex', '-1');\n });\n return () => {\n candidates.forEach((candidate) => {\n const prevTabIndex = candidate.dataset.tabindex as string;\n candidate.setAttribute('tabindex', prevTabIndex);\n });\n };\n}\n\nfunction useResizeObserver(element: HTMLElement | null, onResize: () => void) {\n const handleResize = useCallbackRef(onResize);\n useLayoutEffect(() => {\n let rAF = 0;\n if (element) {\n /**\n * Resize Observer will throw an often benign error that says `ResizeObserver loop\n * completed with undelivered notifications`. This means that ResizeObserver was not\n * able to deliver all observations within a single animation frame, so we use\n * `requestAnimationFrame` to ensure we don't deliver unnecessary observations.\n * Further reading: https://github.com/WICG/resize-observer/issues/38\n */\n const resizeObserver = new ResizeObserver(() => {\n cancelAnimationFrame(rAF);\n rAF = window.requestAnimationFrame(handleResize);\n });\n resizeObserver.observe(element);\n return () => {\n window.cancelAnimationFrame(rAF);\n resizeObserver.unobserve(element);\n };\n }\n }, [element, handleResize]);\n}\n\nfunction getOpenState(open: boolean) {\n return open ? 'open' : 'closed';\n}\n\nfunction makeTriggerId(baseId: string, value: string) {\n return `${baseId}-trigger-${value}`;\n}\n\nfunction makeContentId(baseId: string, value: string) {\n return `${baseId}-content-${value}`;\n}\n\nfunction whenMouse<E>(handler: React.PointerEventHandler<E>): React.PointerEventHandler<E> {\n return (event) => (event.pointerType === 'mouse' ? handler(event) : undefined);\n}\n\n/* -----------------------------------------------------------------------------------------------*/\n\nconst Root = NavigationMenu;\nconst Sub = NavigationMenuSub;\nconst List = NavigationMenuList;\nconst Item = NavigationMenuItem;\nconst Trigger = NavigationMenuTrigger;\nconst Link = NavigationMenuLink;\nconst Indicator = NavigationMenuIndicator;\nconst Content = NavigationMenuContent;\nconst Viewport = NavigationMenuViewport;\n\nexport {\n createNavigationMenuScope,\n //\n NavigationMenu,\n NavigationMenuSub,\n NavigationMenuList,\n NavigationMenuItem,\n NavigationMenuTrigger,\n NavigationMenuLink,\n NavigationMenuIndicator,\n NavigationMenuContent,\n NavigationMenuViewport,\n //\n Root,\n Sub,\n List,\n Item,\n Trigger,\n Link,\n Indicator,\n Content,\n Viewport,\n};\nexport type {\n NavigationMenuProps,\n NavigationMenuSubProps,\n NavigationMenuListProps,\n NavigationMenuItemProps,\n NavigationMenuTriggerProps,\n NavigationMenuLinkProps,\n NavigationM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AAU,aAAa,YAAY,IAAI;AAAA,EACzC,CAAC;AACD,SAAO,MAAM;AACX,eAAW,QAAQ,CAAC,cAAc;AAChC,YAAM,eAAe,UAAU,QAAQ;AACvC,gBAAU,aAAa,YAAY,YAAY;AAAA,IACjD,CAAC;AAAA,EACH;AACF;AAXS;AAaT,SAAS,kBAAkB,SAA6B,UAAsB;AAC5E,QAAM,mBAAe,8CAAe,QAAQ;AAC5C,sDAAgB,MAAM;AACpB,QAAI,MAAM;AACV,QAAI,SAAS;AAQX,YAAM,iBAAiB,IAAI,eAAe,MAAM;AAC9C,6BAAqB,GAAG;AACxB,cAAM,OAAO,sBAAsB,YAAY;AAAA,MACjD,CAAC;AACD,qBAAe,QAAQ,OAAO;AAC9B,aAAO,MAAM;AACX,eAAO,qBAAqB,GAAG;AAC/B,uBAAe,UAAU,OAAO;AAAA,MAClC;AAAA,IACF;AAAA,EACF,GAAG,CAAC,SAAS,YAAY,CAAC;AAC5B;AAvBS;AAyBT,SAAS,aAAa,MAAe;AACnC,SAAO,OAAO,SAAS;AACzB;AAFS;AAIT,SAAS,cAAc,QAAgB,OAAe;AACpD,SAAO,GAAG,MAAM,YAAY,KAAK;AACnC;AAFS;AAIT,SAAS,cAAc,QAAgB,OAAe;AACpD,SAAO,GAAG,MAAM,YAAY,KAAK;AACnC;AAFS;AAIT,SAAS,UAAa,SAAqE;AACzF,SAAO,CAAC,UAAW,MAAM,gBAAgB,UAAU,QAAQ,KAAK,IAAI;AACtE;AAFS;AAMT,IAAMC,QAAO;AACb,IAAM,MAAM;AACZ,IAAM,OAAO;AACb,IAAM,OAAO;AACb,IAAM,UAAU;AAChB,IAAM,OAAO;AACb,IAAM,YAAY;AAClB,IAAM,UAAU;AAChB,IAAM,WAAW;",
6
- "names": ["Root", "NavigationMenu", "value", "NavigationMenuSub", "NavigationMenuList", "NavigationMenuItem", "NavigationMenuTrigger", "NavigationMenuLink", "event", "NavigationMenuIndicator", "NavigationMenuIndicatorImpl", "NavigationMenuContent", "ViewportContentMounter", "NavigationMenuContentImpl", "NavigationMenuViewport", "NavigationMenuViewportImpl", "props", "FocusGroup", "FocusGroupItem", "Root"]
4
+ "sourcesContent": ["'use client';\nexport {\n createNavigationMenuScope,\n //\n NavigationMenu,\n NavigationMenuSub,\n NavigationMenuList,\n NavigationMenuItem,\n NavigationMenuTrigger,\n NavigationMenuLink,\n NavigationMenuIndicator,\n NavigationMenuContent,\n NavigationMenuViewport,\n //\n Root,\n Sub,\n List,\n Item,\n Trigger,\n Link,\n Indicator,\n Content,\n Viewport,\n} from './navigation-menu';\nexport type {\n NavigationMenuProps,\n NavigationMenuSubProps,\n NavigationMenuListProps,\n NavigationMenuItemProps,\n NavigationMenuTriggerProps,\n NavigationMenuLinkProps,\n NavigationMenuIndicatorProps,\n NavigationMenuContentProps,\n NavigationMenuViewportProps,\n} from './navigation-menu';\n", "import * as React from 'react';\nimport * as ReactDOM from 'react-dom';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { Primitive, dispatchDiscreteCustomEvent } from '@radix-ui/react-primitive';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { useDirection } from '@radix-ui/react-direction';\nimport { Presence } from '@radix-ui/react-presence';\nimport { useId } from '@radix-ui/react-id';\nimport { createCollection } from '@radix-ui/react-collection';\nimport { DismissableLayer } from '@radix-ui/react-dismissable-layer';\nimport { usePrevious } from '@radix-ui/react-use-previous';\nimport { useLayoutEffect } from '@radix-ui/react-use-layout-effect';\nimport { useCallbackRef } from '@radix-ui/react-use-callback-ref';\nimport * as VisuallyHiddenPrimitive from '@radix-ui/react-visually-hidden';\n\nimport type { Scope } from '@radix-ui/react-context';\n\nconst ActivationMode = {\n Automatic: 'automatic',\n Manual: 'manual',\n} as const;\n\nconst Orientation = {\n Vertical: 'vertical',\n Horizontal: 'horizontal',\n} as const;\n\nconst Direction = {\n LTR: 'ltr',\n RTL: 'rtl',\n} as const;\n\ntype Orientation = (typeof Orientation)[keyof typeof Orientation];\ntype Direction = (typeof Direction)[keyof typeof Direction];\ntype ActivationMode = (typeof ActivationMode)[keyof typeof ActivationMode];\n\n/* -------------------------------------------------------------------------------------------------\n * NavigationMenu\n * -----------------------------------------------------------------------------------------------*/\n\nconst NAVIGATION_MENU_NAME = 'NavigationMenu';\n\nconst [Collection, useCollection, createCollectionScope] = createCollection<\n NavigationMenuTriggerElement,\n { value: string }\n>(NAVIGATION_MENU_NAME);\n\nconst [FocusGroupCollection, useFocusGroupCollection, createFocusGroupCollectionScope] =\n createCollection<FocusGroupItemElement, {}>(NAVIGATION_MENU_NAME);\n\ntype ScopedProps<P> = P & { __scopeNavigationMenu?: Scope };\nconst [createNavigationMenuContext, createNavigationMenuScope] = createContextScope(\n NAVIGATION_MENU_NAME,\n [createCollectionScope, createFocusGroupCollectionScope],\n);\n\ntype ContentData = {\n ref?: React.Ref<ViewportContentMounterElement>;\n} & ViewportContentMounterProps;\n\ninterface NavigationMenuContextValue {\n isRootMenu: boolean;\n value: string;\n previousValue: string;\n baseId: string;\n dir: Direction;\n orientation: Orientation;\n activationMode: ActivationMode;\n rootNavigationMenu: NavigationMenuElement | null;\n indicatorTrack: HTMLDivElement | null;\n onIndicatorTrackChange(indicatorTrack: HTMLDivElement | null): void;\n viewport: NavigationMenuViewportElement | null;\n onViewportChange(viewport: NavigationMenuViewportElement | null): void;\n onViewportContentChange(contentValue: string, contentData: ContentData): void;\n onViewportContentRemove(contentValue: string): void;\n onTriggerEnter(itemValue: string): void;\n onTriggerLeave(): void;\n onContentEnter(): void;\n onContentLeave(): void;\n onItemSelect(itemValue: string): void;\n onItemDismiss(): void;\n}\n\nconst [NavigationMenuProviderImpl, useNavigationMenuContext] =\n createNavigationMenuContext<NavigationMenuContextValue>(NAVIGATION_MENU_NAME);\n\nconst [ViewportContentProvider, useViewportContentContext] = createNavigationMenuContext<{\n items: Map<string, ContentData>;\n}>(NAVIGATION_MENU_NAME);\n\ntype NavigationMenuElement = React.ComponentRef<typeof Primitive.nav>;\ntype PrimitiveNavProps = React.ComponentPropsWithoutRef<typeof Primitive.nav>;\ninterface NavigationMenuProps\n extends\n Omit<NavigationMenuProviderProps, keyof NavigationMenuProviderPrivateProps>,\n PrimitiveNavProps {\n value?: string;\n defaultValue?: string;\n onValueChange?: (value: string) => void;\n dir?: Direction;\n orientation?: Orientation;\n /**\n * The duration from when the pointer enters the trigger until the tooltip\n * gets opened. When `activationMode` is `manual`, this prop is ignored.\n *\n * @default 200\n */\n delayDuration?: number;\n /**\n * How much time a user has to enter another trigger without incurring a delay\n * again. When `activationMode` is `manual`, this prop is ignored.\n *\n * @default 300\n */\n skipDelayDuration?: number;\n /**\n * Whether an item is activated automatically or manually.\n * - `\"automatic\"`: hovering or focusing a trigger opens its item, and moving\n * away closes it after a short delay.\n * - `\"manual\"`: clicking a trigger toggles the item; hover and focus are ignored\n *\n * @default \"automatic\"\n */\n activationMode?: ActivationMode;\n}\n\nconst NavigationMenu = /* @__PURE__ */ React.forwardRef<NavigationMenuElement, NavigationMenuProps>(\n function NavigationMenu(props: ScopedProps<NavigationMenuProps>, forwardedRef) {\n const {\n __scopeNavigationMenu,\n value: valueProp,\n onValueChange,\n defaultValue,\n delayDuration = 200,\n skipDelayDuration = 300,\n orientation = Orientation.Horizontal,\n dir,\n activationMode = ActivationMode.Automatic,\n ...NavigationMenuProps\n } = props;\n const [navigationMenu, setNavigationMenu] = React.useState<NavigationMenuElement | null>(null);\n const composedRef = useComposedRefs(forwardedRef, setNavigationMenu);\n const direction = useDirection(dir);\n const openTimerRef = React.useRef(0);\n const closeTimerRef = React.useRef(0);\n const skipDelayTimerRef = React.useRef(0);\n const [isOpenDelayed, setIsOpenDelayed] = React.useState(true);\n const [value, setValue] = useControllableState({\n prop: valueProp,\n onChange: (value) => {\n const isOpen = value !== '';\n const hasSkipDelayDuration = skipDelayDuration > 0;\n\n if (isOpen) {\n window.clearTimeout(skipDelayTimerRef.current);\n if (hasSkipDelayDuration) setIsOpenDelayed(false);\n } else {\n window.clearTimeout(skipDelayTimerRef.current);\n skipDelayTimerRef.current = window.setTimeout(\n () => setIsOpenDelayed(true),\n skipDelayDuration,\n );\n }\n\n onValueChange?.(value);\n },\n defaultProp: defaultValue ?? '',\n caller: NAVIGATION_MENU_NAME,\n });\n\n const startCloseTimer = React.useCallback(() => {\n window.clearTimeout(closeTimerRef.current);\n closeTimerRef.current = window.setTimeout(() => setValue(''), 150);\n }, [setValue]);\n\n const handleOpen = React.useCallback(\n (itemValue: string) => {\n window.clearTimeout(closeTimerRef.current);\n setValue(itemValue);\n },\n [setValue],\n );\n\n const handleDelayedOpen = React.useCallback(\n (itemValue: string) => {\n const isOpenItem = value === itemValue;\n if (isOpenItem) {\n // If the item is already open (e.g. we're transitioning from the content to the trigger)\n // then we want to clear the close timer immediately.\n window.clearTimeout(closeTimerRef.current);\n } else {\n openTimerRef.current = window.setTimeout(() => {\n window.clearTimeout(closeTimerRef.current);\n setValue(itemValue);\n }, delayDuration);\n }\n },\n [value, setValue, delayDuration],\n );\n\n React.useEffect(() => {\n return () => {\n window.clearTimeout(openTimerRef.current);\n window.clearTimeout(closeTimerRef.current);\n window.clearTimeout(skipDelayTimerRef.current);\n };\n }, []);\n\n return (\n <NavigationMenuProvider\n scope={__scopeNavigationMenu}\n isRootMenu={true}\n value={value}\n dir={direction}\n orientation={orientation}\n activationMode={activationMode}\n rootNavigationMenu={navigationMenu}\n onTriggerEnter={(itemValue) => {\n if (activationMode === ActivationMode.Automatic) {\n window.clearTimeout(openTimerRef.current);\n if (isOpenDelayed) {\n handleDelayedOpen(itemValue);\n } else {\n handleOpen(itemValue);\n }\n }\n }}\n onTriggerLeave={() => {\n if (activationMode === ActivationMode.Automatic) {\n window.clearTimeout(openTimerRef.current);\n startCloseTimer();\n }\n }}\n onContentEnter={() => {\n if (activationMode === ActivationMode.Automatic) {\n window.clearTimeout(closeTimerRef.current);\n }\n }}\n onContentLeave={() => {\n if (activationMode === ActivationMode.Automatic) {\n startCloseTimer();\n }\n }}\n onItemSelect={(itemValue) => {\n setValue((prevValue) => (prevValue === itemValue ? '' : itemValue));\n }}\n onItemDismiss={() => setValue('')}\n >\n <Primitive.nav\n aria-label=\"Main\"\n data-orientation={orientation}\n dir={direction}\n {...NavigationMenuProps}\n ref={composedRef}\n />\n </NavigationMenuProvider>\n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * NavigationMenuSub\n * -----------------------------------------------------------------------------------------------*/\n\nconst SUB_NAME = 'NavigationMenuSub';\n\ntype NavigationMenuSubElement = React.ComponentRef<typeof Primitive.div>;\ntype PrimitiveDivProps = React.ComponentPropsWithoutRef<typeof Primitive.div>;\ninterface NavigationMenuSubProps\n extends\n Omit<NavigationMenuProviderProps, keyof NavigationMenuProviderPrivateProps>,\n PrimitiveDivProps {\n value?: string;\n defaultValue?: string;\n onValueChange?: (value: string) => void;\n orientation?: Orientation;\n /**\n * Whether an item is activated automatically or manually.\n * - `\"automatic\"`: hovering or focusing a trigger opens its item, and moving\n * away closes it after a short delay.\n * - `\"manual\"`: clicking a trigger toggles the item; hover and focus are\n * ignored\n *\n * The default value is inherited from the parent Navigation Menu root\n * component. If no value is provided to the parent, the default value is\n * `\"automatic\"`.\n */\n activationMode?: ActivationMode;\n /**\n * When true, clicking a sub-menu item's trigger once it's active will not deactivate it.\n *\n * @default true\n */\n disableToggle?: boolean;\n}\n\nconst NavigationMenuSub = /* @__PURE__ */ React.forwardRef<\n NavigationMenuSubElement,\n NavigationMenuSubProps\n>(\n // blank line to reduce diff noise\n function NavigationMenuSub(props: ScopedProps<NavigationMenuSubProps>, forwardedRef) {\n const {\n __scopeNavigationMenu,\n value: valueProp,\n onValueChange,\n defaultValue,\n orientation = Orientation.Horizontal,\n activationMode: activationModeProp,\n disableToggle = true,\n ...subProps\n } = props;\n const context = useNavigationMenuContext(SUB_NAME, __scopeNavigationMenu);\n const activationMode = activationModeProp ?? context.activationMode;\n const [value, setValue] = useControllableState({\n prop: valueProp,\n onChange: onValueChange,\n defaultProp: defaultValue ?? '',\n caller: SUB_NAME,\n });\n\n return (\n <NavigationMenuProvider\n scope={__scopeNavigationMenu}\n isRootMenu={false}\n value={value}\n dir={context.dir}\n orientation={orientation}\n activationMode={activationMode}\n rootNavigationMenu={context.rootNavigationMenu}\n onTriggerEnter={(itemValue) => {\n if (activationMode === ActivationMode.Automatic) {\n setValue(itemValue);\n }\n }}\n onItemSelect={(itemValue) => {\n setValue((prevValue) => (disableToggle || prevValue !== itemValue ? itemValue : ''));\n }}\n onItemDismiss={() => setValue('')}\n >\n <Primitive.div data-orientation={orientation} {...subProps} ref={forwardedRef} />\n </NavigationMenuProvider>\n );\n },\n);\n\n/* -----------------------------------------------------------------------------------------------*/\n\ninterface NavigationMenuProviderPrivateProps {\n isRootMenu: boolean;\n scope: Scope;\n children: React.ReactNode;\n orientation: Orientation;\n dir: Direction;\n activationMode: ActivationMode;\n rootNavigationMenu: NavigationMenuElement | null;\n value: string;\n onTriggerEnter(itemValue: string): void;\n onTriggerLeave?(): void;\n onContentEnter?(): void;\n onContentLeave?(): void;\n onItemSelect(itemValue: string): void;\n onItemDismiss(): void;\n}\n\ninterface NavigationMenuProviderProps extends NavigationMenuProviderPrivateProps {}\n\nconst NavigationMenuProvider: React.FC<NavigationMenuProviderProps> = (\n props: ScopedProps<NavigationMenuProviderProps>,\n) => {\n const {\n scope,\n isRootMenu,\n rootNavigationMenu,\n dir,\n orientation,\n activationMode,\n children,\n value,\n onItemSelect,\n onItemDismiss,\n onTriggerEnter,\n onTriggerLeave,\n onContentEnter,\n onContentLeave,\n } = props;\n const [viewport, setViewport] = React.useState<NavigationMenuViewportElement | null>(null);\n const [viewportContent, setViewportContent] = React.useState<Map<string, ContentData>>(new Map());\n const [indicatorTrack, setIndicatorTrack] = React.useState<HTMLDivElement | null>(null);\n\n return (\n <NavigationMenuProviderImpl\n scope={scope}\n isRootMenu={isRootMenu}\n rootNavigationMenu={rootNavigationMenu}\n value={value}\n previousValue={usePrevious(value)}\n baseId={useId()}\n dir={dir}\n orientation={orientation}\n activationMode={activationMode}\n viewport={viewport}\n onViewportChange={setViewport}\n indicatorTrack={indicatorTrack}\n onIndicatorTrackChange={setIndicatorTrack}\n onTriggerEnter={useCallbackRef(onTriggerEnter)}\n onTriggerLeave={useCallbackRef(onTriggerLeave)}\n onContentEnter={useCallbackRef(onContentEnter)}\n onContentLeave={useCallbackRef(onContentLeave)}\n onItemSelect={useCallbackRef(onItemSelect)}\n onItemDismiss={useCallbackRef(onItemDismiss)}\n onViewportContentChange={React.useCallback((contentValue, contentData) => {\n setViewportContent((prevContent) => {\n prevContent.set(contentValue, contentData);\n return new Map(prevContent);\n });\n }, [])}\n onViewportContentRemove={React.useCallback((contentValue) => {\n setViewportContent((prevContent) => {\n if (!prevContent.has(contentValue)) return prevContent;\n prevContent.delete(contentValue);\n return new Map(prevContent);\n });\n }, [])}\n >\n <Collection.Provider scope={scope}>\n <ViewportContentProvider scope={scope} items={viewportContent}>\n {children}\n </ViewportContentProvider>\n </Collection.Provider>\n </NavigationMenuProviderImpl>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * NavigationMenuList\n * -----------------------------------------------------------------------------------------------*/\n\nconst LIST_NAME = 'NavigationMenuList';\n\ntype NavigationMenuListElement = React.ComponentRef<typeof Primitive.ul>;\ntype PrimitiveUnorderedListProps = React.ComponentPropsWithoutRef<typeof Primitive.ul>;\ninterface NavigationMenuListProps extends PrimitiveUnorderedListProps {}\n\nconst NavigationMenuList = /* @__PURE__ */ React.forwardRef<\n NavigationMenuListElement,\n NavigationMenuListProps\n>(\n // blank line to reduce diff noise\n function NavigationMenuList(props: ScopedProps<NavigationMenuListProps>, forwardedRef) {\n const { __scopeNavigationMenu, ...listProps } = props;\n const context = useNavigationMenuContext(LIST_NAME, __scopeNavigationMenu);\n\n const list = (\n <Primitive.ul data-orientation={context.orientation} {...listProps} ref={forwardedRef} />\n );\n\n return (\n <Primitive.div style={{ position: 'relative' }} ref={context.onIndicatorTrackChange}>\n <Collection.Slot scope={__scopeNavigationMenu}>\n {context.isRootMenu ? <FocusGroup asChild>{list}</FocusGroup> : list}\n </Collection.Slot>\n </Primitive.div>\n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * NavigationMenuItem\n * -----------------------------------------------------------------------------------------------*/\n\nconst ITEM_NAME = 'NavigationMenuItem';\n\ntype FocusProxyElement = React.ComponentRef<typeof VisuallyHiddenPrimitive.Root>;\n\ntype NavigationMenuItemContextValue = {\n value: string;\n triggerRef: React.RefObject<NavigationMenuTriggerElement | null>;\n contentRef: React.RefObject<NavigationMenuContentElement | null>;\n focusProxyRef: React.RefObject<FocusProxyElement | null>;\n wasEscapeCloseRef: React.MutableRefObject<boolean>;\n onEntryKeyDown(): void;\n onFocusProxyEnter(side: 'start' | 'end'): void;\n onRootContentClose(): void;\n onContentFocusOutside(): void;\n};\n\nconst [NavigationMenuItemContextProvider, useNavigationMenuItemContext] =\n createNavigationMenuContext<NavigationMenuItemContextValue>(ITEM_NAME);\n\ntype NavigationMenuItemElement = React.ComponentRef<typeof Primitive.li>;\ntype PrimitiveListItemProps = React.ComponentPropsWithoutRef<typeof Primitive.li>;\ninterface NavigationMenuItemProps extends PrimitiveListItemProps {\n value?: string;\n}\n\nconst NavigationMenuItem = /* @__PURE__ */ React.forwardRef<\n NavigationMenuItemElement,\n NavigationMenuItemProps\n>(\n // blank line to reduce diff noise\n function NavigationMenuItem(props: ScopedProps<NavigationMenuItemProps>, forwardedRef) {\n const { __scopeNavigationMenu, value: valueProp, ...itemProps } = props;\n const autoValue = useId();\n // We need to provide an initial deterministic value as `useId` will return\n // empty string on the first render and we don't want to match our internal \"closed\" value.\n const value = valueProp || autoValue || 'LEGACY_REACT_AUTO_VALUE';\n const contentRef = React.useRef<NavigationMenuContentElement>(null);\n const triggerRef = React.useRef<NavigationMenuTriggerElement>(null);\n const focusProxyRef = React.useRef<FocusProxyElement>(null);\n const restoreContentTabOrderRef = React.useRef(() => {});\n const wasEscapeCloseRef = React.useRef(false);\n\n const handleContentEntry = React.useCallback((side = 'start') => {\n if (contentRef.current) {\n restoreContentTabOrderRef.current();\n const candidates = getTabbableCandidates(contentRef.current);\n if (candidates.length) focusFirst(side === 'start' ? candidates : candidates.reverse());\n }\n }, []);\n\n const handleContentExit = React.useCallback(() => {\n if (contentRef.current) {\n const candidates = getTabbableCandidates(contentRef.current);\n if (candidates.length) restoreContentTabOrderRef.current = removeFromTabOrder(candidates);\n }\n }, []);\n\n return (\n <NavigationMenuItemContextProvider\n scope={__scopeNavigationMenu}\n value={value}\n triggerRef={triggerRef}\n contentRef={contentRef}\n focusProxyRef={focusProxyRef}\n wasEscapeCloseRef={wasEscapeCloseRef}\n onEntryKeyDown={handleContentEntry}\n onFocusProxyEnter={handleContentEntry}\n onRootContentClose={handleContentExit}\n onContentFocusOutside={handleContentExit}\n >\n <Primitive.li {...itemProps} ref={forwardedRef} />\n </NavigationMenuItemContextProvider>\n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * NavigationMenuTrigger\n * -----------------------------------------------------------------------------------------------*/\n\nconst TRIGGER_NAME = 'NavigationMenuTrigger';\n\ntype NavigationMenuTriggerElement = React.ComponentRef<typeof Primitive.button>;\ntype PrimitiveButtonProps = React.ComponentPropsWithoutRef<typeof Primitive.button>;\ninterface NavigationMenuTriggerProps extends PrimitiveButtonProps {}\n\nconst NavigationMenuTrigger = /* @__PURE__ */ React.forwardRef<\n NavigationMenuTriggerElement,\n NavigationMenuTriggerProps\n>(function NavigationMenuTrigger(props: ScopedProps<NavigationMenuTriggerProps>, forwardedRef) {\n const { __scopeNavigationMenu, disabled, ...triggerProps } = props;\n const context = useNavigationMenuContext(TRIGGER_NAME, props.__scopeNavigationMenu);\n const itemContext = useNavigationMenuItemContext(TRIGGER_NAME, props.__scopeNavigationMenu);\n const ref = React.useRef<NavigationMenuTriggerElement>(null);\n const composedRefs = useComposedRefs(ref, itemContext.triggerRef, forwardedRef);\n const triggerId = makeTriggerId(context.baseId, itemContext.value);\n const contentId = makeContentId(context.baseId, itemContext.value);\n const hasPointerMoveOpenedRef = React.useRef(false);\n const wasClickCloseRef = React.useRef(false);\n const open = itemContext.value === context.value;\n\n return (\n <>\n <Collection.ItemSlot scope={__scopeNavigationMenu} value={itemContext.value}>\n <FocusGroupItem asChild>\n <Primitive.button\n id={triggerId}\n disabled={disabled}\n data-disabled={disabled ? '' : undefined}\n data-state={getOpenState(open)}\n aria-expanded={open}\n aria-controls={open ? contentId : undefined}\n {...triggerProps}\n ref={composedRefs}\n onPointerEnter={composeEventHandlers(props.onPointerEnter, () => {\n wasClickCloseRef.current = false;\n itemContext.wasEscapeCloseRef.current = false;\n })}\n onPointerMove={composeEventHandlers(\n props.onPointerMove,\n whenMouse(() => {\n if (\n disabled ||\n wasClickCloseRef.current ||\n itemContext.wasEscapeCloseRef.current ||\n hasPointerMoveOpenedRef.current\n )\n return;\n context.onTriggerEnter(itemContext.value);\n hasPointerMoveOpenedRef.current = true;\n }),\n )}\n onPointerLeave={composeEventHandlers(\n props.onPointerLeave,\n whenMouse(() => {\n if (disabled) return;\n context.onTriggerLeave();\n hasPointerMoveOpenedRef.current = false;\n }),\n )}\n onClick={composeEventHandlers(props.onClick, () => {\n context.onItemSelect(itemContext.value);\n wasClickCloseRef.current = open;\n })}\n onKeyDown={composeEventHandlers(props.onKeyDown, (event) => {\n const verticalEntryKey = context.dir === Direction.RTL ? 'ArrowLeft' : 'ArrowRight';\n const entryKey = { horizontal: 'ArrowDown', vertical: verticalEntryKey }[\n context.orientation\n ];\n if (open && event.key === entryKey) {\n itemContext.onEntryKeyDown();\n // Prevent FocusGroupItem from handling the event\n event.preventDefault();\n }\n })}\n />\n </FocusGroupItem>\n </Collection.ItemSlot>\n\n {/* Proxy tab order between trigger and content */}\n {open && (\n <>\n <VisuallyHiddenPrimitive.Root\n aria-hidden\n tabIndex={0}\n ref={itemContext.focusProxyRef}\n onFocus={(event) => {\n const content = itemContext.contentRef.current;\n const prevFocusedElement = event.relatedTarget as HTMLElement | null;\n const wasTriggerFocused = prevFocusedElement === ref.current;\n const wasFocusFromContent = content?.contains(prevFocusedElement);\n\n if (wasTriggerFocused || !wasFocusFromContent) {\n itemContext.onFocusProxyEnter(wasTriggerFocused ? 'start' : 'end');\n }\n }}\n />\n\n {/* Restructure a11y tree to make content accessible to screen reader when using the viewport */}\n {context.viewport && <span aria-owns={contentId} />}\n </>\n )}\n </>\n );\n});\n\n/* -------------------------------------------------------------------------------------------------\n * NavigationMenuLink\n * -----------------------------------------------------------------------------------------------*/\nconst LINK_SELECT = 'navigationMenu.linkSelect';\n\ntype NavigationMenuLinkElement = React.ComponentRef<typeof Primitive.a>;\ntype PrimitiveLinkProps = React.ComponentPropsWithoutRef<typeof Primitive.a>;\ninterface NavigationMenuLinkProps extends Omit<PrimitiveLinkProps, 'onSelect'> {\n active?: boolean;\n onSelect?: (event: Event) => void;\n}\n\nconst NavigationMenuLink = /* @__PURE__ */ React.forwardRef<\n NavigationMenuLinkElement,\n NavigationMenuLinkProps\n>(\n // blank line to reduce diff noise\n function NavigationMenuLink(props: ScopedProps<NavigationMenuLinkProps>, forwardedRef) {\n const { __scopeNavigationMenu, active, onSelect, ...linkProps } = props;\n\n return (\n <FocusGroupItem asChild>\n <Primitive.a\n data-active={active ? '' : undefined}\n aria-current={active ? 'page' : undefined}\n {...linkProps}\n ref={forwardedRef}\n onClick={composeEventHandlers(\n props.onClick,\n (event) => {\n const target = event.target as HTMLElement;\n const linkSelectEvent = new CustomEvent(LINK_SELECT, {\n bubbles: true,\n cancelable: true,\n });\n target.addEventListener(LINK_SELECT, (event) => onSelect?.(event), { once: true });\n dispatchDiscreteCustomEvent(target, linkSelectEvent);\n\n if (!linkSelectEvent.defaultPrevented && !event.metaKey) {\n const rootContentDismissEvent = new CustomEvent(ROOT_CONTENT_DISMISS, {\n bubbles: true,\n cancelable: true,\n });\n dispatchDiscreteCustomEvent(target, rootContentDismissEvent);\n }\n },\n { checkForDefaultPrevented: false },\n )}\n />\n </FocusGroupItem>\n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * NavigationMenuIndicator\n * -----------------------------------------------------------------------------------------------*/\n\nconst INDICATOR_NAME = 'NavigationMenuIndicator';\n\ntype NavigationMenuIndicatorElement = NavigationMenuIndicatorImplElement;\ninterface NavigationMenuIndicatorProps extends NavigationMenuIndicatorImplProps {\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true;\n}\n\nconst NavigationMenuIndicator = /* @__PURE__ */ React.forwardRef<\n NavigationMenuIndicatorElement,\n NavigationMenuIndicatorProps\n>(function NavigationMenuIndicator(props: ScopedProps<NavigationMenuIndicatorProps>, forwardedRef) {\n const { forceMount, ...indicatorProps } = props;\n const context = useNavigationMenuContext(INDICATOR_NAME, props.__scopeNavigationMenu);\n const isVisible = Boolean(context.value);\n\n return context.indicatorTrack\n ? ReactDOM.createPortal(\n <Presence present={forceMount || isVisible}>\n <NavigationMenuIndicatorImpl {...indicatorProps} ref={forwardedRef} />\n </Presence>,\n context.indicatorTrack,\n )\n : null;\n});\n\ntype NavigationMenuIndicatorImplElement = React.ComponentRef<typeof Primitive.div>;\ninterface NavigationMenuIndicatorImplProps extends PrimitiveDivProps {}\n\nconst NavigationMenuIndicatorImpl = /* @__PURE__ */ React.forwardRef<\n NavigationMenuIndicatorImplElement,\n NavigationMenuIndicatorImplProps\n>(function NavigationMenuIndicatorImpl(\n props: ScopedProps<NavigationMenuIndicatorImplProps>,\n forwardedRef,\n) {\n const { __scopeNavigationMenu, ...indicatorProps } = props;\n const context = useNavigationMenuContext(INDICATOR_NAME, __scopeNavigationMenu);\n const getItems = useCollection(__scopeNavigationMenu);\n const [activeTrigger, setActiveTrigger] = React.useState<NavigationMenuTriggerElement | null>(\n null,\n );\n const [position, setPosition] = React.useState<{ size: number; offset: number } | null>(null);\n const isHorizontal = context.orientation === Orientation.Horizontal;\n const isVisible = Boolean(context.value);\n\n React.useEffect(() => {\n const items = getItems();\n const triggerNode = items.find((item) => item.value === context.value)?.ref.current;\n if (triggerNode) setActiveTrigger(triggerNode);\n }, [getItems, context.value]);\n\n /**\n * Update position when the indicator or parent track size changes\n */\n const handlePositionChange = () => {\n if (activeTrigger) {\n setPosition({\n size: isHorizontal ? activeTrigger.offsetWidth : activeTrigger.offsetHeight,\n offset: isHorizontal ? activeTrigger.offsetLeft : activeTrigger.offsetTop,\n });\n }\n };\n useResizeObserver(activeTrigger, handlePositionChange);\n useResizeObserver(context.indicatorTrack, handlePositionChange);\n\n // We need to wait for the indicator position to be available before rendering to\n // snap immediately into position rather than transitioning from initial\n return position ? (\n <Primitive.div\n aria-hidden\n data-state={isVisible ? 'visible' : 'hidden'}\n data-orientation={context.orientation}\n {...indicatorProps}\n ref={forwardedRef}\n style={{\n position: 'absolute',\n ...(isHorizontal\n ? {\n left: 0,\n width: position.size + 'px',\n transform: `translateX(${position.offset}px)`,\n '--radix-navigation-menu-indicator-translate-x': `${position.offset}px`,\n }\n : {\n top: 0,\n height: position.size + 'px',\n transform: `translateY(${position.offset}px)`,\n '--radix-navigation-menu-indicator-translate-y': `${position.offset}px`,\n }),\n ...indicatorProps.style,\n }}\n />\n ) : null;\n});\n\n/* -------------------------------------------------------------------------------------------------\n * NavigationMenuContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'NavigationMenuContent';\n\ntype NavigationMenuContentElement = NavigationMenuContentImplElement;\ninterface NavigationMenuContentProps extends Omit<\n NavigationMenuContentImplProps,\n keyof NavigationMenuContentImplPrivateProps\n> {\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true;\n}\n\nconst NavigationMenuContent = /* @__PURE__ */ React.forwardRef<\n NavigationMenuContentElement,\n NavigationMenuContentProps\n>(function NavigationMenuContent(props: ScopedProps<NavigationMenuContentProps>, forwardedRef) {\n const { forceMount, ...contentProps } = props;\n const context = useNavigationMenuContext(CONTENT_NAME, props.__scopeNavigationMenu);\n const itemContext = useNavigationMenuItemContext(CONTENT_NAME, props.__scopeNavigationMenu);\n const composedRefs = useComposedRefs(itemContext.contentRef, forwardedRef);\n const open = itemContext.value === context.value;\n\n const commonProps = {\n value: itemContext.value,\n triggerRef: itemContext.triggerRef,\n focusProxyRef: itemContext.focusProxyRef,\n wasEscapeCloseRef: itemContext.wasEscapeCloseRef,\n onContentFocusOutside: itemContext.onContentFocusOutside,\n onRootContentClose: itemContext.onRootContentClose,\n ...contentProps,\n };\n\n return !context.viewport ? (\n <Presence present={forceMount || open}>\n <NavigationMenuContentImpl\n data-state={getOpenState(open)}\n {...commonProps}\n ref={composedRefs}\n onPointerEnter={composeEventHandlers(props.onPointerEnter, context.onContentEnter)}\n onPointerLeave={composeEventHandlers(\n props.onPointerLeave,\n whenMouse(context.onContentLeave),\n )}\n style={{\n // Prevent interaction when animating out\n pointerEvents: !open && context.isRootMenu ? 'none' : undefined,\n ...commonProps.style,\n }}\n />\n </Presence>\n ) : (\n <ViewportContentMounter forceMount={forceMount} {...commonProps} ref={composedRefs} />\n );\n});\n\n/* -----------------------------------------------------------------------------------------------*/\n\ntype ViewportContentMounterElement = NavigationMenuContentImplElement;\ninterface ViewportContentMounterProps extends NavigationMenuContentImplProps {\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true;\n}\n\nconst ViewportContentMounter = /* @__PURE__ */ React.forwardRef<\n ViewportContentMounterElement,\n ViewportContentMounterProps\n>(function ViewportContentMounter(props: ScopedProps<ViewportContentMounterProps>, forwardedRef) {\n const context = useNavigationMenuContext(CONTENT_NAME, props.__scopeNavigationMenu);\n const { onViewportContentChange, onViewportContentRemove } = context;\n\n useLayoutEffect(() => {\n onViewportContentChange(props.value, {\n ref: forwardedRef,\n ...props,\n });\n }, [props, forwardedRef, onViewportContentChange]);\n\n useLayoutEffect(() => {\n return () => onViewportContentRemove(props.value);\n }, [props.value, onViewportContentRemove]);\n\n // Content is proxied into the viewport\n return null;\n});\n\n/* -----------------------------------------------------------------------------------------------*/\n\nconst ROOT_CONTENT_DISMISS = 'navigationMenu.rootContentDismiss';\n\ntype MotionAttribute = 'to-start' | 'to-end' | 'from-start' | 'from-end';\ntype NavigationMenuContentImplElement = React.ComponentRef<typeof DismissableLayer>;\ntype DismissableLayerProps = React.ComponentPropsWithoutRef<typeof DismissableLayer>;\n\ninterface NavigationMenuContentImplPrivateProps {\n value: string;\n triggerRef: React.RefObject<NavigationMenuTriggerElement | null>;\n focusProxyRef: React.RefObject<FocusProxyElement | null>;\n wasEscapeCloseRef: React.MutableRefObject<boolean>;\n onContentFocusOutside(): void;\n onRootContentClose(): void;\n}\ninterface NavigationMenuContentImplProps\n extends\n Omit<DismissableLayerProps, 'onDismiss' | 'disableOutsidePointerEvents'>,\n NavigationMenuContentImplPrivateProps {}\n\nconst NavigationMenuContentImpl = /* @__PURE__ */ React.forwardRef<\n NavigationMenuContentImplElement,\n NavigationMenuContentImplProps\n>(function NavigationMenuContentImpl(\n props: ScopedProps<NavigationMenuContentImplProps>,\n forwardedRef,\n) {\n const {\n __scopeNavigationMenu,\n value,\n triggerRef,\n focusProxyRef,\n wasEscapeCloseRef,\n onRootContentClose,\n onContentFocusOutside,\n ...contentProps\n } = props;\n const context = useNavigationMenuContext(CONTENT_NAME, __scopeNavigationMenu);\n const ref = React.useRef<NavigationMenuContentImplElement>(null);\n const composedRefs = useComposedRefs(ref, forwardedRef);\n const triggerId = makeTriggerId(context.baseId, value);\n const contentId = makeContentId(context.baseId, value);\n const getItems = useCollection(__scopeNavigationMenu);\n const prevMotionAttributeRef = React.useRef<MotionAttribute | null>(null);\n\n const { onItemDismiss } = context;\n\n React.useEffect(() => {\n const content = ref.current;\n\n // Bubble dismiss to the root content node and focus its trigger\n if (context.isRootMenu && content) {\n const handleClose = () => {\n onItemDismiss();\n onRootContentClose();\n if (content.contains(document.activeElement)) triggerRef.current?.focus();\n };\n content.addEventListener(ROOT_CONTENT_DISMISS, handleClose);\n return () => content.removeEventListener(ROOT_CONTENT_DISMISS, handleClose);\n }\n }, [context.isRootMenu, props.value, triggerRef, onItemDismiss, onRootContentClose]);\n\n const motionAttribute = React.useMemo(() => {\n const items = getItems();\n const values = items.map((item) => item.value);\n if (context.dir === Direction.RTL) values.reverse();\n const index = values.indexOf(context.value);\n const prevIndex = values.indexOf(context.previousValue);\n const isSelected = value === context.value;\n const wasSelected = prevIndex === values.indexOf(value);\n\n // We only want to update selected and the last selected content\n // this avoids animations being interrupted outside of that range\n if (!isSelected && !wasSelected) return prevMotionAttributeRef.current;\n\n const attribute = (() => {\n // Don't provide a direction on the initial open\n if (index !== prevIndex) {\n // If we're moving to this item from another\n if (isSelected && prevIndex !== -1) return index > prevIndex ? 'from-end' : 'from-start';\n // If we're leaving this item for another\n if (wasSelected && index !== -1) return index > prevIndex ? 'to-start' : 'to-end';\n }\n // Otherwise we're entering from closed or leaving the list\n // entirely and should not animate in any direction\n return null;\n })();\n\n prevMotionAttributeRef.current = attribute;\n return attribute;\n }, [context.previousValue, context.value, context.dir, getItems, value]);\n\n return (\n <FocusGroup asChild>\n <DismissableLayer\n id={contentId}\n aria-labelledby={triggerId}\n data-motion={motionAttribute}\n data-orientation={context.orientation}\n {...contentProps}\n ref={composedRefs}\n disableOutsidePointerEvents={false}\n onDismiss={() => {\n const rootContentDismissEvent = new Event(ROOT_CONTENT_DISMISS, {\n bubbles: true,\n cancelable: true,\n });\n ref.current?.dispatchEvent(rootContentDismissEvent);\n }}\n onFocusOutside={composeEventHandlers(props.onFocusOutside, (event) => {\n onContentFocusOutside();\n const target = event.target;\n const relatedTarget = event.detail.originalEvent.relatedTarget;\n const focusMovedIntoMenu = context.rootNavigationMenu?.contains(target as Node);\n const focusCameFromMenu = context.rootNavigationMenu?.contains(relatedTarget as Node);\n // Only dismiss content when focus actually leaves the menu. If focus\n // moves into the menu, or it never originated from within the menu\n // (e.g. an external layer such as a Dialog auto-focusing on open),\n // keep the content open.\n // See https://github.com/radix-ui/primitives/issues/3473\n if (focusMovedIntoMenu || !focusCameFromMenu) {\n event.preventDefault();\n }\n })}\n onPointerDownOutside={composeEventHandlers(props.onPointerDownOutside, (event) => {\n const target = event.target as HTMLElement;\n const isTrigger = getItems().some((item) => item.ref.current?.contains(target));\n const isRootViewport = context.isRootMenu && context.viewport?.contains(target);\n if (isTrigger || isRootViewport || !context.isRootMenu) event.preventDefault();\n })}\n onKeyDown={composeEventHandlers(props.onKeyDown, (event) => {\n const isMetaKey = event.altKey || event.ctrlKey || event.metaKey;\n const isTabKey = event.key === 'Tab' && !isMetaKey;\n if (isTabKey) {\n const candidates = getTabbableCandidates(event.currentTarget);\n const focusedElement = document.activeElement;\n const index = candidates.findIndex((candidate) => candidate === focusedElement);\n const isMovingBackwards = event.shiftKey;\n const nextCandidates = isMovingBackwards\n ? candidates.slice(0, index).reverse()\n : candidates.slice(index + 1, candidates.length);\n\n if (focusFirst(nextCandidates)) {\n // prevent browser tab keydown because we've handled focus\n event.preventDefault();\n } else {\n // If we can't focus that means we're at the edges\n // so focus the proxy and let browser handle\n // tab/shift+tab keypress on the proxy instead\n focusProxyRef.current?.focus();\n }\n }\n })}\n onEscapeKeyDown={composeEventHandlers(props.onEscapeKeyDown, (_event) => {\n // prevent the dropdown from reopening\n // after the escape key has been pressed\n wasEscapeCloseRef.current = true;\n })}\n />\n </FocusGroup>\n );\n});\n\n/* -------------------------------------------------------------------------------------------------\n * NavigationMenuViewport\n * -----------------------------------------------------------------------------------------------*/\n\nconst VIEWPORT_NAME = 'NavigationMenuViewport';\n\ntype NavigationMenuViewportElement = NavigationMenuViewportImplElement;\ninterface NavigationMenuViewportProps extends Omit<\n NavigationMenuViewportImplProps,\n 'activeContentValue'\n> {\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true;\n}\n\nconst NavigationMenuViewport = /* @__PURE__ */ React.forwardRef<\n NavigationMenuViewportElement,\n NavigationMenuViewportProps\n>(function NavigationMenuViewport(props: ScopedProps<NavigationMenuViewportProps>, forwardedRef) {\n const { forceMount, ...viewportProps } = props;\n const context = useNavigationMenuContext(VIEWPORT_NAME, props.__scopeNavigationMenu);\n const open = Boolean(context.value);\n\n return (\n <Presence present={forceMount || open}>\n <NavigationMenuViewportImpl {...viewportProps} ref={forwardedRef} />\n </Presence>\n );\n});\n\n/* -----------------------------------------------------------------------------------------------*/\n\ntype NavigationMenuViewportImplElement = React.ComponentRef<typeof Primitive.div>;\ninterface NavigationMenuViewportImplProps extends PrimitiveDivProps {}\n\nconst NavigationMenuViewportImpl = /* @__PURE__ */ React.forwardRef<\n NavigationMenuViewportImplElement,\n NavigationMenuViewportImplProps\n>(function NavigationMenuViewportImpl(\n props: ScopedProps<NavigationMenuViewportImplProps>,\n forwardedRef,\n) {\n const { __scopeNavigationMenu, children, ...viewportImplProps } = props;\n const context = useNavigationMenuContext(VIEWPORT_NAME, __scopeNavigationMenu);\n const composedRefs = useComposedRefs(forwardedRef, context.onViewportChange);\n const viewportContentContext = useViewportContentContext(\n CONTENT_NAME,\n props.__scopeNavigationMenu,\n );\n const [size, setSize] = React.useState<{ width: number; height: number } | null>(null);\n const [content, setContent] = React.useState<NavigationMenuContentElement | null>(null);\n const viewportWidth = size ? size?.width + 'px' : undefined;\n const viewportHeight = size ? size?.height + 'px' : undefined;\n const open = Boolean(context.value);\n // We persist the last active content value as the viewport may be animating out\n // and we want the content to remain mounted for the lifecycle of the viewport.\n const activeContentValue = open ? context.value : context.previousValue;\n\n /**\n * Update viewport size to match the active content node.\n * We prefer offset dimensions over `getBoundingClientRect` as the latter respects CSS transform.\n * For example, if content animates in from `scale(0.5)` the dimensions would be anything\n * from `0.5` to `1` of the intended size.\n */\n const handleSizeChange = () => {\n if (content) setSize({ width: content.offsetWidth, height: content.offsetHeight });\n };\n useResizeObserver(content, handleSizeChange);\n\n return (\n <Primitive.div\n data-state={getOpenState(open)}\n data-orientation={context.orientation}\n {...viewportImplProps}\n ref={composedRefs}\n style={{\n // Prevent interaction when animating out\n pointerEvents: !open && context.isRootMenu ? 'none' : undefined,\n '--radix-navigation-menu-viewport-width': viewportWidth,\n '--radix-navigation-menu-viewport-height': viewportHeight,\n ...viewportImplProps.style,\n }}\n onPointerEnter={composeEventHandlers(props.onPointerEnter, context.onContentEnter)}\n onPointerLeave={composeEventHandlers(props.onPointerLeave, whenMouse(context.onContentLeave))}\n >\n {Array.from(viewportContentContext.items).map(([value, { ref, forceMount, ...props }]) => {\n const isActive = activeContentValue === value;\n return (\n <Presence key={value} present={forceMount || isActive}>\n <NavigationMenuViewportItem\n {...props}\n contentRef={ref}\n isActive={isActive}\n onActiveContentChange={setContent}\n />\n </Presence>\n );\n })}\n </Primitive.div>\n );\n});\n\n/* -----------------------------------------------------------------------------------------------*/\n\ninterface NavigationMenuViewportItemProps extends NavigationMenuContentImplProps {\n contentRef?: React.Ref<ViewportContentMounterElement>;\n isActive: boolean;\n onActiveContentChange: (node: NavigationMenuContentElement | null) => void;\n}\n\nconst NavigationMenuViewportItem = ({\n contentRef,\n isActive,\n onActiveContentChange,\n ...props\n}: ScopedProps<NavigationMenuViewportItemProps>) => {\n const handleContentChange = React.useCallback(\n (node: NavigationMenuContentElement | null) => {\n // We only want to update the stored node when another is available\n // as we need to smoothly transition between them.\n if (isActive && node) {\n onActiveContentChange(node);\n }\n },\n [isActive, onActiveContentChange],\n );\n const composedRefs = useComposedRefs(contentRef, handleContentChange);\n return <NavigationMenuContentImpl {...props} ref={composedRefs} />;\n};\n\n/* -----------------------------------------------------------------------------------------------*/\n\nconst FOCUS_GROUP_NAME = 'FocusGroup';\n\ntype FocusGroupElement = React.ComponentRef<typeof Primitive.div>;\ninterface FocusGroupProps extends PrimitiveDivProps {}\n\nconst FocusGroup = /* @__PURE__ */ React.forwardRef<FocusGroupElement, FocusGroupProps>(\n function FocusGroup(props: ScopedProps<FocusGroupProps>, forwardedRef) {\n const { __scopeNavigationMenu, ...groupProps } = props;\n const context = useNavigationMenuContext(FOCUS_GROUP_NAME, __scopeNavigationMenu);\n\n return (\n <FocusGroupCollection.Provider scope={__scopeNavigationMenu}>\n <FocusGroupCollection.Slot scope={__scopeNavigationMenu}>\n <Primitive.div dir={context.dir} {...groupProps} ref={forwardedRef} />\n </FocusGroupCollection.Slot>\n </FocusGroupCollection.Provider>\n );\n },\n);\n\n/* -----------------------------------------------------------------------------------------------*/\n\nconst ARROW_KEYS = ['ArrowRight', 'ArrowLeft', 'ArrowUp', 'ArrowDown'];\nconst FOCUS_GROUP_ITEM_NAME = 'FocusGroupItem';\n\ntype FocusGroupItemElement = React.ComponentRef<typeof Primitive.button>;\ninterface FocusGroupItemProps extends PrimitiveButtonProps {}\n\nconst FocusGroupItem = /* @__PURE__ */ React.forwardRef<FocusGroupItemElement, FocusGroupItemProps>(\n function FocusGroupItem(props: ScopedProps<FocusGroupItemProps>, forwardedRef) {\n const { __scopeNavigationMenu, ...groupProps } = props;\n const getItems = useFocusGroupCollection(__scopeNavigationMenu);\n const context = useNavigationMenuContext(FOCUS_GROUP_ITEM_NAME, __scopeNavigationMenu);\n\n return (\n <FocusGroupCollection.ItemSlot scope={__scopeNavigationMenu}>\n <Primitive.button\n {...groupProps}\n ref={forwardedRef}\n onKeyDown={composeEventHandlers(props.onKeyDown, (event) => {\n const isFocusNavigationKey = ['Home', 'End', ...ARROW_KEYS].includes(event.key);\n if (isFocusNavigationKey) {\n let candidateNodes = getItems().map((item) => item.ref.current!);\n const prevItemKey = context.dir === Direction.RTL ? 'ArrowRight' : 'ArrowLeft';\n const prevKeys = [prevItemKey, 'ArrowUp', 'End'];\n if (prevKeys.includes(event.key)) candidateNodes.reverse();\n if (ARROW_KEYS.includes(event.key)) {\n const currentIndex = candidateNodes.indexOf(event.currentTarget);\n candidateNodes = candidateNodes.slice(currentIndex + 1);\n }\n /**\n * Imperative focus during keydown is risky so we prevent React's batching updates\n * to avoid potential bugs. See: https://github.com/facebook/react/issues/20332\n */\n setTimeout(() => focusFirst(candidateNodes));\n\n // Prevent page scroll while navigating\n event.preventDefault();\n }\n })}\n />\n </FocusGroupCollection.ItemSlot>\n );\n },\n);\n\n/**\n * Returns a list of potential tabbable candidates.\n *\n * NOTE: This is only a close approximation. For example it doesn't take into account cases like when\n * elements are not visible. This cannot be worked out easily by just reading a property, but rather\n * necessitate runtime knowledge (computed styles, etc). We deal with these cases separately.\n *\n * See: https://developer.mozilla.org/en-US/docs/Web/API/TreeWalker\n * Credit: https://github.com/discord/focus-layers/blob/master/src/util/wrapFocus.tsx#L1\n */\nfunction getTabbableCandidates(container: HTMLElement) {\n const nodes: HTMLElement[] = [];\n const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {\n acceptNode: (node: any) => {\n const isHiddenInput = node.tagName === 'INPUT' && node.type === 'hidden';\n if (node.disabled || node.hidden || isHiddenInput) return NodeFilter.FILTER_SKIP;\n // `.tabIndex` is not the same as the `tabindex` attribute. It works on the\n // runtime's understanding of tabbability, so this automatically accounts\n // for any kind of element that could be tabbed to.\n return node.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;\n },\n });\n while (walker.nextNode()) nodes.push(walker.currentNode as HTMLElement);\n // we do not take into account the order of nodes with positive `tabIndex` as it\n // hinders accessibility to have tab order different from visual order.\n return nodes;\n}\n\nfunction focusFirst(candidates: HTMLElement[]) {\n const previouslyFocusedElement = document.activeElement;\n return candidates.some((candidate) => {\n // if focus is already where we want to go, we don't want to keep going through the candidates\n if (candidate === previouslyFocusedElement) return true;\n candidate.focus();\n return document.activeElement !== previouslyFocusedElement;\n });\n}\n\nfunction removeFromTabOrder(candidates: HTMLElement[]) {\n candidates.forEach((candidate) => {\n candidate.dataset.tabindex = candidate.getAttribute('tabindex') || '';\n candidate.setAttribute('tabindex', '-1');\n });\n return () => {\n candidates.forEach((candidate) => {\n const prevTabIndex = candidate.dataset.tabindex as string;\n candidate.setAttribute('tabindex', prevTabIndex);\n });\n };\n}\n\nfunction useResizeObserver(element: HTMLElement | null, onResize: () => void) {\n const handleResize = useCallbackRef(onResize);\n useLayoutEffect(() => {\n let rAF = 0;\n if (element) {\n /**\n * Resize Observer will throw an often benign error that says `ResizeObserver loop\n * completed with undelivered notifications`. This means that ResizeObserver was not\n * able to deliver all observations within a single animation frame, so we use\n * `requestAnimationFrame` to ensure we don't deliver unnecessary observations.\n * Further reading: https://github.com/WICG/resize-observer/issues/38\n */\n const resizeObserver = new ResizeObserver(() => {\n cancelAnimationFrame(rAF);\n rAF = window.requestAnimationFrame(handleResize);\n });\n resizeObserver.observe(element);\n return () => {\n window.cancelAnimationFrame(rAF);\n resizeObserver.unobserve(element);\n };\n }\n }, [element, handleResize]);\n}\n\nfunction getOpenState(open: boolean) {\n return open ? 'open' : 'closed';\n}\n\nfunction makeTriggerId(baseId: string, value: string) {\n return `${baseId}-trigger-${value}`;\n}\n\nfunction makeContentId(baseId: string, value: string) {\n return `${baseId}-content-${value}`;\n}\n\nfunction whenMouse<E>(handler: React.PointerEventHandler<E>): React.PointerEventHandler<E> {\n return (event) => (event.pointerType === 'mouse' ? handler(event) : undefined);\n}\n\n/* -----------------------------------------------------------------------------------------------*/\n\nexport {\n createNavigationMenuScope,\n //\n NavigationMenu,\n NavigationMenuSub,\n NavigationMenuList,\n NavigationMenuItem,\n NavigationMenuTrigger,\n NavigationMenuLink,\n NavigationMenuIndicator,\n NavigationMenuContent,\n NavigationMenuViewport,\n //\n NavigationMenu as Root,\n NavigationMenuSub as Sub,\n NavigationMenuList as List,\n NavigationMenuItem as Item,\n NavigationMenuTrigger as Trigger,\n NavigationMenuLink as Link,\n NavigationMenuIndicator as Indicator,\n NavigationMenuContent as Content,\n NavigationMenuViewport as Viewport,\n};\nexport type {\n NavigationMenuProps,\n NavigationMenuSubProps,\n NavigationMenuListProps,\n NavigationMenuItemProps,\n NavigationMenuTriggerProps,\n NavigationMenuLinkProps,\n NavigationMenuIndicatorProps,\n NavigationMenuContentProps,\n NavigationMenuViewportProps,\n};\n"],
5
+ "mappings": ";;;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qBAAe,QAAQ,OAAO;AAC9B,aAAO,MAAM;AACX,eAAO,qBAAqB,GAAG;AAC/B,uBAAe,UAAU,OAAO;AAAA,MAClC;AAAA,IACF;AAAA,EACF,GAAG,CAAC,SAAS,YAAY,CAAC;AAC5B;AAvBS;AAyBT,SAAS,aAAa,MAAe;AACnC,SAAO,OAAO,SAAS;AACzB;AAFS;AAIT,SAAS,cAAc,QAAgB,OAAe;AACpD,SAAO,GAAG,MAAM,YAAY,KAAK;AACnC;AAFS;AAIT,SAAS,cAAc,QAAgB,OAAe;AACpD,SAAO,GAAG,MAAM,YAAY,KAAK;AACnC;AAFS;AAIT,SAAS,UAAa,SAAqE;AACzF,SAAO,CAAC,UAAW,MAAM,gBAAgB,UAAU,QAAQ,KAAK,IAAI;AACtE;AAFS;",
6
+ "names": ["NavigationMenu", "value", "NavigationMenuSub", "NavigationMenuList", "NavigationMenuItem", "NavigationMenuTrigger", "NavigationMenuLink", "event", "NavigationMenuIndicator", "NavigationMenuIndicatorImpl", "NavigationMenuContent", "ViewportContentMounter", "NavigationMenuContentImpl", "NavigationMenuViewport", "NavigationMenuViewportImpl", "props", "FocusGroup", "FocusGroupItem"]
7
7
  }
package/dist/index.mjs CHANGED
@@ -20,6 +20,18 @@ import { useLayoutEffect } from "@radix-ui/react-use-layout-effect";
20
20
  import { useCallbackRef } from "@radix-ui/react-use-callback-ref";
21
21
  import * as VisuallyHiddenPrimitive from "@radix-ui/react-visually-hidden";
22
22
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
23
+ var ActivationMode = {
24
+ Automatic: "automatic",
25
+ Manual: "manual"
26
+ };
27
+ var Orientation = {
28
+ Vertical: "vertical",
29
+ Horizontal: "horizontal"
30
+ };
31
+ var Direction = {
32
+ LTR: "ltr",
33
+ RTL: "rtl"
34
+ };
23
35
  var NAVIGATION_MENU_NAME = "NavigationMenu";
24
36
  var [Collection, useCollection, createCollectionScope] = createCollection(NAVIGATION_MENU_NAME);
25
37
  var [FocusGroupCollection, useFocusGroupCollection, createFocusGroupCollectionScope] = createCollection(NAVIGATION_MENU_NAME);
@@ -38,8 +50,9 @@ var NavigationMenu = /* @__PURE__ */ React.forwardRef(
38
50
  defaultValue,
39
51
  delayDuration = 200,
40
52
  skipDelayDuration = 300,
41
- orientation = "horizontal",
53
+ orientation = Orientation.Horizontal,
42
54
  dir,
55
+ activationMode = ActivationMode.Automatic,
43
56
  ...NavigationMenuProps
44
57
  } = props;
45
58
  const [navigationMenu, setNavigationMenu] = React.useState(null);
@@ -109,18 +122,34 @@ var NavigationMenu = /* @__PURE__ */ React.forwardRef(
109
122
  value,
110
123
  dir: direction,
111
124
  orientation,
125
+ activationMode,
112
126
  rootNavigationMenu: navigationMenu,
113
127
  onTriggerEnter: (itemValue) => {
114
- window.clearTimeout(openTimerRef.current);
115
- if (isOpenDelayed) handleDelayedOpen(itemValue);
116
- else handleOpen(itemValue);
128
+ if (activationMode === ActivationMode.Automatic) {
129
+ window.clearTimeout(openTimerRef.current);
130
+ if (isOpenDelayed) {
131
+ handleDelayedOpen(itemValue);
132
+ } else {
133
+ handleOpen(itemValue);
134
+ }
135
+ }
117
136
  },
118
137
  onTriggerLeave: () => {
119
- window.clearTimeout(openTimerRef.current);
120
- startCloseTimer();
138
+ if (activationMode === ActivationMode.Automatic) {
139
+ window.clearTimeout(openTimerRef.current);
140
+ startCloseTimer();
141
+ }
142
+ },
143
+ onContentEnter: () => {
144
+ if (activationMode === ActivationMode.Automatic) {
145
+ window.clearTimeout(closeTimerRef.current);
146
+ }
147
+ },
148
+ onContentLeave: () => {
149
+ if (activationMode === ActivationMode.Automatic) {
150
+ startCloseTimer();
151
+ }
121
152
  },
122
- onContentEnter: () => window.clearTimeout(closeTimerRef.current),
123
- onContentLeave: startCloseTimer,
124
153
  onItemSelect: (itemValue) => {
125
154
  setValue((prevValue) => prevValue === itemValue ? "" : itemValue);
126
155
  },
@@ -148,10 +177,13 @@ var NavigationMenuSub = /* @__PURE__ */ React.forwardRef(
148
177
  value: valueProp,
149
178
  onValueChange,
150
179
  defaultValue,
151
- orientation = "horizontal",
180
+ orientation = Orientation.Horizontal,
181
+ activationMode: activationModeProp,
182
+ disableToggle = true,
152
183
  ...subProps
153
184
  } = props;
154
185
  const context = useNavigationMenuContext(SUB_NAME, __scopeNavigationMenu);
186
+ const activationMode = activationModeProp ?? context.activationMode;
155
187
  const [value, setValue] = useControllableState({
156
188
  prop: valueProp,
157
189
  onChange: onValueChange,
@@ -166,9 +198,16 @@ var NavigationMenuSub = /* @__PURE__ */ React.forwardRef(
166
198
  value,
167
199
  dir: context.dir,
168
200
  orientation,
201
+ activationMode,
169
202
  rootNavigationMenu: context.rootNavigationMenu,
170
- onTriggerEnter: (itemValue) => setValue(itemValue),
171
- onItemSelect: (itemValue) => setValue(itemValue),
203
+ onTriggerEnter: (itemValue) => {
204
+ if (activationMode === ActivationMode.Automatic) {
205
+ setValue(itemValue);
206
+ }
207
+ },
208
+ onItemSelect: (itemValue) => {
209
+ setValue((prevValue) => disableToggle || prevValue !== itemValue ? itemValue : "");
210
+ },
172
211
  onItemDismiss: () => setValue(""),
173
212
  children: /* @__PURE__ */ jsx(Primitive.div, { "data-orientation": orientation, ...subProps, ref: forwardedRef })
174
213
  }
@@ -182,6 +221,7 @@ var NavigationMenuProvider = /* @__PURE__ */ __name((props) => {
182
221
  rootNavigationMenu,
183
222
  dir,
184
223
  orientation,
224
+ activationMode,
185
225
  children,
186
226
  value,
187
227
  onItemSelect,
@@ -205,6 +245,7 @@ var NavigationMenuProvider = /* @__PURE__ */ __name((props) => {
205
245
  baseId: useId(),
206
246
  dir,
207
247
  orientation,
248
+ activationMode,
208
249
  viewport,
209
250
  onViewportChange: setViewport,
210
251
  indicatorTrack,
@@ -337,7 +378,7 @@ var NavigationMenuTrigger = /* @__PURE__ */ React.forwardRef(/* @__PURE__ */ __n
337
378
  wasClickCloseRef.current = open;
338
379
  }),
339
380
  onKeyDown: composeEventHandlers(props.onKeyDown, (event) => {
340
- const verticalEntryKey = context.dir === "rtl" ? "ArrowLeft" : "ArrowRight";
381
+ const verticalEntryKey = context.dir === Direction.RTL ? "ArrowLeft" : "ArrowRight";
341
382
  const entryKey = { horizontal: "ArrowDown", vertical: verticalEntryKey }[context.orientation];
342
383
  if (open && event.key === entryKey) {
343
384
  itemContext.onEntryKeyDown();
@@ -422,7 +463,7 @@ var NavigationMenuIndicatorImpl = /* @__PURE__ */ React.forwardRef(/* @__PURE__
422
463
  null
423
464
  );
424
465
  const [position, setPosition] = React.useState(null);
425
- const isHorizontal = context.orientation === "horizontal";
466
+ const isHorizontal = context.orientation === Orientation.Horizontal;
426
467
  const isVisible = Boolean(context.value);
427
468
  React.useEffect(() => {
428
469
  const items = getItems();
@@ -549,7 +590,7 @@ var NavigationMenuContentImpl = /* @__PURE__ */ React.forwardRef(/* @__PURE__ */
549
590
  const motionAttribute = React.useMemo(() => {
550
591
  const items = getItems();
551
592
  const values = items.map((item) => item.value);
552
- if (context.dir === "rtl") values.reverse();
593
+ if (context.dir === Direction.RTL) values.reverse();
553
594
  const index = values.indexOf(context.value);
554
595
  const prevIndex = values.indexOf(context.previousValue);
555
596
  const isSelected = value === context.value;
@@ -585,7 +626,12 @@ var NavigationMenuContentImpl = /* @__PURE__ */ React.forwardRef(/* @__PURE__ */
585
626
  onFocusOutside: composeEventHandlers(props.onFocusOutside, (event) => {
586
627
  onContentFocusOutside();
587
628
  const target = event.target;
588
- if (context.rootNavigationMenu?.contains(target)) event.preventDefault();
629
+ const relatedTarget = event.detail.originalEvent.relatedTarget;
630
+ const focusMovedIntoMenu = context.rootNavigationMenu?.contains(target);
631
+ const focusCameFromMenu = context.rootNavigationMenu?.contains(relatedTarget);
632
+ if (focusMovedIntoMenu || !focusCameFromMenu) {
633
+ event.preventDefault();
634
+ }
589
635
  }),
590
636
  onPointerDownOutside: composeEventHandlers(props.onPointerDownOutside, (event) => {
591
637
  const target = event.target;
@@ -712,7 +758,7 @@ var FocusGroupItem = /* @__PURE__ */ React.forwardRef(
712
758
  const isFocusNavigationKey = ["Home", "End", ...ARROW_KEYS].includes(event.key);
713
759
  if (isFocusNavigationKey) {
714
760
  let candidateNodes = getItems().map((item) => item.ref.current);
715
- const prevItemKey = context.dir === "rtl" ? "ArrowRight" : "ArrowLeft";
761
+ const prevItemKey = context.dir === Direction.RTL ? "ArrowRight" : "ArrowLeft";
716
762
  const prevKeys = [prevItemKey, "ArrowUp", "End"];
717
763
  if (prevKeys.includes(event.key)) candidateNodes.reverse();
718
764
  if (ARROW_KEYS.includes(event.key)) {
@@ -796,21 +842,12 @@ function whenMouse(handler) {
796
842
  return (event) => event.pointerType === "mouse" ? handler(event) : void 0;
797
843
  }
798
844
  __name(whenMouse, "whenMouse");
799
- var Root2 = NavigationMenu;
800
- var Sub = NavigationMenuSub;
801
- var List = NavigationMenuList;
802
- var Item = NavigationMenuItem;
803
- var Trigger = NavigationMenuTrigger;
804
- var Link = NavigationMenuLink;
805
- var Indicator = NavigationMenuIndicator;
806
- var Content = NavigationMenuContent;
807
- var Viewport = NavigationMenuViewport;
808
845
  export {
809
- Content,
810
- Indicator,
811
- Item,
812
- Link,
813
- List,
846
+ NavigationMenuContent as Content,
847
+ NavigationMenuIndicator as Indicator,
848
+ NavigationMenuItem as Item,
849
+ NavigationMenuLink as Link,
850
+ NavigationMenuList as List,
814
851
  NavigationMenu,
815
852
  NavigationMenuContent,
816
853
  NavigationMenuIndicator,
@@ -820,10 +857,10 @@ export {
820
857
  NavigationMenuSub,
821
858
  NavigationMenuTrigger,
822
859
  NavigationMenuViewport,
823
- Root2 as Root,
824
- Sub,
825
- Trigger,
826
- Viewport,
860
+ NavigationMenu as Root,
861
+ NavigationMenuSub as Sub,
862
+ NavigationMenuTrigger as Trigger,
863
+ NavigationMenuViewport as Viewport,
827
864
  createNavigationMenuScope
828
865
  };
829
866
  //# sourceMappingURL=index.mjs.map