import { jsx, Fragment } from "react/jsx-runtime";
import { usePaginationContext } from "../Pagination.context.mjs";
import { PaginationControl } from "../PaginationControl/PaginationControl.mjs";
import { PaginationDots } from "../PaginationDots/PaginationDots.mjs";
function PaginationItems({ dotsIcon }) {
  const ctx = usePaginationContext();
  const items = ctx.range.map((page, index) => {
    var _a, _b, _c;
    if (page === "dots") {
      return /* @__PURE__ */ jsx(PaginationDots, { icon: dotsIcon }, index);
    }
    return /* @__PURE__ */ jsx(
      PaginationControl,
      {
        active: page === ctx.active,
        "aria-current": page === ctx.active ? "page" : void 0,
        onClick: () => ctx.onChange(page),
        disabled: ctx.disabled,
        ...(_a = ctx.getItemProps) == null ? void 0 : _a.call(ctx, page),
        children: ((_c = (_b = ctx.getItemProps) == null ? void 0 : _b.call(ctx, page)) == null ? void 0 : _c.children) ?? page
      },
      index
    );
  });
  return /* @__PURE__ */ jsx(Fragment, { children: items });
}
PaginationItems.displayName = "@mantine/core/PaginationItems";
export {
  PaginationItems
};
