import React, { useEffect, useRef } from 'react'; import { Button } from '../../core'; import { FontAwesomeIcon as Icon } from '@fortawesome/react-fontawesome'; import { faCheckSquare, faSquare } from '@fortawesome/free-regular-svg-icons'; export interface IOptionProps { option: any; onClick: (option: any) => void; focus: boolean; index: number; onkeyPressed: (event: any, index: number, option: any) => void; searchOption: any; disabled?: boolean; onOptionRightClick?: any; primaryChip?: any; } export const Option = (props: IOptionProps) => { const { option, onClick, focus, index, onkeyPressed, searchOption, disabled = false, onOptionRightClick, primaryChip } = props; const { value, label, checked } = option; const ref = useRef(null); const SearchOptions = searchOption; useEffect(() => { if (focus && ref.current) ref.current.focus(); }, [focus]); return (
{ if (onOptionRightClick && !disabled && checked) onOptionRightClick(event, label, value, primaryChip === value); }} >
); };