// @ts-nocheck
/* eslint-disable import/no-extraneous-dependencies */
/* eslint-disable global-require */
import { ComponentPropsWithRef, ElementType, ReactNode, Ref, useRef } from "react";
import { motion } from "framer-motion"
import Lottie from "lottie-react"
import { twMerge } from "tailwind-merge";
export type MenuProps = {
children: ReactNode;
className?: string;
};
export const Menu = ({ children, className }: MenuProps): JSX.Element => {
return
;
};
export type MenuItemProps = {
// Kudos to https://itnext.io/react-polymorphic-components-with-typescript-f7ce72ea7af2
as?: T;
children: ReactNode;
icon?: string;
description?: ReactNode;
isDisabled?: boolean;
isSelected?: boolean;
className?: string;
inputRef?: Ref;
};
export const MenuItem = ({
children,
icon,
className,
isDisabled,
isSelected,
as: Item = "button",
description,
// wrapping in forward ref with generic component causes the loss of ts definitions on props
inputRef,
...props
}: MenuItemProps & ComponentPropsWithRef): JSX.Element => {
const iconRef = useRef()
return(
iconRef.current?.play()}
onMouseLeave={() => iconRef.current?.stop()}
>
-
{/* {icon && {icon}} */}
{children}
{description && {description}}
)
};
export const SubMenuItem = ({
children,
icon,
className,
isDisabled,
isSelected,
as: Item = "button",
description,
// wrapping in forward ref with generic component causes the loss of ts definitions on props
inputRef,
...props
}: MenuItemProps & ComponentPropsWithRef): JSX.Element => {
const iconRef = useRef()
return(
iconRef.current?.play()}
onMouseLeave={() => iconRef.current?.stop()}
>
-
{children}
{description && {description}}
)
};
MenuItem.displayName = "MenuItem";
export type MenuGroupProps = {
children: ReactNode;
title: ReactNode;
};
export const MenuGroup = ({ children, title }: MenuGroupProps): JSX.Element => (
<>
{title}
{children}
>
);