function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }

function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }

import React from "react";
import PropTypes from "prop-types";
import classNames from "classnames";
import { toClass } from "recompose";
import { withToggle } from "../../../utils/recompose-utils";

var DiscloseRow = function DiscloseRow(_ref) {
  var children = _ref.children,
      className = _ref.className,
      isOpen = _ref.isOpen,
      rowContents = _ref.rowContents,
      toggle = _ref.toggle,
      props = _objectWithoutProperties(_ref, ["children", "className", "isOpen", "rowContents", "toggle"]);

  var linkClass = classNames("oui-disclose-table--row__toggle", _defineProperty({}, "is-active", isOpen), className);
  return React.createElement(React.Fragment, null, React.createElement("tr", _extends({
    onClick: toggle,
    className: linkClass
  }, props), React.createElement("td", {
    className: "soft--left vertical-align--middle"
  }, React.createElement("span", {
    className: "oui-disclose__symbol push-half--right"
  })), rowContents), isOpen && React.createElement("tr", {
    className: "oui-disclose-table--row__content"
  }, React.createElement("td", {
    colSpan: rowContents.length + 1
  }, children)));
};

DiscloseRow.propTypes = {
  /** Can be any valid HTML node */
  children: PropTypes.node.isRequired,

  /** CSS class names. */
  className: PropTypes.string,
  isOpen: PropTypes.bool.isRequired,
  rowContents: PropTypes.array.isRequired,
  toggle: PropTypes.func.isRequired
};
export default withToggle(toClass(DiscloseRow));