import React, { forwardRef } from 'react'
import {
Dropdown as BS5Dropdown,
DropdownToggle as BS5DropdownToggle,
DropdownMenu as BS5DropdownMenu,
DropdownItem as BS5DropdownItem,
DropdownDivider as BS5DropdownDivider,
DropdownHeader as BS5DropdownHeader,
Button as BS5Button,
type ButtonProps,
} from 'react-bootstrap-5'
import type {
DropdownProps,
DropdownItemProps,
DropdownToggleProps,
DropdownMenuProps,
DropdownDividerProps,
DropdownHeaderProps,
} from '@/features/ui/components/types/dropdown-menu-props'
import MaterialIcon from '@/shared/components/material-icon'
import { fixedForwardRef } from '@/utils/react'
import classnames from 'classnames'
export function Dropdown({ ...props }: DropdownProps) {
return
}
function DropdownItem(
{
active,
children,
className,
description,
leadingIcon,
trailingIcon,
...props
}: DropdownItemProps,
ref: React.ForwardedRef
) {
let leadingIconComponent = null
if (leadingIcon) {
if (typeof leadingIcon === 'string') {
leadingIconComponent = (
)
} else {
leadingIconComponent = (
{leadingIcon}
)
}
}
let trailingIconComponent = null
if (trailingIcon) {
if (typeof trailingIcon === 'string') {
const trailingIconType = active ? 'check' : trailingIcon
trailingIconComponent = (
)
} else {
trailingIconComponent = (
{trailingIcon}
)
}
}
return (
{leadingIconComponent}
{children}
{trailingIconComponent}
{description && (
{description}
)}
)
}
function EmptyLeadingIcon() {
return
}
const ForwardReferredDropdownItem = fixedForwardRef(DropdownItem, {
EmptyLeadingIcon,
})
export { ForwardReferredDropdownItem as DropdownItem }
export const DropdownToggleCustom = forwardRef(
({ children, className, ...props }, ref) => (
{children}
)
)
DropdownToggleCustom.displayName = 'CustomCaret'
export const DropdownToggle = forwardRef<
typeof BS5DropdownToggle,
DropdownToggleProps
>((props, ref) => )
DropdownToggle.displayName = 'DropdownToggle'
export const DropdownMenu = forwardRef<
typeof BS5DropdownMenu,
DropdownMenuProps
>(({ as = 'ul', ...props }, ref) => {
return
})
DropdownMenu.displayName = 'DropdownMenu'
export function DropdownDivider({ as = 'li', ...props }: DropdownDividerProps) {
return
}
export function DropdownHeader({ as = 'li', ...props }: DropdownHeaderProps) {
return
}