var _excluded = ["gutterX", "gutterY", "colStackCap"],
  _excluded2 = ["colWidth", "colStart"];
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 { 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