import { j as t } from "../../_virtual/jsx-runtime.js";
import { PaginationControl as j } from "./styles.js";
import { IconButton as m } from "../IconButton/index.js";
import { getNumberOfPages as l } from "./utils.js";
import v from "./components/WidePagination.js";
import b from "./components/NarrowPagination.js";
import { getId as e } from "../../utils/index.js";
import u from "../../icons/ChevronLeft.js";
import w from "../../icons/ChevronRight.js";
function T({
  rowsPerPage: r,
  totalItems: s,
  currentPage: i,
  onChangePage: a,
  variant: p = "wide",
  alignment: x = "right",
  paginationLimiter: c,
  narrowPaginationText: f,
  ...o
}) {
  const d = e(o["data-testid"]), n = e(o["data-trackid"]), k = l(s, r);
  return /* @__PURE__ */ t.jsxs(
    j,
    {
      alignment: x,
      "data-testid": o["data-testid"],
      "data-trackid": o["data-trackid"],
      role: "navigation",
      children: [
        /* @__PURE__ */ t.jsx(
          m,
          {
            icon: /* @__PURE__ */ t.jsx(u, {}),
            variant: "ghost-tertiary",
            size: "x-small",
            disabled: i === 1,
            onClick: () => a(i - 1),
            "data-testid": d("button-previous"),
            "data-trackid": n("button-previous")
          }
        ),
        p === "wide" ? /* @__PURE__ */ t.jsx(
          v,
          {
            variant: "wide",
            rowsPerPage: r,
            onChangePage: a,
            currentPage: i,
            totalItems: s,
            paginationLimiter: c,
            "data-testid": d("wide-pagination"),
            "data-trackid": n("wide-pagination")
          }
        ) : /* @__PURE__ */ t.jsx(
          b,
          {
            variant: "narrow",
            rowsPerPage: r,
            onChangePage: a,
            currentPage: i,
            totalItems: s,
            narrowPaginationText: f,
            "data-testid": d("narrow-pagination"),
            "data-trackid": n("narrow-pagination")
          }
        ),
        /* @__PURE__ */ t.jsx(
          m,
          {
            icon: /* @__PURE__ */ t.jsx(w, {}),
            variant: "ghost-tertiary",
            size: "x-small",
            disabled: i === k,
            onClick: () => a(i + 1),
            "data-testid": d("button-next"),
            "data-trackid": n("button-next")
          }
        )
      ]
    }
  );
}
export {
  T as Pagination
};
