import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
var _excluded = ["id", "_enableIconPadding", "children", "size"];
import React, { useContext } from 'react';
import { ThemeContext } from "../../../lib/theming/ThemeContext";
import { CommonWrapper } from "../../../internal/CommonWrapper";
import { cx } from "../../../lib/theming/Emotion";
import { forwardRefAndName } from "../../../lib/forwardRefAndName";
import { styles } from "../MenuFooter.styles";
export var MenuFooterDataTids = {
  root: 'MenuFooter__root'
};

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

var MenuFooter = 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 = _objectWithoutPropertiesLoose(_ref, _excluded);
  var theme = useContext(ThemeContext);
  function getRootSizeClassName() {
    switch (size) {
      case 'large':
        return styles.rootLarge(theme);
      case 'medium':
        return styles.rootMedium(theme);
      case 'small':
      default:
        return styles.rootSmall(theme);
    }
  }
  function getWithLeftPaddingSizeClassName() {
    switch (size) {
      case 'large':
        return styles.withLeftPaddingSmall(theme);
      case 'medium':
        return styles.withLeftPaddingMedium(theme);
      case 'small':
      default:
        return styles.withLeftPaddingSmall(theme);
    }
  }
  return /*#__PURE__*/(
    React.createElement(CommonWrapper, rest, /*#__PURE__*/
    React.createElement("div", {
      id: id,
      ref: ref,
      "data-tid": MenuFooterDataTids.root,
      className: cx(getRootSizeClassName(), (_cx = {}, _cx[styles.root(theme)] = true, _cx[getWithLeftPaddingSizeClassName()] = _enableIconPadding, _cx))
    }, children))
  );
});

//@ts-ignore
MenuFooter.__MENU_FOOTER__ = true;
export { MenuFooter };
export var isMenuFooter = function isMenuFooter(child) {
  return /*#__PURE__*/React.isValidElement(child) ? Object.prototype.hasOwnProperty.call(child.type, '__MENU_FOOTER__') : false;
};