import { cs } from "../utils/styles.js";
import { useStyleConfig } from "../core/theme.js";
import vui from "../core/vui.js";
import Button from "../button/button.js";
import { usePaginationContext } from "./context.js";
import { jsx } from "react/jsx-runtime";

//#region src/pagination/paginationPrevNext.tsx
/** Displays a page navigation button, which navigates forward or backward. */
const PaginationPrevNext = vui((props, ref) => {
	const { className, direction, ...rest } = props;
	const { onPageChange, page, pageCount } = usePaginationContext();
	const styles = useStyleConfig("Pagination", usePaginationContext());
	const isPrev = direction === "previous";
	const pageChange = isPrev ? -1 : 1;
	const directionProps = {
		disabled: isPrev ? page === 1 : page === pageCount,
		icon: `falAngle${isPrev ? "Left" : "Right"}`,
		onClick: () => onPageChange(page + pageChange)
	};
	return /* @__PURE__ */ jsx(Button, {
		className: cs("vui-paginationPrevNext", className),
		minW: 0,
		ref,
		size: "sm",
		variant: "text",
		...styles.prevNext,
		...directionProps,
		...rest
	});
});
PaginationPrevNext.displayName = "PaginationPrevNext";

//#endregion
export { PaginationPrevNext as default };
globalThis.__vuiVersion__ = "4.0.0-beta.1"
//# sourceMappingURL=paginationPrevNext.js.map