({item, state, dropState, onPaste})
| 269 | }); |
| 270 | |
| 271 | function CollectionItem({item, state, dropState, onPaste}) { |
| 272 | let rowRef = React.useRef<HTMLDivElement | null>(null); |
| 273 | let cellRef = React.useRef<HTMLDivElement | null>(null); |
| 274 | let cellNode = [...item.childNodes][0]; |
| 275 | |
| 276 | let {rowProps} = useGridRow({node: item}, state, rowRef); |
| 277 | let {gridCellProps} = useGridCell( |
| 278 | { |
| 279 | node: cellNode, |
| 280 | focusMode: 'cell' |
| 281 | }, |
| 282 | state, |
| 283 | cellRef |
| 284 | ); |
| 285 | |
| 286 | let dropIndicatorRef = React.useRef<HTMLDivElement | null>(null); |
| 287 | let {dropIndicatorProps} = useDropIndicator( |
| 288 | { |
| 289 | target: {type: 'item', key: item.key, dropPosition: 'on'} |
| 290 | }, |
| 291 | dropState, |
| 292 | dropIndicatorRef |
| 293 | ); |
| 294 | let {visuallyHiddenProps} = useVisuallyHidden(); |
| 295 | |
| 296 | let {clipboardProps} = useClipboard({ |
| 297 | onPaste |
| 298 | }); |
| 299 | |
| 300 | return ( |
| 301 | <div {...rowProps} ref={rowRef} style={{outline: 'none'}}> |
| 302 | <FocusRing focusRingClass={classNames(dndStyles, 'focus-ring')}> |
| 303 | <div |
| 304 | {...mergeProps(gridCellProps, clipboardProps)} |
| 305 | ref={cellRef} |
| 306 | className={classNames(dndStyles, 'droppable', { |
| 307 | 'is-drop-target': dropState.isDropTarget({ |
| 308 | type: 'item', |
| 309 | key: item.key, |
| 310 | dropPosition: 'on' |
| 311 | }), |
| 312 | 'is-selected': state.selectionManager.isSelected(item.key) |
| 313 | })}> |
| 314 | {item.rendered} |
| 315 | {!dropIndicatorProps['aria-hidden'] && ( |
| 316 | <div |
| 317 | {...visuallyHiddenProps} |
| 318 | role="button" |
| 319 | {...dropIndicatorProps} |
| 320 | ref={dropIndicatorRef} |
| 321 | /> |
| 322 | )} |
| 323 | </div> |
| 324 | </FocusRing> |
| 325 | </div> |
| 326 | ); |
| 327 | } |
| 328 |
nothing calls this directly
no test coverage detected