UNPKG

@payfit/unity-components

Version:

25 lines (24 loc) 878 B
import { Text as e } from "../../text/Text.js"; import { useFormField as t } from "../FormField.context.js"; import { forwardRef as n } from "react"; import { jsx as r } from "react/jsx-runtime"; import { useController as i, useFormContext as a } from "react-hook-form"; //#region src/components/form-field/parts/FormFeedbackText.tsx var o = n(({ children: n, ...o }, s) => { let { name: c, formMessageId: l } = t(), u = i({ name: c, control: a().control }), d = u.fieldState.error, f = u.fieldState.invalid, p = d ? String(d.message) : n; return !f || !p ? null : /* @__PURE__ */ r(e, { ...o, id: l, ref: s, "data-unity-slot": "form-feedback-text", className: "uy:typography-body-small-strong uy:text-content-form-invalid", "data-dd-privacy": "allow", children: p }); }); o.displayName = "FormFeedbackText"; //#endregion export { o as FormFeedbackText };