Skip to content

Commit

Permalink
Add build files
Browse files Browse the repository at this point in the history
  • Loading branch information
fbarbare committed Aug 6, 2024
1 parent dbffffe commit c7e7cf6
Show file tree
Hide file tree
Showing 19 changed files with 4,749 additions and 0 deletions.
16 changes: 16 additions & 0 deletions packages/formik/dist/ErrorMessage.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/// <reference types="hoist-non-react-statics" />
import * as React from 'react';
import { FormikContextType } from './types';
export interface ErrorMessageProps {
id?: string;
name: string;
className?: string;
component?: string | React.ComponentType;
children?: (errorMessage: string) => React.ReactNode;
render?: (errorMessage: string) => React.ReactNode;
}
export declare const ErrorMessage: React.FC<ErrorMessageProps> & import("hoist-non-react-statics").NonReactStatics<React.ComponentClass<ErrorMessageProps & {
formik: FormikContextType<ErrorMessageProps & {
formik: FormikContextType<any>;
}>;
}, any>, {}>;
15 changes: 15 additions & 0 deletions packages/formik/dist/FastField.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/// <reference types="hoist-non-react-statics" />
import * as React from 'react';
import { FormikProps, GenericFieldHTMLAttributes, FieldMetaProps, FieldInputProps } from './types';
import { FieldConfig } from './Field';
export interface FastFieldProps<V = any> {
field: FieldInputProps<V>;
meta: FieldMetaProps<V>;
form: FormikProps<V>;
}
export type FastFieldConfig<T> = FieldConfig & {
/** Override FastField's default shouldComponentUpdate */
shouldUpdate?: (nextProps: T & GenericFieldHTMLAttributes, props: {}) => boolean;
};
export type FastFieldAttributes<T> = GenericFieldHTMLAttributes & FastFieldConfig<T> & T;
export declare const FastField: React.FC<any> & import("hoist-non-react-statics").NonReactStatics<React.ComponentClass<any, any>, {}>;
53 changes: 53 additions & 0 deletions packages/formik/dist/Field.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import * as React from 'react';
import { FormikProps, GenericFieldHTMLAttributes, FieldMetaProps, FieldHelperProps, FieldInputProps, FieldValidator } from './types';
export interface FieldProps<V = any, FormValues = any> {
field: FieldInputProps<V>;
form: FormikProps<FormValues>;
meta: FieldMetaProps<V>;
}
export interface FieldConfig<V = any> {
/**
* Field component to render. Can either be a string like 'select' or a component.
*/
component?: string | React.ComponentType<FieldProps<V>> | React.ComponentType | React.ForwardRefExoticComponent<any>;
/**
* Component to render. Can either be a string e.g. 'select', 'input', or 'textarea', or a component.
*/
as?: React.ComponentType<FieldProps<V>['field']> | string | React.ComponentType | React.ForwardRefExoticComponent<any>;
/**
* Render prop (works like React router's <Route render={props =>} />)
* @deprecated
*/
render?: (props: FieldProps<V>) => React.ReactNode;
/**
* Children render function <Field name>{props => ...}</Field>)
*/
children?: ((props: FieldProps<V>) => React.ReactNode) | React.ReactNode;
/**
* Validate a single field value independently
*/
validate?: FieldValidator;
/**
* Used for 'select' and related input types.
*/
multiple?: boolean;
/**
* Field name
*/
name: string;
/** HTML input type */
type?: string;
/** Field value */
value?: any;
/** Inner ref */
innerRef?: (instance: any) => void;
}
export type FieldAttributes<T> = {
className?: string;
} & GenericFieldHTMLAttributes & FieldConfig<T> & T & {
name: string;
};
export type FieldHookConfig<T> = GenericFieldHTMLAttributes & FieldConfig<T>;
export declare function useField<Val = any>(propsOrFieldName: string | FieldHookConfig<Val>): [FieldInputProps<Val>, FieldMetaProps<Val>, FieldHelperProps<Val>];
export declare function Field({ validate, name, render, children, as: is, // `as` is reserved in typescript lol
component, className, ...props }: FieldAttributes<any>): any;
62 changes: 62 additions & 0 deletions packages/formik/dist/FieldArray.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/// <reference types="hoist-non-react-statics" />
import * as React from 'react';
import { FormikContextType, FormikProps, SharedRenderProps } from './types';
export type FieldArrayRenderProps = ArrayHelpers & {
form: FormikProps<any>;
name: string;
};
export type FieldArrayConfig = {
/** Really the path to the array field to be updated */
name: string;
/** Should field array validate the form AFTER array updates/changes? */
validateOnChange?: boolean;
} & SharedRenderProps<FieldArrayRenderProps>;
export interface ArrayHelpers<T extends any[] = any[]> {
/** Imperatively add a value to the end of an array */
push<X = T[number]>(obj: X): void;
/** Curried fn to add a value to the end of an array */
handlePush<X = T[number]>(obj: X): () => void;
/** Imperatively swap two values in an array */
swap: (indexA: number, indexB: number) => void;
/** Curried fn to swap two values in an array */
handleSwap: (indexA: number, indexB: number) => () => void;
/** Imperatively move an element in an array to another index */
move: (from: number, to: number) => void;
/** Imperatively move an element in an array to another index */
handleMove: (from: number, to: number) => () => void;
/** Imperatively insert an element at a given index into the array */
insert<X = T[number]>(index: number, value: X): void;
/** Curried fn to insert an element at a given index into the array */
handleInsert<X = T[number]>(index: number, value: X): () => void;
/** Imperatively replace a value at an index of an array */
replace<X = T[number]>(index: number, value: X): void;
/** Curried fn to replace an element at a given index into the array */
handleReplace<X = T[number]>(index: number, value: X): () => void;
/** Imperatively add an element to the beginning of an array and return its length */
unshift<X = T[number]>(value: X): number;
/** Curried fn to add an element to the beginning of an array */
handleUnshift<X = T[number]>(value: X): () => void;
/** Curried fn to remove an element at an index of an array */
handleRemove: (index: number) => () => void;
/** Curried fn to remove a value from the end of the array */
handlePop: () => () => void;
/** Imperatively remove and element at an index of an array */
remove<X = T[number]>(index: number): X | undefined;
/** Imperatively remove and return value from the end of the array */
pop<X = T[number]>(): X | undefined;
}
/**
* Some array helpers!
*/
export declare const move: <T>(array: T[], from: number, to: number) => unknown[];
export declare const swap: <T>(arrayLike: ArrayLike<T>, indexA: number, indexB: number) => unknown[];
export declare const insert: <T>(arrayLike: ArrayLike<T>, index: number, value: T) => unknown[];
export declare const replace: <T>(arrayLike: ArrayLike<T>, index: number, value: T) => unknown[];
export declare const FieldArray: React.FC<FieldArrayConfig> & import("hoist-non-react-statics").NonReactStatics<React.ComponentClass<{
/** Really the path to the array field to be updated */
name: string;
/** Should field array validate the form AFTER array updates/changes? */
validateOnChange?: boolean | undefined;
} & SharedRenderProps<FieldArrayRenderProps> & {
formik: FormikContextType<any>;
}, any>, {}>;
3 changes: 3 additions & 0 deletions packages/formik/dist/Form.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import * as React from 'react';
export type FormikFormProps = Pick<React.FormHTMLAttributes<HTMLFormElement>, Exclude<keyof React.FormHTMLAttributes<HTMLFormElement>, 'onReset' | 'onSubmit'>>;
export declare const Form: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.FormHTMLAttributes<HTMLFormElement>, HTMLFormElement>, "ref"> & React.RefAttributes<HTMLFormElement>>;
62 changes: 62 additions & 0 deletions packages/formik/dist/Formik.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import * as React from 'react';
import { FieldConfig } from './Field';
import { FieldHelperProps, FieldInputProps, FieldMetaProps, FormikConfig, FormikErrors, FormikState, FormikTouched, FormikValues } from './types';
export declare function useFormik<Values extends FormikValues = FormikValues>({ validateOnChange, validateOnBlur, validateOnMount, isInitialValid, enableReinitialize, onSubmit, ...rest }: FormikConfig<Values>): {
initialValues: Values;
initialErrors: FormikErrors<unknown>;
initialTouched: FormikTouched<unknown>;
initialStatus: any;
handleBlur: {
(e: React.FocusEvent<any, Element>): void;
<T = any>(fieldOrEvent: T): T extends string ? (e: any) => void : void;
};
handleChange: {
(e: React.ChangeEvent<any>): void;
<T_1 = string | React.ChangeEvent<any>>(field: T_1): T_1 extends React.ChangeEvent<any> ? void : (e: string | React.ChangeEvent<any>) => void;
};
handleReset: (e: any) => void;
handleSubmit: (e?: React.FormEvent<HTMLFormElement>) => void;
resetForm: (nextState?: Partial<FormikState<Values>>) => void;
setErrors: (errors: FormikErrors<Values>) => void;
setFormikState: (stateOrCb: FormikState<Values> | ((state: FormikState<Values>) => FormikState<Values>)) => void;
setFieldTouched: (field: string, touched?: boolean, shouldValidate?: boolean) => FormikErrors<Values> | Promise<FormikErrors<Values>> | Promise<void>;
setFieldValue: (field: string, value: any, shouldValidate?: boolean) => FormikErrors<Values> | Promise<FormikErrors<Values>> | Promise<void>;
setFieldError: (field: string, value: string | undefined) => void;
setStatus: (status: any) => void;
setSubmitting: (isSubmitting: boolean) => void;
setTouched: (touched: FormikTouched<Values>, shouldValidate?: boolean) => FormikErrors<Values> | Promise<FormikErrors<Values>> | Promise<void>;
setValues: (values: React.SetStateAction<Values>, shouldValidate?: boolean) => FormikErrors<Values> | Promise<FormikErrors<Values>> | Promise<void>;
submitForm: () => Promise<any> | undefined;
validateForm: (values?: Values) => FormikErrors<Values> | Promise<FormikErrors<Values>>;
validateField: (name: string) => string | Promise<void> | undefined;
isValid: boolean;
dirty: boolean;
unregisterField: (name: string) => void;
registerField: (name: string, { validate }: any) => void;
getFieldProps: (nameOrOptions: string | FieldConfig<any>) => FieldInputProps<any>;
getFieldMeta: (name: string) => FieldMetaProps<any>;
getFieldHelpers: (name: string) => FieldHelperProps<any>;
validateOnBlur: boolean;
validateOnChange: boolean;
validateOnMount: boolean;
values: Values;
errors: FormikErrors<Values>;
touched: FormikTouched<Values>;
isSubmitting: boolean;
isValidating: boolean;
status?: any;
submitCount: number;
};
export declare function Formik<Values extends FormikValues = FormikValues, ExtraProps = {}>(props: FormikConfig<Values> & ExtraProps): React.JSX.Element;
/**
* Transform Yup ValidationError to a more usable object
*/
export declare function yupToFormErrors<Values>(yupError: any): FormikErrors<Values>;
/**
* Validate a yup schema.
*/
export declare function validateYupSchema<T extends FormikValues>(values: T, schema: any, sync?: boolean, context?: any): Promise<Partial<T>>;
/**
* Recursively prepare values.
*/
export declare function prepareDataForValidation<T extends FormikValues>(values: T): FormikValues;
6 changes: 6 additions & 0 deletions packages/formik/dist/FormikContext.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import * as React from 'react';
import { FormikContextType } from './types';
export declare const FormikContext: React.Context<FormikContextType<any>>;
export declare const FormikProvider: React.Provider<FormikContextType<any>>;
export declare const FormikConsumer: React.Consumer<FormikContextType<any>>;
export declare function useFormikContext<Values>(): FormikContextType<Values>;
12 changes: 12 additions & 0 deletions packages/formik/dist/connect.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import * as React from 'react';
import hoistNonReactStatics from 'hoist-non-react-statics';
import { FormikContextType } from './types';
/**
* Connect any component to Formik context, and inject as a prop called `formik`;
* @param Comp React Component
*/
export declare function connect<OuterProps, Values = {}>(Comp: React.ComponentType<OuterProps & {
formik: FormikContextType<Values>;
}>): React.FC<OuterProps> & hoistNonReactStatics.NonReactStatics<React.ComponentClass<OuterProps & {
formik: FormikContextType<Values>;
}, any>, {}>;
Loading

0 comments on commit c7e7cf6

Please sign in to comment.