@yamada-ui/popover
Version:
Yamada UI popover component
1 lines • 977 B
Source Map (JSON)
{"version":3,"sources":["../src/popover-anchor.tsx"],"sourcesContent":["import type { FC } from \"@yamada-ui/core\"\nimport type { PropsWithChildren, ReactElement, RefObject } from \"react\"\nimport { getRef } from \"@yamada-ui/utils\"\nimport { Children, cloneElement } from \"react\"\nimport { usePopover } from \"./popover\"\n\nexport const PopoverAnchor: FC<PropsWithChildren<{}>> = ({ children }) => {\n const child = Children.only(children) as {\n ref: RefObject<any>\n } & ReactElement\n const { getAnchorProps } = usePopover()\n\n return cloneElement(child, getAnchorProps(child.props, getRef(child)))\n}\n\nPopoverAnchor.displayName = \"PopoverAnchor\"\nPopoverAnchor.__ui__ = \"PopoverAnchor\"\n"],"mappings":";;;;;;AAEA,SAAS,cAAc;AACvB,SAAS,UAAU,oBAAoB;AAGhC,IAAM,gBAA2C,CAAC,EAAE,SAAS,MAAM;AACxE,QAAM,QAAQ,SAAS,KAAK,QAAQ;AAGpC,QAAM,EAAE,eAAe,IAAI,WAAW;AAEtC,SAAO,aAAa,OAAO,eAAe,MAAM,OAAO,OAAO,KAAK,CAAC,CAAC;AACvE;AAEA,cAAc,cAAc;AAC5B,cAAc,SAAS;","names":[]}