import _extends from "@babel/runtime/helpers/extends";
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
import _createClass from "@babel/runtime/helpers/createClass";
import _inherits from "@babel/runtime/helpers/inherits";
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
var _excluded = ["className", "children", "forwardedRef", "sliceFrom", "sliceTo", "preserveSelectableSpace"];

function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }

function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }

import React, { forwardRef, PureComponent } from 'react';
import PropTypes from 'prop-types';
import Cell from './Cell';
import Row from './Row';
import cx from 'classnames';
import theme from './theme.css';

var FooterRow = /*#__PURE__*/function (_PureComponent) {
  _inherits(FooterRow, _PureComponent);

  var _super = _createSuper(FooterRow);

  function FooterRow() {
    _classCallCheck(this, FooterRow);

    return _super.apply(this, arguments);
  }

  _createClass(FooterRow, [{
    key: "render",
    value: function render() {
      var _this$props = this.props,
          className = _this$props.className,
          children = _this$props.children,
          forwardedRef = _this$props.forwardedRef,
          sliceFrom = _this$props.sliceFrom,
          sliceTo = _this$props.sliceTo,
          preserveSelectableSpace = _this$props.preserveSelectableSpace,
          others = _objectWithoutProperties(_this$props, _excluded);

      var childrenArray = Array.isArray(children) ? children : [children];
      var childrenSliced = childrenArray.slice(sliceFrom, sliceTo);
      var classNames = cx(theme['footer-row'], className);
      return /*#__PURE__*/React.createElement(Row, _extends({
        className: classNames,
        "data-teamleader-ui": "datagrid-footer-row",
        ref: forwardedRef
      }, others), preserveSelectableSpace && /*#__PURE__*/React.createElement(Cell, {
        flex: "checkbox-width",
        preventOverflow: false
      }), childrenSliced);
    }
  }]);

  return FooterRow;
}(PureComponent);

/** @type {any} */
var ForwardedFooterRow = /*#__PURE__*/forwardRef(function (props, ref) {
  return /*#__PURE__*/React.createElement(FooterRow, _extends({}, props, {
    forwardedRef: ref
  }));
});
ForwardedFooterRow.displayName = 'FooterRow';
export default ForwardedFooterRow;