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

Function useGridList

packages/react-aria/src/gridlist/useGridList.ts:132–212  ·  view source on GitHub ↗
(
  props: AriaGridListOptions<T>,
  state: ListState<T>,
  ref: RefObject<HTMLElement | null>
)

Source from the content-addressed store, hash-verified

130 * @param ref - The ref attached to the list element.
131 */
132export function useGridList<T>(
133 props: AriaGridListOptions<T>,
134 state: ListState<T>,
135 ref: RefObject<HTMLElement | null>
136): GridListAria {
137 let {
138 isVirtualized,
139 keyboardDelegate,
140 layoutDelegate,
141 onAction,
142 disallowTypeAhead,
143 linkBehavior = 'action',
144 keyboardNavigationBehavior = 'arrow',
145 escapeKeyBehavior = 'clearSelection',
146 shouldSelectOnPressUp
147 } = props;
148
149 if (!props['aria-label'] && !props['aria-labelledby']) {
150 console.warn('An aria-label or aria-labelledby prop is required for accessibility.');
151 }
152
153 let {listProps} = useSelectableList({
154 selectionManager: state.selectionManager,
155 collection: state.collection,
156 disabledKeys: state.disabledKeys,
157 ref,
158 keyboardDelegate,
159 layoutDelegate,
160 isVirtualized,
161 selectOnFocus: state.selectionManager.selectionBehavior === 'replace',
162 shouldFocusWrap: props.shouldFocusWrap,
163 linkBehavior,
164 disallowTypeAhead,
165 autoFocus: props.autoFocus,
166 escapeKeyBehavior,
167 UNSTABLE_focusOnEntry: props.UNSTABLE_focusOnEntry
168 });
169
170 let id = useId(props.id);
171 listMap.set(state, {
172 id,
173 onAction,
174 linkBehavior,
175 keyboardNavigationBehavior,
176 shouldSelectOnPressUp
177 });
178
179 let descriptionProps = useHighlightSelectionDescription({
180 selectionManager: state.selectionManager,
181 hasItemActions: !!onAction
182 });
183
184 let hasTabbableChild = useHasTabbableChild(ref, {
185 isDisabled: state.collection.size !== 0
186 });
187
188 let domProps = filterDOMProps(props, {labelable: true});
189 let gridProps: DOMAttributes = mergeProps(

Callers 4

useTagGroupFunction · 0.90
useTreeFunction · 0.90
GridListInnerFunction · 0.90
ListView.tsxFile · 0.90

Calls 8

useSelectableListFunction · 0.90
useIdFunction · 0.90
useHasTabbableChildFunction · 0.90
filterDOMPropsFunction · 0.90
mergePropsFunction · 0.90
setMethod · 0.45

Tested by

no test coverage detected