1 | import * as React from 'react';
|
2 | import { ListContext } from '../useList/ListContext';
|
3 | import { CompoundComponentContext } from '../utils/useCompound';
|
4 | import { jsx as _jsx } from "react/jsx-runtime";
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 | export default function SelectProvider(props) {
|
11 | var value = props.value,
|
12 | children = props.children;
|
13 | var dispatch = value.dispatch,
|
14 | getItemIndex = value.getItemIndex,
|
15 | getItemState = value.getItemState,
|
16 | registerHighlightChangeHandler = value.registerHighlightChangeHandler,
|
17 | registerSelectionChangeHandler = value.registerSelectionChangeHandler,
|
18 | registerItem = value.registerItem,
|
19 | totalSubitemCount = value.totalSubitemCount;
|
20 | var listContextValue = React.useMemo(function () {
|
21 | return {
|
22 | dispatch: dispatch,
|
23 | getItemState: getItemState,
|
24 | getItemIndex: getItemIndex,
|
25 | registerHighlightChangeHandler: registerHighlightChangeHandler,
|
26 | registerSelectionChangeHandler: registerSelectionChangeHandler
|
27 | };
|
28 | }, [dispatch, getItemIndex, getItemState, registerHighlightChangeHandler, registerSelectionChangeHandler]);
|
29 | var compoundComponentContextValue = React.useMemo(function () {
|
30 | return {
|
31 | getItemIndex: getItemIndex,
|
32 | registerItem: registerItem,
|
33 | totalSubitemCount: totalSubitemCount
|
34 | };
|
35 | }, [registerItem, getItemIndex, totalSubitemCount]);
|
36 | return _jsx(CompoundComponentContext.Provider, {
|
37 | value: compoundComponentContextValue,
|
38 | children: _jsx(ListContext.Provider, {
|
39 | value: listContextValue,
|
40 | children: children
|
41 | })
|
42 | });
|
43 | } |
\ | No newline at end of file |