"use client";
import { t as e } from "../chunks/clsx.js";
import { Button as t } from "./buttons/Button.js";
import { generatePagination as n, hidePageButtonForMobile as r, showMobileEllipsis as i } from "./Pagination.helper.js";
import { Fragment as a } from "react";
import { Icon as o } from "@clubmed/trident-icons";
import { jsx as s, jsxs as c } from "react/jsx-runtime";
//#region lib/ui/Pagination.tsx
var l = () => /* @__PURE__ */ s("li", { children: /* @__PURE__ */ s("div", {
	"aria-controls": "page-content",
	className: "text-base mx-8 ml-4 hidden size-48 items-center justify-center text-b3 font-semibold text-black md:flex",
	children: "…"
}) }, "desktop-ellipsis"), u = () => /* @__PURE__ */ s("li", { children: /* @__PURE__ */ s("div", {
	"aria-controls": "page-content",
	className: "text-base mx-8 ml-4 flex size-48 items-center justify-center text-b3 font-semibold text-black md:hidden",
	children: "…"
}) }, "mobile-ellipsis"), d = ({ defaultPage: d, buttonClassName: f = "md:mr-32", buttonLabelClassName: p = "md:flex", className: m, labels: h = {}, onChange: g, paginationFactory: _ = n, count: v, ...y }) => {
	let b = _(d, v);
	return /* @__PURE__ */ s("nav", {
		...y,
		"data-name": "Pagination",
		role: "navigation",
		"aria-label": "pagination navigation",
		className: e("flex justify-center border-t-sand", m),
		children: /* @__PURE__ */ s("ul", {
			className: "mt-12 flex",
			children: b.map((n, m) => {
				switch (n.type) {
					case "pageNumber": return /* @__PURE__ */ c(a, { children: [
						n.value === v && i(n.value, d, v) && /* @__PURE__ */ s(u, {}),
						/* @__PURE__ */ s("li", {
							className: e("mr-2", { "hidden md:flex": r(n.value, d, v) }),
							children: n.value === d ? /* @__PURE__ */ s(t, {
								"aria-current": "page",
								className: "text-white",
								color: "black",
								variant: "circle",
								children: n.value.toString()
							}) : /* @__PURE__ */ s(t, {
								className: e("size-48 items-center", { "mx-8 flex shrink-0 cursor-pointer justify-center self-start": m === b.length - 1 }),
								onClick: () => g(n.value),
								color: "white",
								variant: "circle",
								children: n.value.toString()
							})
						}),
						n.value === 1 && i(n.value, d, v) && /* @__PURE__ */ s(u, {})
					] }, `pagination-pageNumber-${m}`);
					case "ellipsis": return /* @__PURE__ */ s(l, {}, `pagination-ellipsis-${m}`);
					case "previousButton": return /* @__PURE__ */ s("li", {
						className: e(f),
						children: /* @__PURE__ */ c("button", {
							"data-action": "previous",
							"aria-controls": "page-content",
							"aria-label": `page ${d - 1}`,
							className: e("text:black text-base mx-8 flex h-48 shrink-0 items-center justify-center self-start text-b3 font-semibold active:text-black-active disabled:text-grey hocus:text-black-active", { "pointer-events-none disabled:text-grey": n.disabled }),
							disabled: n.disabled,
							onClick: () => g(d - 1),
							type: "button",
							children: [/* @__PURE__ */ s(o, {
								name: "ArrowDefaultLeft",
								width: "30px"
							}), /* @__PURE__ */ s("span", {
								className: e("ml-4 hidden border-b", { "border-black": !n.disabled }, p),
								children: h.previous
							})]
						})
					}, "pagination-labels.previous");
					case "nextButton": return /* @__PURE__ */ s("li", {
						className: e(f),
						children: /* @__PURE__ */ c("button", {
							"aria-controls": "page-content",
							"aria-label": `page ${d + 1}`,
							className: e("text:black mb-5 text-base mx-8 flex h-48 shrink-0 items-center justify-center self-start text-b3 font-semibold active:text-black-active disabled:text-grey hocus:text-black-active", { "pointer-events-none disabled:text-grey": n.disabled }),
							"data-action": "next",
							disabled: n.disabled,
							onClick: () => g(d + 1),
							type: "button",
							children: [/* @__PURE__ */ s("span", {
								className: e("ml-4 hidden border-b", { "border-black": !n.disabled }, p),
								children: h.next
							}), /* @__PURE__ */ s(o, {
								name: "ArrowDefaultRight",
								width: "30px"
							})]
						})
					}, "pagination-labels.next");
					default: return null;
				}
			})
		})
	});
};
//#endregion
export { d as Pagination };

//# sourceMappingURL=Pagination.js.map