import { DropdownMenuOption } from './DropdownMenuOption'; import { ListState, Node, OverlayTriggerState } from '../react-aria'; // from react-stately import { useListBoxSection } from '../react-aria'; // from react-aria export interface DropdownMenuOptionProps { componentClass: string; section: Node; state: ListState & OverlayTriggerState; rootId?: string; } export function DropdownMenuSection({ componentClass, section, state, rootId, }: DropdownMenuOptionProps) { const { itemProps, headingProps, groupProps } = useListBoxSection({ heading: section.rendered, 'aria-label': section['aria-label'], }); const headingId = section.props.id ?? `${rootId}__group--${section.index}`; const sharedProps = { state, rootId, componentClass }; return ( <>
  • {section.rendered && (
    {section.rendered}
    )}
      {[...section.childNodes].map((node) => ( ))}
  • ); } export default DropdownMenuSection;