"use strict";

var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard")["default"];

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

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = void 0;

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

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

var _mobxReactLite = require("mobx-react-lite");

var _TableTBody = _interopRequireDefault(require("./TableTBody"));

var _TableContext = _interopRequireDefault(require("./TableContext"));

var ExpandableTableTBody = function ExpandableTableTBody(props) {
  var _useContext = (0, _react.useContext)(_TableContext["default"]),
      isBodyExpanded = _useContext.tableStore.isBodyExpanded;

  var rendered = (0, _react.useRef)(false);

  if (isBodyExpanded || rendered.current) {
    rendered.current = true;
    return /*#__PURE__*/_react["default"].createElement(_TableTBody["default"], (0, _extends2["default"])({}, props, {
      hidden: !isBodyExpanded
    }));
  }

  return null;
};

ExpandableTableTBody.displayName = 'ExpandableTableTBody';

var _default = (0, _mobxReactLite.observer)(ExpandableTableTBody);

exports["default"] = _default;
//# sourceMappingURL=ExpandableTableTBody.js.map
