var _excluded = ["children", "contentProps", "css", "headerProps", "name", "ariaLabel", "render", "isHeader", "className"],
  _excluded2 = ["css"],
  _excluded3 = ["css"];
function _extends() { _extends = Object.assign ? Object.assign.bind() : 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 _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, { forwardRef } from 'react';
import classNames from 'classnames';
import { StyledNoEvents } from './partials/StyledNoEvents';
import { StyledRow } from './partials/StyledRow';
import { StyledRowContent } from './partials/StyledRowContent';
import { StyledRowHeader } from './partials/StyledRowHeader';
import { StyledVisuallyHiddenText } from '../../styled-components/partials/StyledVisuallyHiddenText';
import { TimelineContext } from '.';
import { useTimelineRowContent } from './hooks/useTimelineRowContent';
export var TimelineRow = /*#__PURE__*/forwardRef(function (_ref, ref) {
  var children = _ref.children,
    _ref$contentProps = _ref.contentProps,
    contentProps = _ref$contentProps === void 0 ? {} : _ref$contentProps,
    css = _ref.css,
    _ref$headerProps = _ref.headerProps,
    headerProps = _ref$headerProps === void 0 ? {} : _ref$headerProps,
    name = _ref.name,
    ariaLabel = _ref.ariaLabel,
    render = _ref.render,
    _ref$isHeader = _ref.isHeader,
    isHeader = _ref$isHeader === void 0 ? false : _ref$isHeader,
    className = _ref.className,
    rest = _objectWithoutProperties(_ref, _excluded);
  var classes = classNames('timeline__row', className);
  var _useTimelineRowConten = useTimelineRowContent(isHeader, children),
    noCells = _useTimelineRowConten.noCells,
    rowContentRef = _useTimelineRowConten.rowContentRef;
  var contentCss = contentProps.css,
    restContentProps = _objectWithoutProperties(contentProps, _excluded2);
  var headerCss = headerProps.css,
    restHeaderProps = _objectWithoutProperties(headerProps, _excluded3);
  return /*#__PURE__*/React.createElement(TimelineContext.Consumer, null, function (_ref2) {
    var hasSide = _ref2.hasSide;
    return /*#__PURE__*/React.createElement(StyledRow, _extends({
      $css: css,
      className: classes,
      role: "row",
      ref: ref
    }, rest), hasSide && /*#__PURE__*/React.createElement(StyledRowHeader, _extends({
      $css: headerCss,
      $isHeader: isHeader,
      role: "rowheader",
      "aria-label": ariaLabel
    }, restHeaderProps), render && render({
      name: name
    }), !render && isHeader && /*#__PURE__*/React.createElement(StyledVisuallyHiddenText, null, name), !render && !isHeader && name), /*#__PURE__*/React.createElement(StyledRowContent, _extends({
      $css: contentCss,
      ref: rowContentRef
    }, restContentProps), noCells && /*#__PURE__*/React.createElement(StyledNoEvents, {
      role: "cell"
    }, "No events"), children));
  });
});
TimelineRow.displayName = 'TimelineRow';