"use strict";

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

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

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

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

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

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

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

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

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

var _propTypes = _interopRequireDefault(require("prop-types"));

var _styles = require("@material-ui/core/styles");

var _classnames = _interopRequireDefault(require("classnames"));

var _grid = require("@vx/grid");

var _plot = require("../plot");

var _renderUi = require("../render-ui");

function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }

function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }

var Grid = /*#__PURE__*/function (_React$Component) {
  (0, _inherits2["default"])(Grid, _React$Component);

  var _super = _createSuper(Grid);

  function Grid() {
    (0, _classCallCheck2["default"])(this, Grid);
    return _super.apply(this, arguments);
  }

  (0, _createClass2["default"])(Grid, [{
    key: "render",
    value: function render() {
      var _this$props = this.props,
          classes = _this$props.classes,
          className = _this$props.className,
          graphProps = _this$props.graphProps,
          xBand = _this$props.xBand,
          rowTickValues = _this$props.rowTickValues,
          columnTickValues = _this$props.columnTickValues;

      var _ref = graphProps || {},
          _ref$scale = _ref.scale,
          scale = _ref$scale === void 0 ? {} : _ref$scale,
          _ref$size = _ref.size,
          size = _ref$size === void 0 ? {} : _ref$size;

      return /*#__PURE__*/_react["default"].createElement(_grid.Grid, {
        xScale: xBand,
        yScale: scale.y,
        className: (0, _classnames["default"])(classes.grid, className),
        width: size.width,
        height: size.height,
        xOffset: xBand.bandwidth() / 2,
        rowTickValues: rowTickValues,
        columnTickValues: columnTickValues
      });
    }
  }]);
  return Grid;
}(_react["default"].Component);

exports.Grid = Grid;
(0, _defineProperty2["default"])(Grid, "propTypes", {
  classes: _propTypes["default"].object.isRequired,
  className: _propTypes["default"].string,
  graphProps: _plot.types.GraphPropsType.isRequired,
  xBand: _propTypes["default"].func,
  columnTickValues: _propTypes["default"].array,
  rowTickValues: _propTypes["default"].array
});
(0, _defineProperty2["default"])(Grid, "defaultProps", {});

var styles = function styles() {
  return {
    grid: {
      stroke: _renderUi.color.primaryLight()
    }
  };
};

var _default = (0, _styles.withStyles)(styles)(Grid);

exports["default"] = _default;
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9jb2RlL2NoYXJ0aW5nL2dyaWQuanN4Il0sIm5hbWVzIjpbIkdyaWQiLCJwcm9wcyIsImNsYXNzZXMiLCJjbGFzc05hbWUiLCJncmFwaFByb3BzIiwieEJhbmQiLCJyb3dUaWNrVmFsdWVzIiwiY29sdW1uVGlja1ZhbHVlcyIsInNjYWxlIiwic2l6ZSIsInkiLCJncmlkIiwid2lkdGgiLCJoZWlnaHQiLCJiYW5kd2lkdGgiLCJSZWFjdCIsIkNvbXBvbmVudCIsIlByb3BUeXBlcyIsIm9iamVjdCIsImlzUmVxdWlyZWQiLCJzdHJpbmciLCJ0eXBlcyIsIkdyYXBoUHJvcHNUeXBlIiwiZnVuYyI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