{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "extends": "none",
  "name": "menu",
  "title": "menu",
  "description": "menu",
  "dependencies": [
    "@heroicons/react",
    "react-aria-components",
    "tailwind-merge",
    "tailwind-variants"
  ],
  "registryDependencies": [
    "https://intentui.com/r/primitive",
    "https://intentui.com/r/dropdown",
    "https://intentui.com/r/popover"
  ],
  "files": [
    {
      "path": "src/components/ui/menu.tsx",
      "content": "'use client'\n\nimport { CheckIcon, ChevronRightIcon } from '@heroicons/react/20/solid'\nimport { Button, type ButtonProps } from 'react-aria-components/Button'\nimport { Collection } from 'react-aria-components/Collection'\nimport { composeRenderProps } from 'react-aria-components/composeRenderProps'\nimport { Header } from 'react-aria-components/Header'\nimport type {\n  MenuItemProps as MenuItemPrimitiveProps,\n  MenuProps as MenuPrimitiveProps,\n  MenuSectionProps as MenuSectionPrimitiveProps,\n  MenuTriggerProps as MenuTriggerPrimitiveProps,\n} from 'react-aria-components/Menu'\nimport {\n  Menu as MenuPrimitive,\n  MenuItem as MenuItemPrimitive,\n  MenuSection as MenuSectionPrimitive,\n  MenuTrigger as MenuTriggerPrimitive,\n  SubmenuTrigger as SubmenuTriggerPrimitive,\n} from 'react-aria-components/Menu'\nimport { twMerge } from 'tailwind-merge'\nimport { tv, type VariantProps } from 'tailwind-variants'\nimport { cx } from '@/lib/primitive'\nimport {\n  DropdownDescription,\n  dropdownItemStyles,\n  DropdownKeyboard,\n  DropdownLabel,\n  dropdownSectionStyles,\n  DropdownSeparator,\n} from './dropdown'\nimport { PopoverContent, type PopoverContentProps } from './popover'\n\nconst Menu = (props: MenuTriggerPrimitiveProps) => <MenuTriggerPrimitive {...props} />\n\nconst MenuSubMenu = ({ delay = 0, ...props }) => (\n  <SubmenuTriggerPrimitive {...props} delay={delay}>\n    {props.children}\n  </SubmenuTriggerPrimitive>\n)\n\ninterface MenuTriggerProps extends ButtonProps {\n  ref?: React.Ref<HTMLButtonElement>\n}\n\nconst MenuTrigger = ({ className, ref, ...props }: MenuTriggerProps) => (\n  <Button\n    ref={ref}\n    data-slot=\"menu-trigger\"\n    className={cx(\n      'relative inline text-start outline-hidden focus-visible:ring-1 focus-visible:ring-primary',\n      '*:data-[slot=chevron]:size-5 sm:*:data-[slot=chevron]:size-4',\n      className\n    )}\n    {...props}\n  />\n)\n\ninterface MenuContentProps<T>\n  extends MenuPrimitiveProps<T>, Pick<PopoverContentProps, 'placement'> {\n  className?: string\n  popover?: Pick<\n    PopoverContentProps,\n    | 'arrow'\n    | 'className'\n    | 'placement'\n    | 'offset'\n    | 'crossOffset'\n    | 'arrowBoundaryOffset'\n    | 'triggerRef'\n    | 'isOpen'\n    | 'onOpenChange'\n    | 'shouldFlip'\n    | 'isNonModal'\n    | 'trigger'\n    | 'getTargetRect'\n  >\n}\n\nconst menuContentStyles = tv({\n  base: \"grid max-h-[inherit] grid-cols-[auto_minmax(0,1fr)] gap-y-1 overflow-y-auto overflow-x-hidden overscroll-contain p-1 outline-hidden [clip-path:inset(0_0_0_0_round_calc(var(--radius-xl)-(--spacing(1))))] [&>[data-slot=menu-section]+[data-slot=menu-section]:not([class*='mt-']):not([class*='my-'])]:mt-3\",\n})\n\nconst MenuContent = <T extends object>({\n  className,\n  placement,\n  popover,\n  ...props\n}: MenuContentProps<T>) => {\n  return (\n    <PopoverContent\n      className={cx('min-w-32 *:data-[slot=popover-inner]:overflow-hidden', popover?.className)}\n      placement={placement}\n      {...popover}\n    >\n      <MenuPrimitive\n        data-slot=\"menu-content\"\n        className={menuContentStyles({ className })}\n        {...props}\n      />\n    </PopoverContent>\n  )\n}\n\ninterface MenuItemProps extends MenuItemPrimitiveProps, VariantProps<typeof dropdownItemStyles> {}\n\nconst MenuItem = ({ className, intent, children, ...props }: MenuItemProps) => {\n  const textValue = props.textValue || (typeof children === 'string' ? children : undefined)\n  return (\n    <MenuItemPrimitive\n      data-slot=\"menu-item\"\n      className={composeRenderProps(className, (className, { hasSubmenu, ...renderProps }) =>\n        dropdownItemStyles({\n          ...renderProps,\n          intent,\n          className: hasSubmenu\n            ? twMerge(\n                intent === 'danger' && 'open:bg-danger-subtle open:text-danger-subtle-fg',\n                intent === 'warning' && 'open:bg-warning-subtle open:text-warning-subtle-fg',\n                intent === undefined &&\n                  'open:bg-accent open:text-accent-fg open:*:[.text-muted-fg]:text-accent-fg open:*:[svg]:text-accent-fg',\n                className\n              )\n            : className,\n        })\n      )}\n      textValue={textValue}\n      {...props}\n    >\n      {(values) => (\n        <>\n          {values.isSelected && ['single', 'multiple'].includes(values.selectionMode) && (\n            <CheckIcon />\n          )}\n\n          {typeof children === 'function' ? children(values) : children}\n\n          {values.hasSubmenu && (\n            <ChevronRightIcon\n              data-slot=\"chevron\"\n              className=\"absolute end-0 size-4 -translate-y-1/2\"\n              style={{\n                top: 'calc(var(--spacing) * 3)',\n              }}\n            />\n          )}\n        </>\n      )}\n    </MenuItemPrimitive>\n  )\n}\n\nexport interface MenuHeaderProps extends React.ComponentProps<typeof Header> {\n  separator?: boolean\n}\n\nconst MenuHeader = ({ className, separator = false, ...props }: MenuHeaderProps) => (\n  <Header\n    className={twMerge(\n      'col-span-full px-2.5 py-2 font-medium text-base sm:text-sm',\n      separator && '-mx-1 border-b sm:px-3 sm:pb-2.5',\n      className\n    )}\n    {...props}\n  />\n)\n\nconst { section, header } = dropdownSectionStyles()\n\ninterface MenuSectionProps<T> extends MenuSectionPrimitiveProps<T> {\n  ref?: React.Ref<HTMLDivElement>\n  label?: string\n}\n\nconst MenuSection = <T extends object>({\n  className,\n  children,\n  ref,\n  ...props\n}: MenuSectionProps<T>) => {\n  return (\n    <MenuSectionPrimitive\n      data-slot=\"menu-section\"\n      ref={ref}\n      className={section({ className })}\n      {...props}\n    >\n      {'label' in props && <Header className={header()}>{props.label}</Header>}\n      <Collection items={props.items}>{children}</Collection>\n    </MenuSectionPrimitive>\n  )\n}\n\nconst MenuSeparator = DropdownSeparator\nconst MenuShortcut = DropdownKeyboard\nconst MenuLabel = DropdownLabel\nconst MenuDescription = DropdownDescription\n\nexport type { MenuContentProps, MenuItemProps, MenuSectionProps, MenuTriggerProps }\nexport {\n  Menu,\n  MenuContent,\n  MenuDescription,\n  MenuHeader,\n  MenuItem,\n  MenuLabel,\n  MenuSection,\n  MenuSeparator,\n  MenuShortcut,\n  MenuSubMenu,\n  MenuTrigger,\n  menuContentStyles,\n}\n",
      "type": "registry:ui"
    }
  ],
  "type": "registry:ui"
}