(props)
| 51 | } |
| 52 | |
| 53 | function Tree(props) { |
| 54 | let state = useTreeState(props); |
| 55 | let ref = useRef(null); |
| 56 | |
| 57 | let keyboardDelegate = useMemo( |
| 58 | () => new TreeKeyboardDelegate(state.collection, state.disabledKeys), |
| 59 | [state.collection, state.disabledKeys] |
| 60 | ); |
| 61 | |
| 62 | let {collectionProps} = useSelectableCollection({ |
| 63 | keyboardDelegate, |
| 64 | ref, |
| 65 | selectionManager: state.selectionManager |
| 66 | }); |
| 67 | |
| 68 | return ( |
| 69 | <div {...collectionProps} ref={ref} role="tree"> |
| 70 | {/* oxlint-disable-next-line react/react-compiler */} |
| 71 | {TreeNodes({nodes: state.collection, state})} |
| 72 | </div> |
| 73 | ); |
| 74 | } |
| 75 | |
| 76 | function TreeNodes({nodes, state}: {nodes: Collection<Node<any>>; state: any}) { |
| 77 | return Array.from(nodes).map(node => <TreeItem node={node} key={node.key} state={state} />); |
nothing calls this directly
no test coverage detected