import { createContext, useContext } from 'react';
import noop from '@atlaskit/ds-lib/noop';
/**
 * __Is open context__
 *
 * A context for storing the isOpen value of the FlyoutMenuItem.
 */
export var IsOpenContext = /*#__PURE__*/createContext(false);

/**
 * __Set is open context__
 *
 * A context for storing a function that sets isOpen value of the FlyoutMenuItem.
 */
export var SetIsOpenContext = /*#__PURE__*/createContext(noop);
export var useFlyoutMenuOpen = function useFlyoutMenuOpen() {
  return useContext(IsOpenContext);
};
export var useSetFlyoutMenuOpen = function useSetFlyoutMenuOpen() {
  return useContext(SetIsOpenContext);
};

/**
 * __On close context__
 * 
 * A context for storing a ref to the onClose handler with source information.This
 * is used by FlyoutMenuItemContent, FlyoutMenuItemTrigger and FlyoutHeader to store
 * the on close function and source information for closing the flyout menu.
 */
export var OnCloseContext = /*#__PURE__*/createContext({
  current: null
});

/**
 * __Title id context__
 * 
 * A context for storing the title id of the FlyoutMenuItem that is displayed in
 * FlyoutHeader, and used as the aria-labelledby on the FlyoutMenuItemContent
 * container.
 */
export var TitleIdContext = /*#__PURE__*/createContext(undefined);
export var useTitleId = function useTitleId() {
  return useContext(TitleIdContext);
};

/**
 * __Title id provider__
 * 
 * A context provider for supplying the title id to the FlyoutHeader.
 */
export var TitleIdContextProvider = TitleIdContext.Provider;