MCPcopy Index your code
hub / github.com/adobe/react-spectrum / ListBoxInner

Function ListBoxInner

packages/react-aria-components/src/ListBox.tsx:239–433  ·  view source on GitHub ↗
({state: inputState, props, listBoxRef}: ListBoxInnerProps<T>)

Source from the content-addressed store, hash-verified

237}
238
239function ListBoxInner<T>({state: inputState, props, listBoxRef}: ListBoxInnerProps<T>) {
240 [props, listBoxRef] = useContextProps(props, listBoxRef, SelectableCollectionContext);
241 let {dragAndDropHooks, layout = 'stack', orientation = 'vertical', filter} = props;
242 let state = UNSTABLE_useFilteredListState(inputState, filter);
243 let {collection, selectionManager} = state;
244 let isListDraggable = !!dragAndDropHooks?.useDraggableCollectionState;
245 let isListDroppable = !!dragAndDropHooks?.useDroppableCollectionState;
246 let {direction} = useLocale();
247 let {disabledBehavior, disabledKeys} = selectionManager;
248 let collator = useCollator({usage: 'search', sensitivity: 'base'});
249 let {
250 isVirtualized,
251 layoutDelegate,
252 dropTargetDelegate: ctxDropTargetDelegate,
253 CollectionRoot
254 } = useContext(CollectionRendererContext);
255 let keyboardDelegate = useMemo(
256 () =>
257 props.keyboardDelegate ||
258 new ListKeyboardDelegate({
259 collection,
260 collator,
261 ref: listBoxRef,
262 disabledKeys,
263 disabledBehavior,
264 layout,
265 orientation,
266 direction,
267 layoutDelegate
268 }),
269 [
270 collection,
271 collator,
272 listBoxRef,
273 disabledBehavior,
274 disabledKeys,
275 orientation,
276 direction,
277 props.keyboardDelegate,
278 layout,
279 layoutDelegate
280 ]
281 );
282
283 let {listBoxProps} = useListBox(
284 {
285 ...props,
286 shouldSelectOnPressUp: isListDraggable || props.shouldSelectOnPressUp,
287 keyboardDelegate,
288 isVirtualized
289 },
290 state,
291 listBoxRef
292 );
293
294 let dragHooksProvided = useRef(isListDraggable);
295 let dropHooksProvided = useRef(isListDroppable);
296 useEffect(() => {

Callers

nothing calls this directly

Calls 12

useContextPropsFunction · 0.90
useLocaleFunction · 0.90
useCollatorFunction · 0.90
useListBoxFunction · 0.90
useFocusRingFunction · 0.90
useRenderPropsFunction · 0.90
filterDOMPropsFunction · 0.90
mergePropsFunction · 0.90
useDndPersistedKeysFunction · 0.90
useRenderDropIndicatorFunction · 0.90
isDropTargetMethod · 0.80

Tested by

no test coverage detected