import _extends from "@babel/runtime/helpers/extends";
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
var _excluded = ["className", "children", "sliceFrom", "sliceTo", "onSelectionChange", "selected", "selectable"];
import React, { forwardRef } from 'react';
import Row from './Row';
import HeaderCell from './HeaderCell';
import Checkbox from '../checkbox';
import cx from 'classnames';
import theme from './theme.css';
var HeaderRow = /*#__PURE__*/forwardRef(function (_ref, ref) {
  var className = _ref.className,
      children = _ref.children,
      sliceFrom = _ref.sliceFrom,
      sliceTo = _ref.sliceTo,
      onSelectionChange = _ref.onSelectionChange,
      selected = _ref.selected,
      selectable = _ref.selectable,
      others = _objectWithoutProperties(_ref, _excluded);

  var childrenArray = Array.isArray(children) ? children : [children];
  var childrenSliced = childrenArray.slice(sliceFrom, sliceTo);
  var classNames = cx(theme['header-row'], className);
  return /*#__PURE__*/React.createElement(Row, _extends({
    backgroundColor: "neutral",
    className: classNames,
    "data-teamleader-ui": "datagrid-header-row",
    ref: ref
  }, others), selectable && /*#__PURE__*/React.createElement(HeaderCell, {
    flex: "checkbox-width",
    sortable: false
  }, /*#__PURE__*/React.createElement(Checkbox, {
    checked: selected,
    onChange: onSelectionChange,
    size: "small"
  })), childrenSliced);
});
HeaderRow.displayName = 'DataGrid.HeaderRow';
export default HeaderRow;