'use client' import type { ReactElement, ReactNode } from 'react' import { Children, isValidElement } from 'react' import { Accordion as HeroAccordion } from '@heroui/react' interface AccordionItemProps { 'aria-label'?: string children?: ReactNode key?: string | number subtitle?: ReactNode title: ReactNode } interface AccordionProps { children?: ReactNode itemClasses?: { base?: string; content?: string; title?: string } variant?: 'light' | 'shadow' | 'bordered' | 'splitted' } export function AccordionItem(_props: AccordionItemProps) { return null } function itemId(item: ReactElement, index: number): string { if (item.key == null) return String(index) const value = String(item.key) return value.startsWith('.$') ? value.slice(2) : value } export function Accordion({ children, itemClasses, variant }: AccordionProps) { const items = Children.toArray(children).filter((child): child is ReactElement => isValidElement(child) ) return ( {items.map((item, index) => ( {item.props.title} {item.props.subtitle ? {item.props.subtitle} : null} {item.props.children} ))} ) }