/** * Copyright (c) Paymium. * * This source code is licensed under the MIT license found in the * LICENSE file in the root of this projects source tree. */ import { composeEventHandlers, withStaticProperties } from '@crossed/core'; import { CrossedMethods } from '@crossed/styled'; import { Popover, useFloatingContext } from '../overlay'; import { ComponentProps, memo, PropsWithChildren } from 'react'; import { MenuList } from './MenuList'; import { Divider as D, DividerProps } from '../layout/Divider'; import { useMedia } from '../useMedia'; type RootProps = ComponentProps; const DropDownRoot = memo( ({ children, placement = 'bottom-end', triggerStrategy = 'onPress', ...props }: RootProps) => { return ( {children} ); } ); type TooltipTriggerProps = ComponentProps; const DropDowmMenuTrigger = ({ ...props }: TooltipTriggerProps) => { return ; }; type ContentProps = PropsWithChildren<{ style?: CrossedMethods }>; const DropDownMenuContent = ({ children, style }: ContentProps) => { const { md } = useMedia(); return ( {children} ); }; type ItemProps = ComponentProps & { onPress?: () => void; }; const DropDownMenuItem = ({ children, onPress, ...props }: ItemProps) => { const { onClose } = useFloatingContext(); return ( {children} ); }; type LabelProps = ComponentProps; const DropDownMenuItemLabel = ({ children, ...props }: LabelProps) => { return {children}; }; type TitleProps = ComponentProps; const DropDownMenuItemTitle = ({ children, ...props }: TitleProps) => { return {children}; }; const DropDownMenuDivider = (props: DividerProps) => ; export const DropDownMenu = withStaticProperties(DropDownRoot, { Trigger: DropDowmMenuTrigger, Content: DropDownMenuContent, Item: DropDownMenuItem, Label: DropDownMenuItemLabel, Title: DropDownMenuItemTitle, Divider: DropDownMenuDivider, });