import { jsx } from "react/jsx-runtime";
import { DSFormItemLayout } from "@elliemae/ds-form";
import { useFormState, get } from "react-hook-form";
const FormItemLayout = ({ name, ...rest }) => {
  const { errors } = useFormState({ name });
  const errorField = get(errors, name);
  const hasError = !!errorField;
  const validationMessage = errorField?.message;
  return /* @__PURE__ */ jsx(
    DSFormItemLayout,
    {
      name,
      hasError,
      validationMessage,
      ...rest
    }
  );
};
export {
  FormItemLayout
};
