import { TableCellProps } from '@servicetitan/design-system'; import { useTableKeyboardNavigation } from '@progress/kendo-react-data-tools'; import { GRID_COL_INDEX_ATTRIBUTE } from '@progress/kendo-react-grid'; import { ComponentProps } from 'react'; const useTdProps = ({ id, colSpan, ariaColumnIndex, isSelected, columnIndex, }: TableCellProps): ComponentProps<'td'> & { [GRID_COL_INDEX_ATTRIBUTE]?: number; } => { const navigationAttributes = useTableKeyboardNavigation(id); return { colSpan, 'role': 'gridcell', 'aria-colindex': ariaColumnIndex, 'aria-selected': isSelected, [GRID_COL_INDEX_ATTRIBUTE]: columnIndex, ...navigationAttributes, }; }; export { useTdProps };