@saas-ui/forms 2.6.4 → 2.6.6
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/CHANGELOG.md +20 -5
- package/dist/index.d.mts +19 -19
- package/dist/index.d.ts +19 -19
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/create-field.tsx +1 -1
- package/src/form-context.tsx +2 -2
- package/src/watch-field.tsx +7 -5
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,20 @@
|
|
1
1
|
# @saas-ui/forms
|
2
2
|
|
3
|
+
## 2.6.6
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- Updated dependencies [12c35ea]
|
8
|
+
- Updated dependencies [b61ff73]
|
9
|
+
- @saas-ui/core@2.5.4
|
10
|
+
|
11
|
+
## 2.6.5
|
12
|
+
|
13
|
+
### Patch Changes
|
14
|
+
|
15
|
+
- 29c6fea: Fixed issue where hideLabel would not be passed to base field
|
16
|
+
- b6ce1bf: Fixed return type of useFormContext
|
17
|
+
|
3
18
|
## 2.6.4
|
4
19
|
|
5
20
|
### Patch Changes
|
@@ -1210,12 +1225,12 @@
|
|
1210
1225
|
Add this somewhere in the root of your project.
|
1211
1226
|
|
1212
1227
|
```ts
|
1213
|
-
import { Form } from
|
1214
|
-
import { yupResolver, yupFieldResolver } from
|
1215
|
-
import { AnyObjectSchema } from
|
1228
|
+
import { Form } from '@saas-ui/react'
|
1229
|
+
import { yupResolver, yupFieldResolver } from '@saas-ui/forms/yup' // yupResolver is exported from here as well for convenience.
|
1230
|
+
import { AnyObjectSchema } from 'yup'
|
1216
1231
|
|
1217
|
-
Form.getResolver = (schema: AnyObjectSchema) => yupResolver(schema)
|
1218
|
-
Form.getFieldResolver = (schema: AnyObjectSchema) => yupFieldResolver(schema)
|
1232
|
+
Form.getResolver = (schema: AnyObjectSchema) => yupResolver(schema) // @hookform/resolvers
|
1233
|
+
Form.getFieldResolver = (schema: AnyObjectSchema) => yupFieldResolver(schema) // AutoForm field resolver
|
1219
1234
|
```
|
1220
1235
|
|
1221
1236
|
- 9391c44: Fixed peer dependency issues.
|
package/dist/index.d.mts
CHANGED
@@ -843,33 +843,33 @@ declare const useFormContext: <TFieldValues extends FieldValues = FieldValues, T
|
|
843
843
|
fields?: {
|
844
844
|
[key: string]: unknown;
|
845
845
|
} | undefined;
|
846
|
-
watch: react_hook_form.UseFormWatch<
|
847
|
-
getValues: react_hook_form.UseFormGetValues<
|
848
|
-
getFieldState: react_hook_form.UseFormGetFieldState<
|
849
|
-
setError: react_hook_form.UseFormSetError<
|
850
|
-
clearErrors: react_hook_form.UseFormClearErrors<
|
851
|
-
setValue: react_hook_form.UseFormSetValue<
|
852
|
-
trigger: react_hook_form.UseFormTrigger<
|
853
|
-
formState: react_hook_form.FormState<
|
854
|
-
resetField: react_hook_form.UseFormResetField<
|
855
|
-
reset: react_hook_form.UseFormReset<
|
856
|
-
handleSubmit: react_hook_form.UseFormHandleSubmit<
|
857
|
-
unregister: react_hook_form.UseFormUnregister<
|
858
|
-
control: react_hook_form.Control<
|
859
|
-
register: react_hook_form.UseFormRegister<
|
860
|
-
setFocus: react_hook_form.UseFormSetFocus<
|
846
|
+
watch: react_hook_form.UseFormWatch<TFieldValues>;
|
847
|
+
getValues: react_hook_form.UseFormGetValues<TFieldValues>;
|
848
|
+
getFieldState: react_hook_form.UseFormGetFieldState<TFieldValues>;
|
849
|
+
setError: react_hook_form.UseFormSetError<TFieldValues>;
|
850
|
+
clearErrors: react_hook_form.UseFormClearErrors<TFieldValues>;
|
851
|
+
setValue: react_hook_form.UseFormSetValue<TFieldValues>;
|
852
|
+
trigger: react_hook_form.UseFormTrigger<TFieldValues>;
|
853
|
+
formState: react_hook_form.FormState<TFieldValues>;
|
854
|
+
resetField: react_hook_form.UseFormResetField<TFieldValues>;
|
855
|
+
reset: react_hook_form.UseFormReset<TFieldValues>;
|
856
|
+
handleSubmit: react_hook_form.UseFormHandleSubmit<TFieldValues, TFieldValues>;
|
857
|
+
unregister: react_hook_form.UseFormUnregister<TFieldValues>;
|
858
|
+
control: react_hook_form.Control<TFieldValues, TContext, TFieldValues>;
|
859
|
+
register: react_hook_form.UseFormRegister<TFieldValues>;
|
860
|
+
setFocus: react_hook_form.UseFormSetFocus<TFieldValues>;
|
861
861
|
};
|
862
|
-
type UseFormReturn<TFieldValues extends FieldValues = FieldValues, TContext = any, TSchema = any> = ReturnType<typeof useFormContext
|
862
|
+
type UseFormReturn<TFieldValues extends FieldValues = FieldValues, TContext = any, TSchema = any> = ReturnType<typeof useFormContext<TFieldValues, TContext, TSchema>>;
|
863
863
|
declare const FormProvider: <TFieldValues extends FieldValues = FieldValues, TContext = any, TSchema = any>(props: FormProviderProps<TFieldValues, TContext, TSchema>) => react_jsx_runtime.JSX.Element;
|
864
864
|
|
865
|
-
interface WatchFieldProps<Value = unknown, TFieldValues extends FieldValues = FieldValues> {
|
865
|
+
interface WatchFieldProps<Value = unknown, TFieldValues extends FieldValues = FieldValues, TContext extends object = object> {
|
866
866
|
name: string;
|
867
867
|
defaultValue?: Value;
|
868
868
|
isDisabled?: boolean;
|
869
869
|
isExact?: boolean;
|
870
|
-
children: (value: Value, form: UseFormReturn<TFieldValues>) => React.ReactElement | void;
|
870
|
+
children: (value: Value, form: UseFormReturn<TFieldValues, TContext>) => React.ReactElement | void;
|
871
871
|
}
|
872
|
-
declare const WatchField: <Value = unknown, TFieldValues extends FieldValues = FieldValues>(props: WatchFieldProps<Value, TFieldValues>) => React$1.ReactElement<any, string | React$1.JSXElementConstructor<any>> | null;
|
872
|
+
declare const WatchField: <Value = unknown, TFieldValues extends FieldValues = FieldValues, TContext extends object = object>(props: WatchFieldProps<Value, TFieldValues, TContext>) => React$1.ReactElement<any, string | React$1.JSXElementConstructor<any>> | null;
|
873
873
|
|
874
874
|
type InputRightButtonProps = ButtonProps;
|
875
875
|
declare const InputRightButton: _chakra_ui_react.ComponentWithAs<"div", ButtonProps>;
|
package/dist/index.d.ts
CHANGED
@@ -843,33 +843,33 @@ declare const useFormContext: <TFieldValues extends FieldValues = FieldValues, T
|
|
843
843
|
fields?: {
|
844
844
|
[key: string]: unknown;
|
845
845
|
} | undefined;
|
846
|
-
watch: react_hook_form.UseFormWatch<
|
847
|
-
getValues: react_hook_form.UseFormGetValues<
|
848
|
-
getFieldState: react_hook_form.UseFormGetFieldState<
|
849
|
-
setError: react_hook_form.UseFormSetError<
|
850
|
-
clearErrors: react_hook_form.UseFormClearErrors<
|
851
|
-
setValue: react_hook_form.UseFormSetValue<
|
852
|
-
trigger: react_hook_form.UseFormTrigger<
|
853
|
-
formState: react_hook_form.FormState<
|
854
|
-
resetField: react_hook_form.UseFormResetField<
|
855
|
-
reset: react_hook_form.UseFormReset<
|
856
|
-
handleSubmit: react_hook_form.UseFormHandleSubmit<
|
857
|
-
unregister: react_hook_form.UseFormUnregister<
|
858
|
-
control: react_hook_form.Control<
|
859
|
-
register: react_hook_form.UseFormRegister<
|
860
|
-
setFocus: react_hook_form.UseFormSetFocus<
|
846
|
+
watch: react_hook_form.UseFormWatch<TFieldValues>;
|
847
|
+
getValues: react_hook_form.UseFormGetValues<TFieldValues>;
|
848
|
+
getFieldState: react_hook_form.UseFormGetFieldState<TFieldValues>;
|
849
|
+
setError: react_hook_form.UseFormSetError<TFieldValues>;
|
850
|
+
clearErrors: react_hook_form.UseFormClearErrors<TFieldValues>;
|
851
|
+
setValue: react_hook_form.UseFormSetValue<TFieldValues>;
|
852
|
+
trigger: react_hook_form.UseFormTrigger<TFieldValues>;
|
853
|
+
formState: react_hook_form.FormState<TFieldValues>;
|
854
|
+
resetField: react_hook_form.UseFormResetField<TFieldValues>;
|
855
|
+
reset: react_hook_form.UseFormReset<TFieldValues>;
|
856
|
+
handleSubmit: react_hook_form.UseFormHandleSubmit<TFieldValues, TFieldValues>;
|
857
|
+
unregister: react_hook_form.UseFormUnregister<TFieldValues>;
|
858
|
+
control: react_hook_form.Control<TFieldValues, TContext, TFieldValues>;
|
859
|
+
register: react_hook_form.UseFormRegister<TFieldValues>;
|
860
|
+
setFocus: react_hook_form.UseFormSetFocus<TFieldValues>;
|
861
861
|
};
|
862
|
-
type UseFormReturn<TFieldValues extends FieldValues = FieldValues, TContext = any, TSchema = any> = ReturnType<typeof useFormContext
|
862
|
+
type UseFormReturn<TFieldValues extends FieldValues = FieldValues, TContext = any, TSchema = any> = ReturnType<typeof useFormContext<TFieldValues, TContext, TSchema>>;
|
863
863
|
declare const FormProvider: <TFieldValues extends FieldValues = FieldValues, TContext = any, TSchema = any>(props: FormProviderProps<TFieldValues, TContext, TSchema>) => react_jsx_runtime.JSX.Element;
|
864
864
|
|
865
|
-
interface WatchFieldProps<Value = unknown, TFieldValues extends FieldValues = FieldValues> {
|
865
|
+
interface WatchFieldProps<Value = unknown, TFieldValues extends FieldValues = FieldValues, TContext extends object = object> {
|
866
866
|
name: string;
|
867
867
|
defaultValue?: Value;
|
868
868
|
isDisabled?: boolean;
|
869
869
|
isExact?: boolean;
|
870
|
-
children: (value: Value, form: UseFormReturn<TFieldValues>) => React.ReactElement | void;
|
870
|
+
children: (value: Value, form: UseFormReturn<TFieldValues, TContext>) => React.ReactElement | void;
|
871
871
|
}
|
872
|
-
declare const WatchField: <Value = unknown, TFieldValues extends FieldValues = FieldValues>(props: WatchFieldProps<Value, TFieldValues>) => React$1.ReactElement<any, string | React$1.JSXElementConstructor<any>> | null;
|
872
|
+
declare const WatchField: <Value = unknown, TFieldValues extends FieldValues = FieldValues, TContext extends object = object>(props: WatchFieldProps<Value, TFieldValues, TContext>) => React$1.ReactElement<any, string | React$1.JSXElementConstructor<any>> | null;
|
873
873
|
|
874
874
|
type InputRightButtonProps = ButtonProps;
|
875
875
|
declare const InputRightButton: _chakra_ui_react.ComponentWithAs<"div", ButtonProps>;
|
package/dist/index.js
CHANGED
@@ -627,7 +627,7 @@ var _createField = (InputComponent, { displayName, hideLabel, getBaseField: getB
|
|
627
627
|
"hideLabel"
|
628
628
|
].concat(extraProps)
|
629
629
|
);
|
630
|
-
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(BaseField2, { ...props, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
630
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(BaseField2, { hideLabel, ...props, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
631
631
|
InputComponent,
|
632
632
|
{
|
633
633
|
ref,
|