"use client";
import { getFontSize } from "../../../core/utils/get-size/get-size.mjs";
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 { factory } from "../../../core/factory/factory.mjs";
import { Box } from "../../../core/Box/Box.mjs";
import { InputWrapperContext } from "../InputWrapper.context.mjs";
import Input_module_default from "../Input.module.mjs";
import { use } from "react";
import { jsx, jsxs } from "react/jsx-runtime";
//#region packages/@mantine/core/src/components/Input/InputLabel/InputLabel.tsx
const defaultProps = { labelElement: "label" };
const varsResolver = createVarsResolver((_, { size }) => ({ label: {
	"--input-label-size": getFontSize(size),
	"--input-asterisk-color": void 0
} }));
const InputLabel = factory((_props) => {
	const props = useProps("InputLabel", defaultProps, _props);
	const { classNames, className, style, styles, unstyled, vars, labelElement, required, htmlFor, onMouseDown, children, __staticSelector, mod, attributes, ...others } = props;
	const _getStyles = useStyles({
		name: ["InputWrapper", __staticSelector],
		props,
		classes: Input_module_default,
		className,
		style,
		classNames,
		styles,
		unstyled,
		attributes,
		rootSelector: "label",
		vars,
		varsResolver
	});
	const ctx = use(InputWrapperContext);
	const getStyles = ctx?.getStyles || _getStyles;
	return /* @__PURE__ */ jsxs(Box, {
		...getStyles("label", ctx?.getStyles ? {
			className,
			style
		} : void 0),
		component: labelElement,
		htmlFor: labelElement === "label" ? htmlFor : void 0,
		mod: [{ required }, mod],
		onMouseDown: (event) => {
			onMouseDown?.(event);
			if (!event.defaultPrevented && event.detail > 1) event.preventDefault();
		},
		...others,
		children: [children, required && /* @__PURE__ */ jsx("span", {
			...getStyles("required"),
			"aria-hidden": true,
			children: " *"
		})]
	});
});
InputLabel.classes = Input_module_default;
InputLabel.varsResolver = varsResolver;
InputLabel.displayName = "@mantine/core/InputLabel";
//#endregion
export { InputLabel };

//# sourceMappingURL=InputLabel.mjs.map