"use client";
import { useProps } from "../../core/MantineProvider/use-props/use-props.mjs";
import { factory } from "../../core/factory/factory.mjs";
import { Box } from "../../core/Box/Box.mjs";
import { Group } from "../Group/Group.mjs";
import { usePaginationContext } from "./Pagination.context.mjs";
import Pagination_module_default from "./Pagination.module.mjs";
import { PaginationControl } from "./PaginationControl/PaginationControl.mjs";
import { PaginationDots } from "./PaginationDots/PaginationDots.mjs";
import { PaginationFirst, PaginationLast, PaginationNext, PaginationPrevious } from "./PaginationEdges/PaginationEdges.mjs";
import { PaginationItems } from "./PaginationItems/PaginationItems.mjs";
import { PaginationLabel } from "./PaginationLabel/PaginationLabel.mjs";
import { PaginationRoot } from "./PaginationRoot/PaginationRoot.mjs";
import { Fragment, jsx, jsxs } from "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__ */ jsx(Box, {
		...usePaginationContext().getStyles("items"),
		children
	});
}
const Pagination = factory((_props) => {
	const { withEdges, withControls, getControlProps, nextIcon, previousIcon, lastIcon, firstIcon, dotsIcon, total, gap, hideWithOnePage, withPages, layout, formatLabel, ...others } = useProps("Pagination", defaultProps, _props);
	if (total <= 0 || hideWithOnePage && total === 1) return null;
	const pagesContent = withPages ? layout === "responsive" ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(PaginationItemsGroup, { children: /* @__PURE__ */ jsx(PaginationItems, { dotsIcon }) }), /* @__PURE__ */ jsx(PaginationLabel, { formatLabel })] }) : /* @__PURE__ */ jsx(PaginationItems, { dotsIcon }) : null;
	return /* @__PURE__ */ jsx(PaginationRoot, {
		total,
		layout,
		...others,
		children: /* @__PURE__ */ jsxs(Group, {
			gap,
			children: [
				withEdges && /* @__PURE__ */ jsx(PaginationFirst, {
					icon: firstIcon,
					...getControlProps?.("first")
				}),
				withControls && /* @__PURE__ */ jsx(PaginationPrevious, {
					icon: previousIcon,
					...getControlProps?.("previous")
				}),
				pagesContent,
				withControls && /* @__PURE__ */ jsx(PaginationNext, {
					icon: nextIcon,
					...getControlProps?.("next")
				}),
				withEdges && /* @__PURE__ */ jsx(PaginationLast, {
					icon: lastIcon,
					...getControlProps?.("last")
				})
			]
		})
	});
});
Pagination.classes = Pagination_module_default;
Pagination.displayName = "@mantine/core/Pagination";
Pagination.Root = PaginationRoot;
Pagination.Control = PaginationControl;
Pagination.Dots = PaginationDots;
Pagination.First = PaginationFirst;
Pagination.Last = PaginationLast;
Pagination.Next = PaginationNext;
Pagination.Previous = PaginationPrevious;
Pagination.Items = PaginationItems;
Pagination.Label = PaginationLabel;
//#endregion
export { Pagination };

//# sourceMappingURL=Pagination.mjs.map