"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.useTitleId = exports.useSetFlyoutMenuOpen = exports.useFlyoutMenuOpen = exports.TitleIdContextProvider = exports.TitleIdContext = exports.SetIsOpenContext = exports.OnCloseContext = exports.IsOpenContext = void 0;
var _react = require("react");
var _noop = _interopRequireDefault(require("@atlaskit/ds-lib/noop"));
/**
 * __Is open context__
 *
 * A context for storing the isOpen value of the FlyoutMenuItem.
 */
var IsOpenContext = exports.IsOpenContext = /*#__PURE__*/(0, _react.createContext)(false);

/**
 * __Set is open context__
 *
 * A context for storing a function that sets isOpen value of the FlyoutMenuItem.
 */
var SetIsOpenContext = exports.SetIsOpenContext = /*#__PURE__*/(0, _react.createContext)(_noop.default);
var useFlyoutMenuOpen = exports.useFlyoutMenuOpen = function useFlyoutMenuOpen() {
  return (0, _react.useContext)(IsOpenContext);
};
var useSetFlyoutMenuOpen = exports.useSetFlyoutMenuOpen = function useSetFlyoutMenuOpen() {
  return (0, _react.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.
 */
var OnCloseContext = exports.OnCloseContext = /*#__PURE__*/(0, _react.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.
 */
var TitleIdContext = exports.TitleIdContext = /*#__PURE__*/(0, _react.createContext)(undefined);
var useTitleId = exports.useTitleId = function useTitleId() {
  return (0, _react.useContext)(TitleIdContext);
};

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