import { cs } from "../utils/styles.js";
import { useStyleConfig } from "../core/theme.js";
import vui from "../core/vui.js";
import Box from "../box/box.js";
import T from "../t/t.js";
import Input from "../input/input.js";
import { usePaginationContext } from "./context.js";
import { jsx, jsxs } from "react/jsx-runtime";

//#region src/pagination/paginationGoToPage.tsx
/** Displays a number input, which allows quickly jumping between pages. */
const PaginationGoToPage = vui((props, ref) => {
	const { className, ...rest } = props;
	const { onPageChange, pageCount } = usePaginationContext();
	const styles = useStyleConfig("Pagination", usePaginationContext());
	const onChange = (e) => {
		const value = +e.target.value;
		if (value >= 1 && value <= pageCount) onPageChange(Math.floor(value));
	};
	return /* @__PURE__ */ jsxs(Box, {
		centerV: true,
		className: cs("vui-paginationGoToPage", className),
		lineHeight: "normal",
		ref,
		...styles.goToPage,
		...rest,
		children: [
			/* @__PURE__ */ jsx(T, {
				size: "sm",
				variant: "navigation",
				fontWeight: "medium",
				children: "Go\xA0to"
			}),
			/* @__PURE__ */ jsx(Input, {
				max: pageCount,
				min: 1,
				mx: 1,
				onChange,
				size: "sm",
				type: "number",
				w: 56
			}),
			/* @__PURE__ */ jsx(T, {
				size: "sm",
				variant: "navigation",
				fontWeight: "medium",
				children: "Page"
			})
		]
	});
});
PaginationGoToPage.displayName = "PaginationGoToPage";

//#endregion
export { PaginationGoToPage as default };
globalThis.__vuiVersion__ = "4.0.1"
//# sourceMappingURL=paginationGoToPage.js.map