import React, { type ReactNode } from 'react'; import { CheckboxInput } from '../CheckboxInput'; import styles from './ListBox.module.css'; import { useOptionHeaderContext } from './ListBoxProvider'; import { useId } from '../../hooks/useId'; import { classNames } from '../../utils'; export type ListBoxHeaderProps = { children: ReactNode; onAllOptionsChange: (isChecked: boolean) => void; }; export function ListBoxHeader({ children, onAllOptionsChange, }: ListBoxHeaderProps) { const context = useOptionHeaderContext(); const controlId = useId(); if (!children) { return null; } const { isChecked, isDisabled, isIndeterminate, hasCheckbox } = context; return (
  • {hasCheckbox ? ( ) : null} {children}
  • ); }