import { forwardRef, type HTMLAttributes, type ReactNode } from 'react'
import { cn } from '@/lib/utils'
// --- List ---
export interface ListProps extends HTMLAttributes {}
export const List = forwardRef(
({ className, children, ...props }, ref) => (
),
)
List.displayName = 'List'
// --- ListItem ---
export interface ListItemProps extends HTMLAttributes {
icon?: ReactNode
active?: boolean
disabled?: boolean
href?: string
}
export const ListItem = forwardRef(
({ icon, active = false, disabled = false, href, className, children, ...props }, ref) => {
const styles = cn(
'flex min-h-12 items-center gap-4 px-4 py-2 transition-colors',
active
? 'bg-info/12 text-info'
: 'text-text hover:bg-text/[0.04]',
disabled && 'pointer-events-none opacity-55',
className,
)
const content = (
<>
{icon && (
svg]:size-full', active ? 'text-info' : 'text-text-secondary')}>
{icon}
)}
{children}
>
)
if (href) {
return (
{content}
)
}
return (
{content}
)
},
)
ListItem.displayName = 'ListItem'
// --- ListSubheader ---
export interface ListSubheaderProps extends HTMLAttributes {}
export const ListSubheader = forwardRef(
({ className, children, ...props }, ref) => (
{children}
),
)
ListSubheader.displayName = 'ListSubheader'
// --- ListDivider ---
export interface ListDividerProps extends HTMLAttributes {}
export const ListDivider = forwardRef(
({ className, ...props }, ref) => (
),
)
ListDivider.displayName = 'ListDivider'