'use strict';

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

exports.__esModule = true;
exports.ListRow = void 0;

var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));

var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));

var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));

var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));

var _react = _interopRequireDefault(require("react"));

var _propTypes = _interopRequireDefault(require("prop-types"));

var _KeyDownable = require("../KeyDownable");

var ListRow =
/*#__PURE__*/
function (_React$Component) {
  (0, _inheritsLoose2.default)(ListRow, _React$Component);

  function ListRow() {
    return _React$Component.apply(this, arguments) || this;
  }

  var _proto = ListRow.prototype;

  _proto.render = function render() {
    var _this$props = this.props,
        children = _this$props.children,
        testAutomationId = _this$props.testAutomationId,
        keyDownableProps = _this$props.keyDownableProps,
        onClick = _this$props.onClick,
        props = (0, _objectWithoutPropertiesLoose2.default)(_this$props, ["children", "testAutomationId", "keyDownableProps", "onClick"]);
    return _react.default.createElement(_KeyDownable.KeyDownable, (0, _extends2.default)({}, keyDownableProps, {
      onClick: onClick
    }), function (_ref) {
      var onRowClick = _ref.onClick,
          onKeyDown = _ref.onKeyDown;
      return _react.default.createElement("tr", (0, _extends2.default)({
        "data-test-automation-id": testAutomationId
      }, props, {
        onClick: onRowClick,
        onKeyDown: onKeyDown
      }), children);
    });
  };

  return ListRow;
}(_react.default.Component);

exports.ListRow = ListRow;
(0, _defineProperty2.default)(ListRow, "defaultProps", {
  children: null,
  testAutomationId: 'row',
  onClick: null,
  keyDownableProps: {
    preventDefaultKeyDown: false,
    preventDefaultMouseDown: false
  }
});
(0, _defineProperty2.default)(ListRow, "propTypes", {
  children: _propTypes.default.node,
  testAutomationId: _propTypes.default.string,
  onClick: _propTypes.default.func,
  keyDownableProps: _propTypes.default.shape({
    preventDefaultKeyDown: _propTypes.default.bool,
    preventDefaultMouseDown: _propTypes.default.bool
  })
});