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


var _Modal = require("../Modal");
var _forwardRefAndName = require("../../lib/forwardRefAndName");
var _ThemeContext = require("../../lib/theming/ThemeContext");
var _Emotion = require("../../lib/theming/Emotion");

var _MiniModal = require("./MiniModal.styles");
var _MiniModal2 = require("./MiniModal");var _excluded = ["direction", "children"];







/**
 * Обёртка над Modal.Footer
 *
 * @visibleName MiniModal.Footer
 */
var MiniModalFooter = exports.MiniModalFooter = (0, _forwardRefAndName.forwardRefAndName)(
  'MiniModalFooter',
  function (_ref, ref) {var _ref$direction = _ref.direction,direction = _ref$direction === void 0 ? 'row' : _ref$direction,children = _ref.children,rest = (0, _objectWithoutPropertiesLoose2.default)(_ref, _excluded);
    var theme = (0, _react.useContext)(_ThemeContext.ThemeContext);

    var childrenCount = _react.default.Children.count(children);
    var _direction = childrenCount > 2 || childrenCount === 1 ? 'column' : direction;

    return /*#__PURE__*/(
      _react.default.createElement(_Modal.Modal.Footer, rest, /*#__PURE__*/
      _react.default.createElement("div", {
        ref: ref,
        "data-tid": _MiniModal2.MiniModalDataTids.actions,
        className: (0, _Emotion.cx)(
          _MiniModal.styles.actions(),
          _direction === 'row' && _MiniModal.styles.actionsRow(theme),
          _direction === 'column' && _MiniModal.styles.actionsColumn(theme)
        ) },

      children
      )
      ));

  }
);