/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
"use client";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
require("../../../_virtual/_rolldown/runtime.cjs");
const require_utils_createSlot = require("../../../utils/createSlot.cjs");
const require_components_client_Pagination_paginationContext = require("./paginationContext.cjs");
const require_components_client_Pagination_paginationStyles = require("./paginationStyles.cjs");
let react = require("react");
let react_jsx_runtime = require("react/jsx-runtime");
//#region src/components/client/Pagination/PaginationItem.tsx
const Slot = require_utils_createSlot.createSlot();
const PaginationItem = (0, react.forwardRef)(function PaginationItem({ page, asChild = false, children, className, onClick, ...rest }, ref) {
	const { activePage, size, variant, getItemAriaLabel, onPageChange } = require_components_client_Pagination_paginationContext.usePaginationContext();
	const isActive = page === activePage;
	const itemClass = require_components_client_Pagination_paginationStyles.usePaginationItemClassName(size, variant, isActive, className);
	const labelClass = require_components_client_Pagination_paginationStyles.usePaginationItemLabelClassName(size);
	const ariaLabel = getItemAriaLabel(page, isActive);
	const handleClick = (event) => {
		onClick?.(event);
		if (!event.defaultPrevented && !isActive) onPageChange?.(page);
	};
	const label = children ?? page;
	const Comp = asChild ? Slot : "button";
	if (asChild && (0, react.isValidElement)(children)) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Comp, {
		ref,
		type: "button",
		className: itemClass,
		"aria-current": isActive ? "page" : void 0,
		"aria-label": ariaLabel,
		onClick: isActive ? void 0 : handleClick,
		disabled: isActive,
		...rest,
		children
	});
	return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Comp, {
		ref,
		type: "button",
		className: itemClass,
		"aria-current": isActive ? "page" : void 0,
		"aria-label": ariaLabel,
		onClick: isActive ? void 0 : handleClick,
		disabled: isActive,
		...rest,
		children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
			className: labelClass,
			children: label
		})
	});
});
PaginationItem.displayName = "PaginationItem";
//#endregion
exports.PaginationItem = PaginationItem;
