"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.Grid = void 0;

var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));

var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));

var _react = _interopRequireWildcard(require("react"));

var _FullGrid = require("../FullGrid");

var _utils = require("./utils");

function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }

function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

var __jsx = _react["default"].createElement;
// A simplified version of <FullGrid> which can be used in most cases.
var Grid = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
  var columns = _ref.columns,
      _ref$spacingX = _ref.spacingX,
      spacingX = _ref$spacingX === void 0 ? 'spacing' : _ref$spacingX,
      _ref$spacingY = _ref.spacingY,
      spacingY = _ref$spacingY === void 0 ? 'spacing' : _ref$spacingY,
      _ref$spacing = _ref.spacing,
      spacing = _ref$spacing === void 0 ? 'spacing' : _ref$spacing,
      minChildWidth = _ref.minChildWidth,
      props = (0, _objectWithoutProperties2["default"])(_ref, ["columns", "spacingX", "spacingY", "spacing", "minChildWidth"]);
  var templateColumns = minChildWidth ? (0, _utils.widthToColumns)(minChildWidth) : (0, _utils.countToColumns)(columns);
  return __jsx(_FullGrid.FullGrid, (0, _extends2["default"])({
    ref: ref,
    gap: spacing,
    columnGap: spacing || spacingX,
    rowGap: spacing || spacingY,
    templateColumns: templateColumns
  }, props));
});
exports.Grid = Grid;
//# sourceMappingURL=Grid.js.map