"use client";
const require_use_props = require("../../core/MantineProvider/use-props/use-props.cjs");
const require_factory = require("../../core/factory/factory.cjs");
const require_Box = require("../../core/Box/Box.cjs");
const require_Group = require("../Group/Group.cjs");
const require_Pagination_context = require("./Pagination.context.cjs");
const require_Pagination_module = require("./Pagination.module.cjs");
const require_PaginationControl = require("./PaginationControl/PaginationControl.cjs");
const require_PaginationDots = require("./PaginationDots/PaginationDots.cjs");
const require_PaginationEdges = require("./PaginationEdges/PaginationEdges.cjs");
const require_PaginationItems = require("./PaginationItems/PaginationItems.cjs");
const require_PaginationLabel = require("./PaginationLabel/PaginationLabel.cjs");
const require_PaginationRoot = require("./PaginationRoot/PaginationRoot.cjs");
let react_jsx_runtime = require("react/jsx-runtime");
//#region packages/@mantine/core/src/components/Pagination/Pagination.tsx
const defaultProps = {
	withControls: true,
	withPages: true,
	siblings: 1,
	boundaries: 1,
	gap: 8
};
function PaginationItemsGroup({ children }) {
	return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Box.Box, {
		...require_Pagination_context.usePaginationContext().getStyles("items"),
		children
	});
}
const Pagination = require_factory.factory((_props) => {
	const { withEdges, withControls, getControlProps, nextIcon, previousIcon, lastIcon, firstIcon, dotsIcon, total, gap, hideWithOnePage, withPages, layout, formatLabel, ...others } = require_use_props.useProps("Pagination", defaultProps, _props);
	if (total <= 0 || hideWithOnePage && total === 1) return null;
	const pagesContent = withPages ? layout === "responsive" ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(PaginationItemsGroup, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_PaginationItems.PaginationItems, { dotsIcon }) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_PaginationLabel.PaginationLabel, { formatLabel })] }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_PaginationItems.PaginationItems, { dotsIcon }) : null;
	return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_PaginationRoot.PaginationRoot, {
		total,
		layout,
		...others,
		children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_Group.Group, {
			gap,
			children: [
				withEdges && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_PaginationEdges.PaginationFirst, {
					icon: firstIcon,
					...getControlProps?.("first")
				}),
				withControls && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_PaginationEdges.PaginationPrevious, {
					icon: previousIcon,
					...getControlProps?.("previous")
				}),
				pagesContent,
				withControls && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_PaginationEdges.PaginationNext, {
					icon: nextIcon,
					...getControlProps?.("next")
				}),
				withEdges && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_PaginationEdges.PaginationLast, {
					icon: lastIcon,
					...getControlProps?.("last")
				})
			]
		})
	});
});
Pagination.classes = require_Pagination_module.default;
Pagination.displayName = "@mantine/core/Pagination";
Pagination.Root = require_PaginationRoot.PaginationRoot;
Pagination.Control = require_PaginationControl.PaginationControl;
Pagination.Dots = require_PaginationDots.PaginationDots;
Pagination.First = require_PaginationEdges.PaginationFirst;
Pagination.Last = require_PaginationEdges.PaginationLast;
Pagination.Next = require_PaginationEdges.PaginationNext;
Pagination.Previous = require_PaginationEdges.PaginationPrevious;
Pagination.Items = require_PaginationItems.PaginationItems;
Pagination.Label = require_PaginationLabel.PaginationLabel;
//#endregion
exports.Pagination = Pagination;

//# sourceMappingURL=Pagination.cjs.map