"use strict";var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;exports.__esModule = true;exports.isMenuFooter = exports.MenuFooterDataTids = exports.MenuFooter = void 0;var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
var _react = _interopRequireWildcard(require("react"));

var _ThemeContext = require("../../lib/theming/ThemeContext");

var _CommonWrapper = require("../../internal/CommonWrapper");
var _Emotion = require("../../lib/theming/Emotion");

var _forwardRefAndName = require("../../lib/forwardRefAndName");

var _MenuFooter = require("./MenuFooter.styles");var _excluded = ["id", "_enableIconPadding", "children", "size"];












var MenuFooterDataTids = exports.MenuFooterDataTids = {
  root: 'MenuFooter__root'
};

/**
 * Футер меню `MenuFooter`.
 *
 * `MenuFooter`, в отличие от `MenuItem` нельзя затаргетить с клавиатуры.
 *
 * Сущности, в которых может быть использован `MenuFooter`: DropdownMenu, Kebab, TooltipMenu и Select.
 */

var MenuFooter = exports.MenuFooter = (0, _forwardRefAndName.forwardRefAndName)(
  'MenuFooter',
  function MenuFooter(_ref,

  ref)
  {var _cx;var id = _ref.id,_ref$_enableIconPaddi = _ref._enableIconPadding,_enableIconPadding = _ref$_enableIconPaddi === void 0 ? false : _ref$_enableIconPaddi,children = _ref.children,_ref$size = _ref.size,size = _ref$size === void 0 ? 'small' : _ref$size,rest = (0, _objectWithoutPropertiesLoose2.default)(_ref, _excluded);
    var theme = (0, _react.useContext)(_ThemeContext.ThemeContext);
    function getRootSizeClassName() {
      switch (size) {
        case 'large':
          return _MenuFooter.styles.rootLarge(theme);
        case 'medium':
          return _MenuFooter.styles.rootMedium(theme);
        case 'small':
        default:
          return _MenuFooter.styles.rootSmall(theme);
      }
    }
    function getWithLeftPaddingSizeClassName() {
      switch (size) {
        case 'large':
          return _MenuFooter.styles.withLeftPaddingSmall(theme);
        case 'medium':
          return _MenuFooter.styles.withLeftPaddingMedium(theme);
        case 'small':
        default:
          return _MenuFooter.styles.withLeftPaddingSmall(theme);
      }
    }

    return /*#__PURE__*/(
      _react.default.createElement(_CommonWrapper.CommonWrapper, rest, /*#__PURE__*/
      _react.default.createElement("div", {
        id: id,
        ref: ref,
        "data-tid": MenuFooterDataTids.root,
        className: (0, _Emotion.cx)(getRootSizeClassName(), (_cx = {}, _cx[
        _MenuFooter.styles.root(theme)] = true, _cx[
        getWithLeftPaddingSizeClassName()] = _enableIconPadding, _cx)
        ) },

      children
      )
      ));

  }
);

//@ts-ignore
MenuFooter.__MENU_FOOTER__ = true;



var isMenuFooter = exports.isMenuFooter = function isMenuFooter(child) {
  return /*#__PURE__*/_react.default.isValidElement(child) ?
  Object.prototype.hasOwnProperty.call(child.type, '__MENU_FOOTER__') :
  false;
};