{"version":3,"file":"ComboboxDropdownTarget.cjs","names":["factory","useProps","isElement","Popover"],"sources":["../../../../src/components/Combobox/ComboboxDropdownTarget/ComboboxDropdownTarget.tsx"],"sourcesContent":["import { factory, Factory, isElement, useProps } from '../../../core';\nimport { Popover } from '../../Popover';\nimport { useComboboxContext } from '../Combobox.context';\n\nexport interface ComboboxDropdownTargetProps {\n  ref?: React.RefObject<HTMLElement>;\n\n  /** Target element */\n  children: React.ReactNode;\n\n  /** Key of the prop that should be used to access element ref */\n  refProp?: string;\n}\n\nconst defaultProps = {\n  refProp: 'ref',\n} satisfies Partial<ComboboxDropdownTargetProps>;\n\nexport type ComboboxDropdownTargetFactory = Factory<{\n  props: ComboboxDropdownTargetProps;\n  ref: HTMLElement;\n  compound: true;\n}>;\n\nexport const ComboboxDropdownTarget = factory<ComboboxDropdownTargetFactory>((props) => {\n  const { children, refProp, ref } = useProps('ComboboxDropdownTarget', defaultProps, props);\n\n  // Context not used, just to throw error if used outside of Combobox\n  useComboboxContext();\n\n  if (!isElement(children)) {\n    throw new Error(\n      'Combobox.DropdownTarget 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  return (\n    <Popover.Target ref={ref} refProp={refProp}>\n      {children}\n    </Popover.Target>\n  );\n});\n\nComboboxDropdownTarget.displayName = '@mantine/core/ComboboxDropdownTarget';\n"],"mappings":";;;;;;;;;AAcA,MAAM,eAAe,EACnB,SAAS,OACV;AAQD,MAAa,yBAAyBA,gBAAAA,SAAwC,UAAU;CACtF,MAAM,EAAE,UAAU,SAAS,QAAQC,kBAAAA,SAAS,0BAA0B,cAAc,MAAM;AAG1F,0BAAA,oBAAoB;AAEpB,KAAI,CAACC,mBAAAA,UAAU,SAAS,CACtB,OAAM,IAAI,MACR,4KACD;AAGH,QACE,iBAAA,GAAA,kBAAA,KAACC,gBAAAA,QAAQ,QAAT;EAAqB;EAAc;EAChC;EACc,CAAA;EAEnB;AAEF,uBAAuB,cAAc"}