var _excluded = ["expandItems", "expandChildren", "separatorColor"];
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 from 'react';
import styled from 'styled-components';
import { ExpandArea } from '.';
import { getStylesForSizes } from '../../shared';
import { useFlexTable } from '../../shared/FlexTableProvider';
var getExpandableStyles = function getExpandableStyles(_ref) {
  var expandable = _ref.expandable;
  if (expandable) {
    return 'display: block;';
  }
  return 'display: none;';
};
var StyledExpandedRow = styled('div').withConfig({
  displayName: "ExpandRow__StyledExpandedRow",
  componentId: "sc-wqa9y6-0"
})(["border-left:", "px solid ", ";border-bottom:1px solid ", ";", ""], function (p) {
  return p.theme.spacing.unit(0.5);
}, function (p) {
  return p.theme.color.cta;
}, function (p) {
  return p.$separatorColor(p.theme);
}, getStylesForSizes(function (p) {
  return {
    xs: p.$xs,
    sm: p.$sm,
    md: p.$md,
    lg: p.$lg,
    xl: p.$xl
  };
}, {
  expandable: getExpandableStyles
}));
export var ExpandRow = function ExpandRow(_ref2) {
  var expandItems = _ref2.expandItems,
    expandChildren = _ref2.expandChildren,
    _ref2$separatorColor = _ref2.separatorColor,
    separatorColor = _ref2$separatorColor === void 0 ? function (theme) {
      return theme.color.divider;
    } : _ref2$separatorColor,
    htmlProps = _objectWithoutProperties(_ref2, _excluded);
  var _useFlexTable = useFlexTable('expandable'),
    $xs = _useFlexTable.xs,
    $sm = _useFlexTable.sm,
    $md = _useFlexTable.md,
    $lg = _useFlexTable.lg,
    $xl = _useFlexTable.xl;
  return React.createElement(StyledExpandedRow, _extends({
    role: "row",
    $separatorColor: separatorColor
  }, htmlProps, {
    $xs: $xs,
    $sm: $sm,
    $md: $md,
    $lg: $lg,
    $xl: $xl
  }), React.createElement(ExpandArea, {
    expandItems: expandItems,
    expandChildren: expandChildren
  }));
};