import type { CSSProperties } from "react"; import type { CommonProps } from "../../utils/common-props"; import { usePopoverContext } from "./use-popover-context"; import { FloatingArrow, FloatingFocusManager, FloatingPortal, } from "@floating-ui/react"; import { useThemeContext } from "../theme/use-theme-context"; import { mergeClass } from "../../styles/utils/merge-class"; import { brandRecipe } from "../../styles/recipes/brand-recipe"; import { containerRecipe } from "../../styles/recipes/container-recipe"; export type PopoverDropdownProps = CommonProps; export const PopoverDropdown = (props: PopoverDropdownProps) => { const { children, className = "", style, ...rest } = props; const { refs, floatingStyles, getFloatingProps, context, arrowRef, isMounted, transitionStyles, arrowWidth, arrowHeight, } = usePopoverContext()!; const { themeClass, themeBaseClass } = useThemeContext()!; const rootClass = mergeClass( "text--md", containerRecipe({ boxShadow: true, rounded: 8, padding: 12, background: "base", hasFocusOutline: "false", }), brandRecipe(), themeBaseClass, themeClass, className, ); const rootStyle: CSSProperties = { ...transitionStyles, ...floatingStyles, ...style, }; const arrowStyle: CSSProperties = { fill: "var(--base-background)", }; return ( <> {isMounted && (
{children}
)} ); };