import { Check } from '@transferwise/icons'; import { clsx } from 'clsx'; import { useContext } from 'react'; import { ListboxOption } from '@headlessui/react'; import { SelectInputItemsCountContext, SelectInputItemPositionContext, } from '../SelectInput.contexts'; export interface SelectInputOptionProps { value: T; disabled?: boolean; children?: React.ReactNode; } /** * A selectable option in a SelectInput dropdown. * Includes accessibility support and styling for selected, active, and disabled states. */ export function SelectInputOption({ value, disabled, children, }: SelectInputOptionProps) { const itemsCount = useContext(SelectInputItemsCountContext); const itemPosition = useContext(SelectInputItemPositionContext); return ( clsx( 'np-select-input-option-container np-text-body-large', active && 'np-select-input-option-container--active', uiDisabled && 'np-select-input-option-container--disabled', ) } > {({ selected }) => ( <>
{children}
)}
); }