/**
 * WordPress dependencies
 */
import { forwardRef, useContext } from '@wordpress/element';

/**
 * Internal dependencies
 */

import * as Styled from './styles';
import { MenuContext } from './context';
import { useTemporaryFocusVisibleFix } from './use-temporary-focus-visible-fix';
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
export const MenuItem = forwardRef(function MenuItem({
  prefix,
  suffix,
  children,
  onBlur,
  hideOnClick = true,
  ...props
}, ref) {
  // TODO: Remove when https://github.com/ariakit/ariakit/issues/4083 is fixed
  const focusVisibleFixProps = useTemporaryFocusVisibleFix({
    onBlur
  });
  const menuContext = useContext(MenuContext);
  return /*#__PURE__*/_jsxs(Styled.MenuItem, {
    ref: ref,
    ...props,
    ...focusVisibleFixProps,
    accessibleWhenDisabled: true,
    hideOnClick: hideOnClick,
    store: menuContext?.store,
    children: [/*#__PURE__*/_jsx(Styled.ItemPrefixWrapper, {
      children: prefix
    }), /*#__PURE__*/_jsxs(Styled.MenuItemContentWrapper, {
      children: [/*#__PURE__*/_jsx(Styled.MenuItemChildrenWrapper, {
        children: children
      }), suffix && /*#__PURE__*/_jsx(Styled.ItemSuffixWrapper, {
        children: suffix
      })]
    })]
  });
});
//# sourceMappingURL=item.js.map