'use client' import * as React from 'react' import { Menubar as BaseMenubar } from '@base-ui/react/menubar' import { cn } from '../../internal/utils' import { navigationLinkVariants } from '../navigation/navigation-link-variants' import { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuGroupLabel, DropdownMenuItem, DropdownMenuLinkItem, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, } from '../dropdown-menu/dropdown-menu' type MenubarVariant = 'pill' | 'line' type MenubarSize = 'sm' | 'md' | 'lg' type MenubarOrientation = 'horizontal' | 'vertical' interface MenubarContextValue { variant: MenubarVariant size: MenubarSize orientation: MenubarOrientation } const MenubarContext = React.createContext(null) function useMenubarContext() { const ctx = React.useContext(MenubarContext) if (!ctx) { throw new Error('Menubar sub-components must be rendered inside ') } return ctx } type BaseMenubarRootProps = React.ComponentProps interface MenubarProps extends BaseMenubarRootProps { /** * Trigger appearance - hover/active pill, or an animated underline. * @default 'pill' */ variant?: MenubarVariant /** * Scales the triggers, popups, and items together. * @default 'md' */ size?: MenubarSize } const HORIZONTAL_GAP: Partial> = { pill: 'gap-0.5', line: 'gap-7', } const VERTICAL_GAP: Partial> = { pill: 'gap-0.5', } function Menubar({ className, variant = 'pill', size = 'md', orientation = 'horizontal', children, ...rest }: MenubarProps) { const ctx = React.useMemo(() => ({ variant, size, orientation }), [variant, size, orientation]) const gap = (orientation === 'vertical' ? VERTICAL_GAP : HORIZONTAL_GAP)[variant] return ( {children} ) } type DropdownMenuRootProps = React.ComponentProps interface MenubarMenuProps extends Omit {} function MenubarMenu(props: MenubarMenuProps) { const { size } = useMenubarContext() return } type MenubarTriggerProps = React.ComponentProps function MenubarTrigger({ className, ...props }: MenubarTriggerProps) { const { variant, size, orientation } = useMenubarContext() return ( ) } type MenubarContentProps = React.ComponentProps function MenubarContent({ side, align, ...props }: MenubarContentProps) { const ctx = useMenubarContext() const vertical = ctx.orientation === 'vertical' return ( ) } type MenubarItemProps = React.ComponentProps function MenubarItem(props: MenubarItemProps) { return } type MenubarLinkItemProps = React.ComponentProps function MenubarLinkItem(props: MenubarLinkItemProps) { return } type MenubarGroupProps = React.ComponentProps function MenubarGroup(props: MenubarGroupProps) { return } type MenubarGroupLabelProps = React.ComponentProps function MenubarGroupLabel(props: MenubarGroupLabelProps) { return } type MenubarRadioGroupProps = React.ComponentProps function MenubarRadioGroup(props: MenubarRadioGroupProps) { return } type MenubarRadioItemProps = React.ComponentProps function MenubarRadioItem(props: MenubarRadioItemProps) { return } type MenubarCheckboxItemProps = React.ComponentProps function MenubarCheckboxItem(props: MenubarCheckboxItemProps) { return } type MenubarSeparatorProps = React.ComponentProps function MenubarSeparator(props: MenubarSeparatorProps) { return } type MenubarSubProps = React.ComponentProps function MenubarSub(props: MenubarSubProps) { return } type MenubarSubTriggerProps = React.ComponentProps function MenubarSubTrigger(props: MenubarSubTriggerProps) { return } type MenubarSubContentProps = React.ComponentProps function MenubarSubContent(props: MenubarSubContentProps) { return } export { Menubar, MenubarMenu, MenubarTrigger, MenubarContent, MenubarItem, MenubarLinkItem, MenubarGroup, MenubarGroupLabel, MenubarRadioGroup, MenubarRadioItem, MenubarCheckboxItem, MenubarSeparator, MenubarSub, MenubarSubTrigger, MenubarSubContent, } export type { MenubarProps, MenubarMenuProps, MenubarTriggerProps, MenubarContentProps, MenubarItemProps, MenubarLinkItemProps, MenubarGroupProps, MenubarGroupLabelProps, MenubarRadioGroupProps, MenubarRadioItemProps, MenubarCheckboxItemProps, MenubarSeparatorProps, MenubarSubProps, MenubarSubTriggerProps, MenubarSubContentProps, }