@underverse-ui/underverse 0.1.14 → 0.1.15

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 CHANGED
@@ -8705,11 +8705,15 @@ var useFormField = () => {
8705
8705
  const fieldContext = React31.useContext(FormFieldContext);
8706
8706
  const itemContext = React31.useContext(FormItemContext);
8707
8707
  const { getFieldState, formState } = useFormContext();
8708
- const t = (0, import_next_intl8.useTranslations)("Form");
8709
- const fieldState = getFieldState(fieldContext.name, formState);
8710
8708
  if (!fieldContext) {
8711
- throw new Error(t("validation.mustBeUsedWithinForm"));
8709
+ try {
8710
+ const t = (0, import_next_intl8.useTranslations)("Form");
8711
+ throw new Error(t("validation.mustBeUsedWithinForm"));
8712
+ } catch {
8713
+ throw new Error("useFormField must be used within FormField");
8714
+ }
8712
8715
  }
8716
+ const fieldState = getFieldState(fieldContext.name, formState);
8713
8717
  const { id } = itemContext;
8714
8718
  return {
8715
8719
  id,