({column, state}: {column: any; state: any})
| 223 | } |
| 224 | |
| 225 | export function TableSelectAllCell({column, state}: {column: any; state: any}): JSX.Element { |
| 226 | let ref = useRef<HTMLTableCellElement | null>(null); |
| 227 | let isSingleSelectionMode = state.selectionManager.selectionMode === 'single'; |
| 228 | let {columnHeaderProps} = useTableColumnHeader({node: column}, state, ref); |
| 229 | |
| 230 | let {checkboxProps} = useTableSelectAllCheckbox(state); |
| 231 | let inputRef = useRef(null); |
| 232 | let {inputProps} = useCheckbox(checkboxProps, useToggleState(checkboxProps), inputRef); |
| 233 | |
| 234 | return ( |
| 235 | <th {...columnHeaderProps} ref={ref}> |
| 236 | { |
| 237 | /* |
| 238 | In single selection mode, the checkbox will be hidden. |
| 239 | So to avoid leaving a column header with no accessible content, |
| 240 | use a VisuallyHidden component to include the aria-label from the checkbox, |
| 241 | which for single selection will be "Select." |
| 242 | */ |
| 243 | isSingleSelectionMode && <VisuallyHidden>{inputProps['aria-label']}</VisuallyHidden> |
| 244 | } |
| 245 | <input |
| 246 | {...inputProps} |
| 247 | ref={inputRef} |
| 248 | style={isSingleSelectionMode ? {visibility: 'hidden'} : undefined} |
| 249 | /> |
| 250 | </th> |
| 251 | ); |
| 252 | } |
nothing calls this directly
no test coverage detected