{"version":3,"file":"MenuSubDropdown.cjs","names":["factory","useProps","useMenuContext","SubMenuContext","Popover","classes"],"sources":["../../../../src/components/Menu/MenuSubDropdown/MenuSubDropdown.tsx"],"sourcesContent":["import { use, useRef } from 'react';\nimport { useMergedRef } from '@mantine/hooks';\nimport {\n  BoxProps,\n  CompoundStylesApiProps,\n  ElementProps,\n  factory,\n  Factory,\n  useProps,\n} from '../../../core';\nimport { Popover } from '../../Popover';\nimport { useMenuContext } from '../Menu.context';\nimport { SubMenuContext } from '../MenuSub/MenuSub.context';\nimport classes from '../Menu.module.css';\n\nexport type MenuSubDropdownStylesNames = 'dropdown';\n\nexport interface MenuSubDropdownProps\n  extends BoxProps, CompoundStylesApiProps<MenuSubDropdownFactory>, ElementProps<'div'> {}\n\nexport type MenuSubDropdownFactory = Factory<{\n  props: MenuSubDropdownProps;\n  ref: HTMLDivElement;\n  stylesNames: MenuSubDropdownStylesNames;\n  compound: true;\n}>;\n\nexport const MenuSubDropdown = factory<MenuSubDropdownFactory>((props) => {\n  const {\n    classNames,\n    className,\n    style,\n    styles,\n    vars,\n    onMouseEnter,\n    onMouseLeave,\n    onPointerEnter,\n    onPointerLeave,\n    onKeyDown,\n    children,\n    ref,\n    ...others\n  } = useProps('MenuSubDropdown', null, props);\n\n  const wrapperRef = useRef<HTMLDivElement>(null);\n  const ctx = useMenuContext();\n  const subCtx = use(SubMenuContext);\n\n  const floatingProps = subCtx?.getFloatingProps({\n    onMouseEnter,\n    onMouseLeave,\n    onPointerEnter,\n    onPointerLeave,\n  });\n\n  return (\n    <Popover.Dropdown\n      {...others}\n      {...floatingProps}\n      role=\"menu\"\n      aria-orientation=\"vertical\"\n      ref={useMergedRef(ref, wrapperRef, subCtx?.setFloating)}\n      {...ctx.getStyles('dropdown', {\n        className,\n        style,\n        styles,\n        classNames,\n        withStaticClass: false,\n      })}\n      tabIndex={-1}\n      data-menu-dropdown\n    >\n      {children}\n    </Popover.Dropdown>\n  );\n});\n\nMenuSubDropdown.classes = classes;\nMenuSubDropdown.displayName = '@mantine/core/MenuSubDropdown';\n"],"mappings":";;;;;;;;;;;;AA2BA,MAAa,kBAAkBA,gBAAAA,SAAiC,UAAU;CACxE,MAAM,EACJ,YACA,WACA,OACA,QACA,MACA,cACA,cACA,gBACA,gBACA,WACA,UACA,KACA,GAAG,WACDC,kBAAAA,SAAS,mBAAmB,MAAM,KAAK;CAE3C,MAAM,cAAA,GAAA,MAAA,QAAoC,IAAI;CAC9C,MAAM,MAAMC,qBAAAA,eAAe;CAC3B,MAAM,UAAA,GAAA,MAAA,KAAaC,wBAAAA,cAAc;CAEjC,MAAM,gBAAgB,QAAQ,iBAAiB;EAC7C;EACA;EACA;EACA;CACF,CAAC;CAED,OACE,iBAAA,GAAA,kBAAA,KAACC,gBAAAA,QAAQ,UAAT;EACE,GAAI;EACJ,GAAI;EACJ,MAAK;EACL,oBAAiB;EACjB,MAAA,GAAA,eAAA,cAAkB,KAAK,YAAY,QAAQ,WAAW;EACtD,GAAI,IAAI,UAAU,YAAY;GAC5B;GACA;GACA;GACA;GACA,iBAAiB;EACnB,CAAC;EACD,UAAU;EACV,sBAAA;EAEC;CACe,CAAA;AAEtB,CAAC;AAED,gBAAgB,UAAUC,oBAAAA;AAC1B,gBAAgB,cAAc"}