@mantine/core
Version:
React components library focused on usability, accessibility and developer experience
1 lines • 1.25 kB
Source Map (JSON)
{"version":3,"file":"MenuSubTarget.cjs","names":["isElement","Popover"],"sources":["../../../../src/components/Menu/MenuSubTarget/MenuSubTarget.tsx"],"sourcesContent":["import { isElement } from '../../../core';\nimport { Popover } from '../../Popover';\nimport { useMenuContext } from '../Menu.context';\n\nexport interface MenuSubTargetProps {\n /** Target element */\n children: React.ReactNode;\n\n /** Key of the prop used to get element ref @default 'ref' */\n refProp?: string;\n}\n\nexport function MenuSubTarget({ children, refProp }: MenuSubTargetProps) {\n if (!isElement(children)) {\n throw new Error(\n 'Menu.Sub.Target component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported'\n );\n }\n\n useMenuContext();\n\n return (\n <Popover.Target refProp={refProp} popupType=\"menu\">\n {children}\n </Popover.Target>\n );\n}\n\nMenuSubTarget.displayName = '@mantine/core/MenuSubTarget';\n"],"mappings":";;;;;;;AAYA,SAAgB,cAAc,EAAE,UAAU,WAA+B;AACvE,KAAI,CAACA,mBAAAA,UAAU,SAAS,CACtB,OAAM,IAAI,MACR,oKACD;AAGH,sBAAA,gBAAgB;AAEhB,QACE,iBAAA,GAAA,kBAAA,KAACC,gBAAAA,QAAQ,QAAT;EAAyB;EAAS,WAAU;EACzC;EACc,CAAA;;AAIrB,cAAc,cAAc"}