var _excluded = ["gutterX", "gutterY", "colStackCap"],
  _excluded2 = ["colWidth", "colStart"];
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
import React from 'react';
import { addSubcomponents } from '../_utils/addSubcomponents';
import { StyledGridCol, StyledGridRow } from './Grid.styles';
import { overrideIfNotDefined } from './Grid.utils';
var defaultContextShape = {
  gutterX: 'none',
  gutterY: 'none',
  colStackCap: 'mobileLg'
};
var GridContext = /*#__PURE__*/React.createContext(defaultContextShape);
function BaseGrid(_ref) {
  var gutterX = _ref.gutterX,
    gutterY = _ref.gutterY,
    colStackCap = _ref.colStackCap,
    props = _objectWithoutProperties(_ref, _excluded);
  var gridContextValue = overrideIfNotDefined(defaultContextShape, {
    gutterX: gutterX,
    gutterY: gutterY,
    colStackCap: colStackCap
  });
  return /*#__PURE__*/React.createElement(GridContext.Provider, {
    value: gridContextValue
  }, /*#__PURE__*/React.createElement("div", props));
}
var GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, ref) {
  var _React$useContext = React.useContext(GridContext),
    gutterX = _React$useContext.gutterX,
    gutterY = _React$useContext.gutterY;
  return /*#__PURE__*/React.createElement(StyledGridRow, _extends({}, props, {
    $gutterX: gutterX,
    $gutterY: gutterY,
    ref: ref
  }));
});
var GridCol = /*#__PURE__*/React.forwardRef(function GridCol(_ref2, ref) {
  var _ref2$colWidth = _ref2.colWidth,
    colWidth = _ref2$colWidth === void 0 ? 'auto' : _ref2$colWidth,
    offset = _ref2.colStart,
    props = _objectWithoutProperties(_ref2, _excluded2);
  var _React$useContext2 = React.useContext(GridContext),
    gutterX = _React$useContext2.gutterX,
    gutterY = _React$useContext2.gutterY,
    colStackBreakpoint = _React$useContext2.colStackCap;
  return /*#__PURE__*/React.createElement(StyledGridCol, _extends({}, props, {
    ref: ref,
    $span: colWidth,
    $offset: offset,
    $gutterX: gutterX,
    $gutterY: gutterY,
    $colStackBreakpoint: colStackBreakpoint
  }));
});
export var Grid = addSubcomponents({
  Row: GridRow,
  Col: GridCol
}, BaseGrid);
//# sourceMappingURL=Grid.js.map