"use client";
import { useProps } from "../../core/MantineProvider/use-props/use-props.mjs";
import { factory } from "../../core/factory/factory.mjs";
import { InputBase } from "../InputBase/InputBase.mjs";
import { PillsInputContext } from "./PillsInput.context.mjs";
import { PillsInputField } from "./PillsInputField/PillsInputField.mjs";
import { useRef } from "react";
import { jsx } from "react/jsx-runtime";
//#region packages/@mantine/core/src/components/PillsInput/PillsInput.tsx
const defaultProps = { size: "sm" };
const PillsInput = factory((_props) => {
	const { children, onMouseDown, onClick, size, disabled, __staticSelector, error, variant, ...others } = useProps([
		"Input",
		"InputWrapper",
		"PillsInput"
	], defaultProps, _props);
	const fieldRef = useRef(null);
	return /* @__PURE__ */ jsx(PillsInputContext, {
		value: {
			fieldRef,
			size,
			disabled,
			hasError: !!error,
			variant
		},
		children: /* @__PURE__ */ jsx(InputBase, {
			size,
			error,
			variant,
			component: "div",
			"data-no-overflow": true,
			onMouseDown: (event) => {
				event.preventDefault();
				onMouseDown?.(event);
				fieldRef.current?.focus();
			},
			onClick: (event) => {
				event.preventDefault();
				if (!event.currentTarget.closest("fieldset")?.disabled) {
					fieldRef.current?.focus();
					onClick?.(event);
				}
			},
			...others,
			multiline: true,
			disabled,
			__staticSelector: __staticSelector || "PillsInput",
			withAria: false,
			children
		})
	});
});
PillsInput.displayName = "@mantine/core/PillsInput";
PillsInput.classes = InputBase.classes;
PillsInput.Field = PillsInputField;
//#endregion
export { PillsInput };

//# sourceMappingURL=PillsInput.mjs.map