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); }

/*
Copyright (c) 2018-2019 Uber Technologies, Inc.

This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
*/
import * as React from 'react';
import { withStyle } from '../styles/index.js';
import { StyledTable as FlexStyledTable, StyledHeadCell as FlexStyledHeadCell, StyledCell as FlexStyledBodyCell } from '../table/index.js';
const StyledTableElement = withStyle(FlexStyledTable, props => {
  return {
    display: 'grid',
    gridTemplateColumns: props.$gridTemplateColumns,
    flexDirection: 'unset'
  };
}); // eslint-disable-next-line flowtype/no-weak-types

StyledTableElement.displayName = "StyledTableElement";
export const StyledTable = React.forwardRef((props, ref) => {
  return (//$FlowFixMe
    React.createElement(StyledTableElement, _extends({
      ref: ref,
      "data-baseweb": "table-grid",
      role: "grid"
    }, props))
  ); // eslint-disable-next-line flowtype/no-weak-types
});
StyledTable.__STYLETRON__ = StyledTableElement.__STYLETRON__;
StyledTable.displayName = 'StyledTable';
export const StyledHeadCell = withStyle(FlexStyledHeadCell, ({
  $sticky = true,
  $theme
}) => {
  return {
    backgroundColor: $theme.colors.tableHeadBackgroundColor,
    boxShadow: $theme.lighting.shadow400,
    position: $sticky ? 'sticky' : null,
    top: $sticky ? 0 : null,
    width: 'unset'
  };
});
StyledHeadCell.displayName = "StyledHeadCell";
export const StyledBodyCell = withStyle(FlexStyledBodyCell, props => {
  return {
    display: 'block',
    flex: 'unset',
    gridColumn: props.$gridColumn || null,
    gridRow: props.$gridRow || null
  };
});
StyledBodyCell.displayName = "StyledBodyCell";