@underverse-ui/underverse 0.1.14 → 0.1.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +7 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +7 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -8562,11 +8562,15 @@ var useFormField = () => {
|
|
|
8562
8562
|
const fieldContext = React31.useContext(FormFieldContext);
|
|
8563
8563
|
const itemContext = React31.useContext(FormItemContext);
|
|
8564
8564
|
const { getFieldState, formState } = useFormContext();
|
|
8565
|
-
const t = useTranslations8("Form");
|
|
8566
|
-
const fieldState = getFieldState(fieldContext.name, formState);
|
|
8567
8565
|
if (!fieldContext) {
|
|
8568
|
-
|
|
8566
|
+
try {
|
|
8567
|
+
const t = useTranslations8("Form");
|
|
8568
|
+
throw new Error(t("validation.mustBeUsedWithinForm"));
|
|
8569
|
+
} catch {
|
|
8570
|
+
throw new Error("useFormField must be used within FormField");
|
|
8571
|
+
}
|
|
8569
8572
|
}
|
|
8573
|
+
const fieldState = getFieldState(fieldContext.name, formState);
|
|
8570
8574
|
const { id } = itemContext;
|
|
8571
8575
|
return {
|
|
8572
8576
|
id,
|