'use client';


import { CodeInput } from "../../Input/CodeInput.mjs";
import { useFormField } from "../FormField.mjs";
import { FormItemLayout } from "../layout/FormItemLayout.mjs";
import { Form } from "../Form.mjs";
import { jsx } from "react/jsx-runtime";
import { useFormContext } from "react-hook-form";

//#region src/components/Form/elements/CodeInputElement.tsx
const CodeInputElement = ({ name, description, label, isRequired, info, showErrorMessage, ...props }) => {
	const { control } = useFormContext();
	return /* @__PURE__ */ jsx(Form.Field, {
		control,
		name,
		render: ({ field }) => {
			const { error } = useFormField();
			return /* @__PURE__ */ jsx(FormItemLayout, {
				htmlFor: name,
				label,
				description,
				isRequired,
				info,
				showErrorMessage,
				"aria-invalid": !!error,
				children: /* @__PURE__ */ jsx(CodeInput, {
					onValueChange: field.onChange,
					value: field.value,
					"aria-invalid": !!error,
					...props
				})
			});
		}
	});
};

//#endregion
export { CodeInputElement };
//# sourceMappingURL=CodeInputElement.mjs.map