"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _react = _interopRequireDefault(require("react"));
var _index = require("../../../index");
var _PageItems = _interopRequireDefault(require("../PageItems"));
var _ChevronIcon = _interopRequireDefault(require("./components/ChevronIcon"));
var _LargeComponents = require("./components/LargeComponents");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var PageItem = function PageItem(_ref) {
  var _ref$isCurrentPage = _ref.isCurrentPage,
    isCurrentPage = _ref$isCurrentPage === void 0 ? false : _ref$isCurrentPage,
    onClick = _ref.onClick,
    children = _ref.children,
    label = _ref.label;
  return _react.default.createElement(_index.Flexbox, {
    item: true,
    as: "li"
  }, isCurrentPage ? _react.default.createElement(_LargeComponents.StyledCurrentPageBox, {
    container: true
  }, _react.default.createElement(_index.Typography, {
    type: "primary",
    color: function color(t) {
      return t.color.buttonText;
    },
    weight: "bold"
  }, children)) : _react.default.createElement(_LargeComponents.StyledButton, {
    $type: "page-item",
    onClick: onClick,
    "aria-label": "".concat(label, " ").concat(children)
  }, _react.default.createElement(_index.Typography, {
    type: "primary",
    color: function color(t) {
      return t.color.text;
    },
    weight: "bold"
  }, children)));
};
var ChevronButton = function ChevronButton(_ref2) {
  var direction = _ref2.direction,
    onClick = _ref2.onClick,
    label = _ref2.label;
  return _react.default.createElement(_index.Flexbox, {
    item: true,
    container: true,
    alignItems: "center"
  }, _react.default.createElement(_LargeComponents.StyledButton, {
    $type: "chevron",
    onClick: onClick,
    "aria-label": label
  }, _react.default.createElement(_ChevronIcon.default, {
    direction: direction,
    size: 16,
    inline: true
  })));
};
var Large = function Large(_ref3) {
  var currentPage = _ref3.currentPage,
    numberOfPages = _ref3.numberOfPages,
    onClickPageItem = _ref3.onClickPageItem,
    onClickPrevious = _ref3.onClickPrevious,
    onClickNext = _ref3.onClickNext,
    previousPageLabel = _ref3.previousPageLabel,
    nextPageLabel = _ref3.nextPageLabel,
    currentPageLabel = _ref3.currentPageLabel,
    pageItemLabel = _ref3.pageItemLabel;
  if (numberOfPages <= 1) {
    return null;
  }
  return _react.default.createElement(_index.Flexbox, {
    container: true
  }, currentPage !== 1 && _react.default.createElement(ChevronButton, {
    direction: "left",
    onClick: onClickPrevious,
    label: previousPageLabel
  }), _react.default.createElement(_LargeComponents.StyledList, {
    $numberOfPages: numberOfPages
  }, _react.default.createElement(_PageItems.default, {
    currentPage: currentPage,
    numberOfPages: numberOfPages,
    onClickPageItem: onClickPageItem,
    PageItem: PageItem,
    TruncatedPageNumbers: _LargeComponents.TruncatedPageNumbers,
    currentPageLabel: currentPageLabel,
    pageItemLabel: pageItemLabel
  })), currentPage !== numberOfPages && _react.default.createElement(ChevronButton, {
    direction: "right",
    onClick: onClickNext,
    label: nextPageLabel
  }));
};
var _default = exports.default = _react.default.memo(Large);