import _extends from "@babel/runtime/helpers/esm/extends";
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
var _excluded = ["forwardedRef"],
    _excluded2 = ["value"];
import React from 'react';
var MenuContext = /*#__PURE__*/React.createContext({});
export default MenuContext;
export function connect(Component) {
  function WrappedItem(props) {
    var forwardedRef = props.forwardedRef,
        other = _objectWithoutProperties(props, _excluded);

    return /*#__PURE__*/React.createElement(MenuContext.Consumer, null, function (store) {
      var value = store.value,
          storeData = _objectWithoutProperties(store, _excluded2);

      return /*#__PURE__*/React.createElement(Component, _extends({}, storeData, other, {
        currentValue: value,
        ref: forwardedRef
      }));
    });
  }

  function forwardRef(props, ref) {
    return /*#__PURE__*/React.createElement(WrappedItem, _extends({}, props, {
      forwardedRef: ref
    }));
  } // Give this component a more helpful display name in DevTools.


  forwardRef.displayName = 'ConnectedMenuItem';
  return /*#__PURE__*/React.forwardRef(forwardRef);
}