pre-installations and preparations

This commit is contained in:
MuhammadKhalilzadeh committed 2024-05-05 11:21:00 +03:30
1 parent 3e5a0329cb
commit 201d621ac3
6977 files changed
+742826

No files matched your search

+41
View File
@@ -0,0 +1,41 @@
'use client';
import * as React from 'react';
import { ListContext } from '../useList/ListContext';
import { CompoundComponentContext } from '../useCompound';
import { jsx as _jsx } from "react/jsx-runtime";
/**
* Sets up the contexts for the underlying MenuItem components.
*
* @ignore - do not document.
*/
export function MenuProvider(props) {
const {
value,
children
} = props;
const {
dispatch,
getItemIndex,
getItemState,
registerItem,
totalSubitemCount
} = value;
const listContextValue = React.useMemo(() => ({
dispatch,
getItemState,
getItemIndex
}), [dispatch, getItemIndex, getItemState]);
const compoundComponentContextValue = React.useMemo(() => ({
getItemIndex,
registerItem,
totalSubitemCount
}), [registerItem, getItemIndex, totalSubitemCount]);
return /*#__PURE__*/_jsx(CompoundComponentContext.Provider, {
value: compoundComponentContextValue,
children: /*#__PURE__*/_jsx(ListContext.Provider, {
value: listContextValue,
children: children
})
});
}