MCPcopy Create free account
hub / github.com/adobe/react-spectrum / ListBoxInner

Function ListBoxInner

packages/react-aria-components/src/ListBox.tsx:239–440  ·  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 // oxlint-disable-next-line react/react-compiler
241 [props, listBoxRef] = useContextProps(props, listBoxRef, SelectableCollectionContext);
242 let {dragAndDropHooks, layout = 'stack', orientation = 'vertical', filter} = props;
243 // oxlint-disable-next-line react/react-compiler
244 let state = UNSTABLE_useFilteredListState(inputState, filter);
245 let {collection, selectionManager} = state;
246 let isListDraggable = !!dragAndDropHooks?.useDraggableCollectionState;
247 let isListDroppable = !!dragAndDropHooks?.useDroppableCollectionState;
248 let {direction} = useLocale();
249 let {disabledBehavior, disabledKeys} = selectionManager;
250 let collator = useCollator({usage: 'search', sensitivity: 'base'});
251 let {
252 isVirtualized,
253 layoutDelegate,
254 dropTargetDelegate: ctxDropTargetDelegate,
255 CollectionRoot
256 } = useContext(CollectionRendererContext);
257 let keyboardDelegate = useMemo(
258 // oxlint-disable-next-line react/react-compiler
259 () =>
260 props.keyboardDelegate ||
261 new ListKeyboardDelegate({
262 collection,
263 collator,
264 ref: listBoxRef,
265 disabledKeys,
266 disabledBehavior,
267 layout,
268 orientation,
269 direction,
270 layoutDelegate
271 }),
272 [
273 collection,
274 collator,
275 listBoxRef,
276 disabledBehavior,
277 disabledKeys,
278 orientation,
279 direction,
280 props.keyboardDelegate,
281 layout,
282 layoutDelegate
283 ]
284 );
285
286 let {listBoxProps} = useListBox(
287 {
288 ...props,
289 shouldSelectOnPressUp: isListDraggable || props.shouldSelectOnPressUp,
290 keyboardDelegate,
291 isVirtualized
292 },
293 state,
294 listBoxRef
295 );
296

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