"use client";
import { createVarsResolver } from "../../core/styles-api/create-vars-resolver/create-vars-resolver.mjs";
import { useProps } from "../../core/MantineProvider/use-props/use-props.mjs";
import { useStyles } from "../../core/styles-api/use-styles/use-styles.mjs";
import { useRandomClassName } from "../../core/Box/use-random-classname/use-random-classname.mjs";
import { factory } from "../../core/factory/factory.mjs";
import { Box } from "../../core/Box/Box.mjs";
import { GridProvider } from "./Grid.context.mjs";
import Grid_module_default from "./Grid.module.mjs";
import { GridCol } from "./GridCol/GridCol.mjs";
import { GridVariables } from "./GridVariables.mjs";
import { jsx, jsxs } from "react/jsx-runtime";
//#region packages/@mantine/core/src/components/Grid/Grid.tsx
const defaultProps = {
	gap: "md",
	columns: 12
};
const varsResolver = createVarsResolver((_, { justify, align, overflow }) => ({ root: {
	"--grid-justify": justify,
	"--grid-align": align,
	"--grid-overflow": overflow
} }));
const Grid = factory((_props) => {
	const props = useProps("Grid", defaultProps, _props);
	const { classNames, className, style, styles, unstyled, vars, grow, gap, rowGap, columnGap, columns, align, justify, children, breakpoints, type, attributes, ...others } = props;
	const getStyles = useStyles({
		name: "Grid",
		classes: Grid_module_default,
		props,
		className,
		style,
		classNames,
		styles,
		unstyled,
		attributes,
		vars,
		varsResolver
	});
	const responsiveClassName = useRandomClassName();
	if (type === "container" && breakpoints) return /* @__PURE__ */ jsxs(GridProvider, {
		value: {
			getStyles,
			grow,
			columns,
			breakpoints,
			type
		},
		children: [/* @__PURE__ */ jsx(GridVariables, {
			selector: `.${responsiveClassName}`,
			...props
		}), /* @__PURE__ */ jsx("div", {
			...getStyles("container"),
			children: /* @__PURE__ */ jsx(Box, {
				...getStyles("root", { className: responsiveClassName }),
				...others,
				children: /* @__PURE__ */ jsx("div", {
					...getStyles("inner"),
					children
				})
			})
		})]
	});
	return /* @__PURE__ */ jsxs(GridProvider, {
		value: {
			getStyles,
			grow,
			columns,
			breakpoints,
			type
		},
		children: [/* @__PURE__ */ jsx(GridVariables, {
			selector: `.${responsiveClassName}`,
			...props
		}), /* @__PURE__ */ jsx(Box, {
			...getStyles("root", { className: responsiveClassName }),
			...others,
			children: /* @__PURE__ */ jsx("div", {
				...getStyles("inner"),
				children
			})
		})]
	});
});
Grid.classes = Grid_module_default;
Grid.varsResolver = varsResolver;
Grid.displayName = "@mantine/core/Grid";
Grid.Col = GridCol;
//#endregion
export { Grid };

//# sourceMappingURL=Grid.mjs.map