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); }

import React from "react";
import style from "./Pagination.module.css";
import Box from "../layout/Box";
import Button from "../deprecated/button/Button";
import BoxConstantProps from "../layout/Box.constantProps";
import Link from "../link/Link";
export default function Pagination(props) {
  let {
    options,
    onClick,
    onNextClick,
    onPreviousClick,
    dataId,
    justifyContent,
    isStretch,
    isNext,
    isPrevious,
    previousButtonOptions,
    nextButtonOptions
  } = props;
  return /*#__PURE__*/React.createElement(Box, {
    tagName: "ul",
    tagAttributeProps: {
      "data-id": dataId
    },
    isCover: false,
    direction: BoxConstantProps.direction.row,
    justifyContent: justifyContent,
    isContainer: true,
    customClassName: style.base
  }, isPrevious ? /*#__PURE__*/React.createElement(Button, _extends({
    onClick: onPreviousClick && onPreviousClick
  }, previousButtonOptions)) : null, options.length && options.map((obj, i) => {
    let extraStyle = `${obj.isSelected ? style.itemHighlight : style.item} ${obj.disabled ? style.disabled : ""}`;
    return /*#__PURE__*/React.createElement(Box, {
      key: i,
      tagName: "li",
      customClassName: extraStyle,
      flexible: isStretch,
      tagAttributeProps: {
        onClick: onClick && onClick.bind(this, obj)
      }
    }, obj.href ? /*#__PURE__*/React.createElement(Link, {
      text: obj.name,
      target: "_blank",
      href: obj.href
    }) : obj.name);
  }), isNext ? /*#__PURE__*/React.createElement(Button, _extends({
    onClick: onNextClick && onNextClick
  }, nextButtonOptions)) : null);
}