@codecademy/gamut
71.0.071.0.1-alpha.c9e50f.0
dist/ConnectedForm/utils.d.ts~
dist/ConnectedForm/utils.d.tsModified+4−3
Index: package/dist/ConnectedForm/utils.d.ts
===================================================================
--- package/dist/ConnectedForm/utils.d.ts
+++ package/dist/ConnectedForm/utils.d.ts
@@ -63,10 +63,11 @@
watch: import("react-hook-form").UseFormWatch<import("react-hook-form").FieldValues>;
};
interface useFieldProps extends SubmitContextProps {
name: string;
+ customValidations?: RegisterOptions;
}
-export declare const useField: ({ name, disabled, loading }: useFieldProps) => {
+export declare const useField: ({ name, disabled, loading, customValidations, }: useFieldProps) => {
control: import("react-hook-form").Control<import("react-hook-form").FieldValues, any, import("react-hook-form").FieldValues>;
error: string | FieldError | Merge<FieldError, FieldErrorsImpl<any>> | undefined;
getValues: import("react-hook-form").UseFormGetValues<import("react-hook-form").FieldValues>;
isDisabled: boolean;
@@ -111,13 +112,13 @@
* for something that I think could be modified to make this better
* but I couldn't get it to work
*/
type InputTypes = Extract<HTMLInputTypeAttribute, 'number' | 'color' | 'date' | 'datetime-local' | 'time' | 'image' | 'checkbox' | 'text' | 'hidden' | 'password' | 'radio' | 'range' | 'email' | 'search' | 'month' | 'tel' | 'time' | 'url' | 'week'> | 'textarea' | 'select';
-type DebouncedFieldProps<T extends InputTypes> = Omit<GetInitialFormValueProps, 'setLocalValue' | 'defaultValue'> & Pick<useFieldProps, 'loading' | 'disabled' | 'name'> & {
+type DebouncedFieldProps<T extends InputTypes> = Omit<GetInitialFormValueProps, 'setLocalValue' | 'defaultValue'> & Pick<useFieldProps, 'loading' | 'disabled' | 'name' | 'customValidations'> & {
type: T;
shouldDirtyOnChange?: boolean;
};
-export declare function useDebouncedField<T extends InputTypes>({ name, watchUpdateKeyName, disabled, loading, type, shouldDirtyOnChange, }: DebouncedFieldProps<T>): {
+export declare function useDebouncedField<T extends InputTypes>({ name, watchUpdateKeyName, disabled, loading, type, shouldDirtyOnChange, customValidations, }: DebouncedFieldProps<T>): {
onBlur: () => void;
onChange: ChangeEventHandler<HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement>;
value: T extends "checkbox" ? boolean : string;
error: string | FieldError | Merge<FieldError, FieldErrorsImpl<any>> | undefined;