// // Copyright 2022 DXOS.org // import { Primitive } from '@radix-ui/react-primitive'; import { Slot } from '@radix-ui/react-slot'; import React, { type ComponentPropsWithRef, forwardRef } from 'react'; import { useThemeContext } from '../../hooks'; import { type ThemedClassName } from '../../util'; type AnchoredOverflowRootProps = ThemedClassName> & { asChild?: boolean; }; const AnchoredOverflowRoot = forwardRef( ({ asChild, classNames, children, ...props }, forwardedRef) => { const { tx } = useThemeContext(); const Root = asChild ? Slot : Primitive.div; return ( {children} ); }, ); type AnchoredOverflowAnchorProps = ThemedClassName> & { asChild?: boolean; }; const AnchoredOverflowAnchor = forwardRef( ({ asChild, classNames, children, ...props }, forwardedRef) => { const { tx } = useThemeContext(); const Root = asChild ? Slot : Primitive.div; return ( {children} ); }, ); export const AnchoredOverflow = { Root: AnchoredOverflowRoot, Anchor: AnchoredOverflowAnchor, }; export type { AnchoredOverflowRootProps, AnchoredOverflowAnchorProps };