@deckstar/react-final-form-arrays
Advanced tools
Comparing version 1.0.9 to 1.0.10
/// <reference types="react" /> | ||
import { FormValuesShape, FullFieldSubscription, Mutators } from "final-form"; | ||
import { FieldSubscription, FormValuesShape, FullFieldSubscription, Mutators } from "final-form"; | ||
import { DefaultBoundArrayMutators } from "final-form-arrays"; | ||
import { FieldRenderProps } from "react-final-form"; | ||
import type { FieldArrayProps } from "./types"; | ||
declare const FieldArray: <FieldValue = any, FormValues extends FormValuesShape = FormValuesShape, Subscription extends Partial<Record<"active" | "data" | "dirty" | "dirtySinceLastSubmit" | "error" | "initial" | "invalid" | "length" | "modified" | "modifiedSinceLastSubmit" | "pristine" | "submitError" | "submitFailed" | "submitSucceeded" | "submitting" | "touched" | "valid" | "value" | "visited" | "validating", boolean>> = FullFieldSubscription, MutatorsAfterBinding extends DefaultBoundArrayMutators<FormValues> & import("final-form").BoundMutators<Mutators<FormValues>, FormValues> = DefaultBoundArrayMutators<FormValues>, T extends HTMLElement = HTMLInputElement, RP extends FieldRenderProps<FieldValue[], FieldValue[], Subscription, T> = FieldRenderProps<FieldValue[], FieldValue[], Subscription, T>>({ name, subscription, defaultValue, initialValue, isEqual, validate, ...rest }: FieldArrayProps<FieldValue, FormValues, Subscription, MutatorsAfterBinding, T, RP>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>; | ||
/** A component that takes `FieldArrayProps` and renders an array of fields. */ | ||
declare const FieldArray: <FieldValue = any, FormValues extends FormValuesShape = FormValuesShape, Subscription extends FieldSubscription = FullFieldSubscription, MutatorsAfterBinding extends DefaultBoundArrayMutators<FormValues> & import("final-form").BoundMutators<Mutators<FormValues>, FormValues> = DefaultBoundArrayMutators<FormValues>, T extends HTMLElement = HTMLInputElement>({ name, subscription, defaultValue, initialValue, isEqual, validate, ...rest }: FieldArrayProps<FieldValue, FormValues, Subscription, MutatorsAfterBinding, T>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>; | ||
export default FieldArray; |
@@ -19,2 +19,3 @@ "use strict"; | ||
const useFieldArray_1 = __importDefault(require("./useFieldArray")); | ||
/** A component that takes `FieldArrayProps` and renders an array of fields. */ | ||
const FieldArray = (_a) => { | ||
@@ -21,0 +22,0 @@ var { name, subscription, defaultValue, initialValue, isEqual, validate } = _a, rest = __rest(_a, ["name", "subscription", "defaultValue", "initialValue", "isEqual", "validate"]); |
@@ -0,4 +1,18 @@ | ||
import { AnyObject } from "final-form"; | ||
import * as React from "react"; | ||
import type { RenderableProps } from "./types"; | ||
declare function renderComponent<Props>(props: RenderableProps<Props> & Props, name: string): React.ReactElement; | ||
type OptionalRefProp = { | ||
/** An optional `ref` for this node. */ | ||
ref?: React.ForwardedRef<React.ReactNode>; | ||
}; | ||
type NonRenderableProps<Props extends AnyObject> = Omit<Props, keyof RenderableProps> & OptionalRefProp; | ||
/** Props that might be included in the render method. */ | ||
type LazyProps<RenderProps extends AnyObject> = Partial<NonRenderableProps<RenderProps>>; | ||
/** Props that will be included in the `render` method. */ | ||
type NonLazyProps<RenderProps extends AnyObject> = RenderableProps<RenderProps> & OptionalRefProp; | ||
/** | ||
* Shared logic between components that use either `render` prop, | ||
* `children` render function, or `component` prop. | ||
*/ | ||
declare function renderComponent<RenderProps extends AnyObject>(props: NonLazyProps<RenderProps> & LazyProps<RenderProps>, name: string): React.ReactElement; | ||
export default renderComponent; |
@@ -38,13 +38,14 @@ "use strict"; | ||
const React = __importStar(require("react")); | ||
// shared logic between components that use either render prop, | ||
// children render function, or component prop | ||
/** | ||
* Shared logic between components that use either `render` prop, | ||
* `children` render function, or `component` prop. | ||
*/ | ||
function renderComponent(props, name) { | ||
const { render, children, component } = props, rest = __rest(props, ["render", "children", "component"]); | ||
if (component) { | ||
// @ts-expect-error | ||
return React.createElement(component, Object.assign(Object.assign({}, rest), { children, render })); // inject children back in | ||
return React.createElement(component, Object.assign(Object.assign({}, rest), { children, | ||
render })); // inject children back in | ||
} | ||
if (render) { | ||
// @ts-expect-error | ||
return render(children === undefined ? rest : Object.assign(Object.assign({}, rest), { children })); // inject children back in | ||
return render((children === undefined ? rest : Object.assign(Object.assign({}, rest), { children }))); // inject children back in | ||
} | ||
@@ -54,3 +55,2 @@ if (typeof children !== "function") { | ||
} | ||
// @ts-expect-error | ||
return children(rest); | ||
@@ -57,0 +57,0 @@ } |
import type { BoundMutators, FieldSubscription, FormValuesShape, FullFieldSubscription, Mutators } from "final-form"; | ||
import { BoundArrayMutators, DefaultBoundArrayMutators } from "final-form-arrays"; | ||
import { FieldInputPropsBasedOnSubscription, FieldMetaState, FieldRenderProps, RenderableProps, UseFieldConfig } from "react-final-form"; | ||
import { FieldInputPropsBasedOnSubscription, FieldMetaState, RenderableProps, UseFieldConfig } from "react-final-form"; | ||
export type { RenderableProps }; | ||
@@ -17,3 +17,10 @@ /** Drops the first item from a tuple type. */ | ||
}; | ||
/** Props that get passed into field array items. */ | ||
/** | ||
* These are the props that `<FieldArray/>` provides to your render function or component. | ||
* This object is divided into a fields object that mimics an iterable (e.g. it has `map()` | ||
* and `forEach()` and `length`), and meta data about the field array. | ||
* | ||
* Keep in mind that the values in `meta` are dependent on you having subscribed to them | ||
* with the `subscription` prop. | ||
*/ | ||
export type FieldArrayRenderProps<FieldValue, FormValues extends FormValuesShape = FormValuesShape, MutatorsAfterBinding extends BoundArrayMutators<Mutators<FormValues>, FormValues> = DefaultBoundArrayMutators<FormValues>, Subscription extends FieldSubscription = FullFieldSubscription> = { | ||
@@ -26,8 +33,13 @@ fields: { | ||
}; | ||
export interface UseFieldArrayConfig<FieldValue, FormValues extends FormValuesShape = FormValuesShape, Subscription extends FieldSubscription = FullFieldSubscription, T extends HTMLElement = HTMLInputElement, RP extends FieldRenderProps<FieldValue[], FieldValue[], Subscription, T> = FieldRenderProps<FieldValue[], FieldValue[], Subscription, T>> extends Omit<UseFieldConfig<FieldValue[], FormValues, FieldValue[], Subscription, T, RP>, "children" | "component">, Partial<Pick<UseFieldConfig<FieldValue[], FormValues, FieldValue[], Subscription, T, RP>, "children" | "component">> { | ||
/** The second parameter of `useFieldArray`, used to configure its behavior. */ | ||
export interface UseFieldArrayConfig<FieldValue, FormValues extends FormValuesShape = FormValuesShape, Subscription extends FieldSubscription = FullFieldSubscription, T extends HTMLElement = HTMLInputElement> extends Omit<UseFieldConfig<FieldValue[], FormValues, FieldValue[], Subscription, T>, "children" | "component">, Partial<Pick<UseFieldConfig<FieldValue[], FormValues, FieldValue[], Subscription, T>, "children" | "component">> { | ||
isEqual?: (a: FieldValue[], b: FieldValue[]) => boolean; | ||
} | ||
export interface FieldArrayProps<FieldValue, FormValues extends FormValuesShape = FormValuesShape, Subscription extends FieldSubscription = FullFieldSubscription, MutatorsAfterBinding extends BoundMutators<Mutators<FormValues>, FormValues> & DefaultBoundArrayMutators<FormValues> = DefaultBoundArrayMutators<FormValues>, T extends HTMLElement = HTMLInputElement, RP extends FieldRenderProps<FieldValue[], FieldValue[], Subscription, T> = FieldRenderProps<FieldValue[], FieldValue[], Subscription, T>> extends Omit<UseFieldArrayConfig<FieldValue, FormValues, Subscription, T, RP>, keyof RenderableProps>, RenderableProps<FieldArrayRenderProps<FieldValue, FormValues, MutatorsAfterBinding, Subscription>> { | ||
/** | ||
* These are props that you pass to `<FieldArray/>`. You must | ||
* provide one of the ways to render: `component`, `render`, or `children`. | ||
*/ | ||
export interface FieldArrayProps<FieldValue, FormValues extends FormValuesShape = FormValuesShape, Subscription extends FieldSubscription = FullFieldSubscription, MutatorsAfterBinding extends BoundMutators<Mutators<FormValues>, FormValues> & DefaultBoundArrayMutators<FormValues> = DefaultBoundArrayMutators<FormValues>, T extends HTMLElement = HTMLInputElement> extends Omit<UseFieldArrayConfig<FieldValue, FormValues, Subscription, T>, keyof RenderableProps>, RenderableProps<FieldArrayRenderProps<FieldValue, FormValues, MutatorsAfterBinding, Subscription>> { | ||
name: string; | ||
[otherProp: string]: any; | ||
} |
@@ -1,7 +0,13 @@ | ||
import type { FullFieldSubscription, Mutators } from "final-form"; | ||
import type { FieldSubscription, FullFieldSubscription, Mutators } from "final-form"; | ||
import { FormValuesShape } from "final-form"; | ||
import type { DefaultBoundArrayMutators } from "final-form-arrays"; | ||
import { FieldRenderProps } from "react-final-form"; | ||
import type { FieldArrayRenderProps, UseFieldArrayConfig } from "./types"; | ||
declare const useFieldArray: <FieldValue = any, FormValues extends FormValuesShape = FormValuesShape, Subscription extends Partial<Record<"active" | "data" | "dirty" | "dirtySinceLastSubmit" | "error" | "initial" | "invalid" | "length" | "modified" | "modifiedSinceLastSubmit" | "pristine" | "submitError" | "submitFailed" | "submitSucceeded" | "submitting" | "touched" | "valid" | "value" | "visited" | "validating", boolean>> = FullFieldSubscription, MutatorsAfterBinding extends DefaultBoundArrayMutators<FormValues> & import("final-form").BoundMutators<Mutators<FormValues>, FormValues> = DefaultBoundArrayMutators<FormValues>, T extends HTMLElement = HTMLInputElement, RP extends FieldRenderProps<FieldValue[], FieldValue[], Subscription, T> = FieldRenderProps<FieldValue[], FieldValue[], Subscription, T>>(name: string, { subscription, defaultValue, initialValue, isEqual, validate: validateProp, }?: UseFieldArrayConfig<FieldValue, FormValues, Subscription, T, RP>) => FieldArrayRenderProps<FieldValue, FormValues, MutatorsAfterBinding, Subscription>; | ||
/** | ||
* The `useFieldArray` hook takes two parameters, the first is the name of the field, | ||
* and the second is an optional object that looks just like `FieldArrayProps`, except | ||
* without the name. It returns an object just like `FieldArrayRenderProps`. | ||
* | ||
* `useFieldArray` is used internally inside `FieldArray`. | ||
*/ | ||
declare const useFieldArray: <FieldValue = any, FormValues extends FormValuesShape = FormValuesShape, Subscription extends FieldSubscription = FullFieldSubscription, MutatorsAfterBinding extends DefaultBoundArrayMutators<FormValues> & import("final-form").BoundMutators<Mutators<FormValues>, FormValues> = DefaultBoundArrayMutators<FormValues>, T extends HTMLElement = HTMLInputElement>(name: string, { subscription, defaultValue, initialValue, isEqual, validate: validateProp, }?: UseFieldArrayConfig<FieldValue, FormValues, Subscription, T>) => FieldArrayRenderProps<FieldValue, FormValues, MutatorsAfterBinding, Subscription>; | ||
export default useFieldArray; |
@@ -22,2 +22,9 @@ "use strict"; | ||
const useConstant_1 = __importDefault(require("./useConstant")); | ||
/** | ||
* The `useFieldArray` hook takes two parameters, the first is the name of the field, | ||
* and the second is an optional object that looks just like `FieldArrayProps`, except | ||
* without the name. It returns an object just like `FieldArrayRenderProps`. | ||
* | ||
* `useFieldArray` is used internally inside `FieldArray`. | ||
*/ | ||
const useFieldArray = (name, { subscription = react_final_form_1.fullFieldSubscription, defaultValue, initialValue, isEqual = defaultIsEqual_1.default, validate: validateProp, } = {}) => { | ||
@@ -24,0 +31,0 @@ const form = (0, react_final_form_1.useForm)("useFieldArray"); |
/// <reference types="react" /> | ||
import { FormValuesShape, FullFieldSubscription, Mutators } from "final-form"; | ||
import { FieldSubscription, FormValuesShape, FullFieldSubscription, Mutators } from "final-form"; | ||
import { DefaultBoundArrayMutators } from "final-form-arrays"; | ||
import { FieldRenderProps } from "react-final-form"; | ||
import type { FieldArrayProps } from "./types"; | ||
declare const FieldArray: <FieldValue = any, FormValues extends FormValuesShape = FormValuesShape, Subscription extends Partial<Record<"active" | "data" | "dirty" | "dirtySinceLastSubmit" | "error" | "initial" | "invalid" | "length" | "modified" | "modifiedSinceLastSubmit" | "pristine" | "submitError" | "submitFailed" | "submitSucceeded" | "submitting" | "touched" | "valid" | "value" | "visited" | "validating", boolean>> = FullFieldSubscription, MutatorsAfterBinding extends DefaultBoundArrayMutators<FormValues> & import("final-form").BoundMutators<Mutators<FormValues>, FormValues> = DefaultBoundArrayMutators<FormValues>, T extends HTMLElement = HTMLInputElement, RP extends FieldRenderProps<FieldValue[], FieldValue[], Subscription, T> = FieldRenderProps<FieldValue[], FieldValue[], Subscription, T>>({ name, subscription, defaultValue, initialValue, isEqual, validate, ...rest }: FieldArrayProps<FieldValue, FormValues, Subscription, MutatorsAfterBinding, T, RP>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>; | ||
/** A component that takes `FieldArrayProps` and renders an array of fields. */ | ||
declare const FieldArray: <FieldValue = any, FormValues extends FormValuesShape = FormValuesShape, Subscription extends FieldSubscription = FullFieldSubscription, MutatorsAfterBinding extends DefaultBoundArrayMutators<FormValues> & import("final-form").BoundMutators<Mutators<FormValues>, FormValues> = DefaultBoundArrayMutators<FormValues>, T extends HTMLElement = HTMLInputElement>({ name, subscription, defaultValue, initialValue, isEqual, validate, ...rest }: FieldArrayProps<FieldValue, FormValues, Subscription, MutatorsAfterBinding, T>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>; | ||
export default FieldArray; |
@@ -14,2 +14,3 @@ var __rest = (this && this.__rest) || function (s, e) { | ||
import useFieldArray from "./useFieldArray"; | ||
/** A component that takes `FieldArrayProps` and renders an array of fields. */ | ||
const FieldArray = (_a) => { | ||
@@ -16,0 +17,0 @@ var { name, subscription, defaultValue, initialValue, isEqual, validate } = _a, rest = __rest(_a, ["name", "subscription", "defaultValue", "initialValue", "isEqual", "validate"]); |
@@ -0,4 +1,18 @@ | ||
import { AnyObject } from "final-form"; | ||
import * as React from "react"; | ||
import type { RenderableProps } from "./types"; | ||
declare function renderComponent<Props>(props: RenderableProps<Props> & Props, name: string): React.ReactElement; | ||
type OptionalRefProp = { | ||
/** An optional `ref` for this node. */ | ||
ref?: React.ForwardedRef<React.ReactNode>; | ||
}; | ||
type NonRenderableProps<Props extends AnyObject> = Omit<Props, keyof RenderableProps> & OptionalRefProp; | ||
/** Props that might be included in the render method. */ | ||
type LazyProps<RenderProps extends AnyObject> = Partial<NonRenderableProps<RenderProps>>; | ||
/** Props that will be included in the `render` method. */ | ||
type NonLazyProps<RenderProps extends AnyObject> = RenderableProps<RenderProps> & OptionalRefProp; | ||
/** | ||
* Shared logic between components that use either `render` prop, | ||
* `children` render function, or `component` prop. | ||
*/ | ||
declare function renderComponent<RenderProps extends AnyObject>(props: NonLazyProps<RenderProps> & LazyProps<RenderProps>, name: string): React.ReactElement; | ||
export default renderComponent; |
@@ -13,13 +13,14 @@ var __rest = (this && this.__rest) || function (s, e) { | ||
import * as React from "react"; | ||
// shared logic between components that use either render prop, | ||
// children render function, or component prop | ||
/** | ||
* Shared logic between components that use either `render` prop, | ||
* `children` render function, or `component` prop. | ||
*/ | ||
function renderComponent(props, name) { | ||
const { render, children, component } = props, rest = __rest(props, ["render", "children", "component"]); | ||
if (component) { | ||
// @ts-expect-error | ||
return React.createElement(component, Object.assign(Object.assign({}, rest), { children, render })); // inject children back in | ||
return React.createElement(component, Object.assign(Object.assign({}, rest), { children, | ||
render })); // inject children back in | ||
} | ||
if (render) { | ||
// @ts-expect-error | ||
return render(children === undefined ? rest : Object.assign(Object.assign({}, rest), { children })); // inject children back in | ||
return render((children === undefined ? rest : Object.assign(Object.assign({}, rest), { children }))); // inject children back in | ||
} | ||
@@ -29,3 +30,2 @@ if (typeof children !== "function") { | ||
} | ||
// @ts-expect-error | ||
return children(rest); | ||
@@ -32,0 +32,0 @@ } |
import type { BoundMutators, FieldSubscription, FormValuesShape, FullFieldSubscription, Mutators } from "final-form"; | ||
import { BoundArrayMutators, DefaultBoundArrayMutators } from "final-form-arrays"; | ||
import { FieldInputPropsBasedOnSubscription, FieldMetaState, FieldRenderProps, RenderableProps, UseFieldConfig } from "react-final-form"; | ||
import { FieldInputPropsBasedOnSubscription, FieldMetaState, RenderableProps, UseFieldConfig } from "react-final-form"; | ||
export type { RenderableProps }; | ||
@@ -17,3 +17,10 @@ /** Drops the first item from a tuple type. */ | ||
}; | ||
/** Props that get passed into field array items. */ | ||
/** | ||
* These are the props that `<FieldArray/>` provides to your render function or component. | ||
* This object is divided into a fields object that mimics an iterable (e.g. it has `map()` | ||
* and `forEach()` and `length`), and meta data about the field array. | ||
* | ||
* Keep in mind that the values in `meta` are dependent on you having subscribed to them | ||
* with the `subscription` prop. | ||
*/ | ||
export type FieldArrayRenderProps<FieldValue, FormValues extends FormValuesShape = FormValuesShape, MutatorsAfterBinding extends BoundArrayMutators<Mutators<FormValues>, FormValues> = DefaultBoundArrayMutators<FormValues>, Subscription extends FieldSubscription = FullFieldSubscription> = { | ||
@@ -26,8 +33,13 @@ fields: { | ||
}; | ||
export interface UseFieldArrayConfig<FieldValue, FormValues extends FormValuesShape = FormValuesShape, Subscription extends FieldSubscription = FullFieldSubscription, T extends HTMLElement = HTMLInputElement, RP extends FieldRenderProps<FieldValue[], FieldValue[], Subscription, T> = FieldRenderProps<FieldValue[], FieldValue[], Subscription, T>> extends Omit<UseFieldConfig<FieldValue[], FormValues, FieldValue[], Subscription, T, RP>, "children" | "component">, Partial<Pick<UseFieldConfig<FieldValue[], FormValues, FieldValue[], Subscription, T, RP>, "children" | "component">> { | ||
/** The second parameter of `useFieldArray`, used to configure its behavior. */ | ||
export interface UseFieldArrayConfig<FieldValue, FormValues extends FormValuesShape = FormValuesShape, Subscription extends FieldSubscription = FullFieldSubscription, T extends HTMLElement = HTMLInputElement> extends Omit<UseFieldConfig<FieldValue[], FormValues, FieldValue[], Subscription, T>, "children" | "component">, Partial<Pick<UseFieldConfig<FieldValue[], FormValues, FieldValue[], Subscription, T>, "children" | "component">> { | ||
isEqual?: (a: FieldValue[], b: FieldValue[]) => boolean; | ||
} | ||
export interface FieldArrayProps<FieldValue, FormValues extends FormValuesShape = FormValuesShape, Subscription extends FieldSubscription = FullFieldSubscription, MutatorsAfterBinding extends BoundMutators<Mutators<FormValues>, FormValues> & DefaultBoundArrayMutators<FormValues> = DefaultBoundArrayMutators<FormValues>, T extends HTMLElement = HTMLInputElement, RP extends FieldRenderProps<FieldValue[], FieldValue[], Subscription, T> = FieldRenderProps<FieldValue[], FieldValue[], Subscription, T>> extends Omit<UseFieldArrayConfig<FieldValue, FormValues, Subscription, T, RP>, keyof RenderableProps>, RenderableProps<FieldArrayRenderProps<FieldValue, FormValues, MutatorsAfterBinding, Subscription>> { | ||
/** | ||
* These are props that you pass to `<FieldArray/>`. You must | ||
* provide one of the ways to render: `component`, `render`, or `children`. | ||
*/ | ||
export interface FieldArrayProps<FieldValue, FormValues extends FormValuesShape = FormValuesShape, Subscription extends FieldSubscription = FullFieldSubscription, MutatorsAfterBinding extends BoundMutators<Mutators<FormValues>, FormValues> & DefaultBoundArrayMutators<FormValues> = DefaultBoundArrayMutators<FormValues>, T extends HTMLElement = HTMLInputElement> extends Omit<UseFieldArrayConfig<FieldValue, FormValues, Subscription, T>, keyof RenderableProps>, RenderableProps<FieldArrayRenderProps<FieldValue, FormValues, MutatorsAfterBinding, Subscription>> { | ||
name: string; | ||
[otherProp: string]: any; | ||
} |
@@ -1,7 +0,13 @@ | ||
import type { FullFieldSubscription, Mutators } from "final-form"; | ||
import type { FieldSubscription, FullFieldSubscription, Mutators } from "final-form"; | ||
import { FormValuesShape } from "final-form"; | ||
import type { DefaultBoundArrayMutators } from "final-form-arrays"; | ||
import { FieldRenderProps } from "react-final-form"; | ||
import type { FieldArrayRenderProps, UseFieldArrayConfig } from "./types"; | ||
declare const useFieldArray: <FieldValue = any, FormValues extends FormValuesShape = FormValuesShape, Subscription extends Partial<Record<"active" | "data" | "dirty" | "dirtySinceLastSubmit" | "error" | "initial" | "invalid" | "length" | "modified" | "modifiedSinceLastSubmit" | "pristine" | "submitError" | "submitFailed" | "submitSucceeded" | "submitting" | "touched" | "valid" | "value" | "visited" | "validating", boolean>> = FullFieldSubscription, MutatorsAfterBinding extends DefaultBoundArrayMutators<FormValues> & import("final-form").BoundMutators<Mutators<FormValues>, FormValues> = DefaultBoundArrayMutators<FormValues>, T extends HTMLElement = HTMLInputElement, RP extends FieldRenderProps<FieldValue[], FieldValue[], Subscription, T> = FieldRenderProps<FieldValue[], FieldValue[], Subscription, T>>(name: string, { subscription, defaultValue, initialValue, isEqual, validate: validateProp, }?: UseFieldArrayConfig<FieldValue, FormValues, Subscription, T, RP>) => FieldArrayRenderProps<FieldValue, FormValues, MutatorsAfterBinding, Subscription>; | ||
/** | ||
* The `useFieldArray` hook takes two parameters, the first is the name of the field, | ||
* and the second is an optional object that looks just like `FieldArrayProps`, except | ||
* without the name. It returns an object just like `FieldArrayRenderProps`. | ||
* | ||
* `useFieldArray` is used internally inside `FieldArray`. | ||
*/ | ||
declare const useFieldArray: <FieldValue = any, FormValues extends FormValuesShape = FormValuesShape, Subscription extends FieldSubscription = FullFieldSubscription, MutatorsAfterBinding extends DefaultBoundArrayMutators<FormValues> & import("final-form").BoundMutators<Mutators<FormValues>, FormValues> = DefaultBoundArrayMutators<FormValues>, T extends HTMLElement = HTMLInputElement>(name: string, { subscription, defaultValue, initialValue, isEqual, validate: validateProp, }?: UseFieldArrayConfig<FieldValue, FormValues, Subscription, T>) => FieldArrayRenderProps<FieldValue, FormValues, MutatorsAfterBinding, Subscription>; | ||
export default useFieldArray; |
@@ -17,2 +17,9 @@ var __rest = (this && this.__rest) || function (s, e) { | ||
import useConstant from "./useConstant"; | ||
/** | ||
* The `useFieldArray` hook takes two parameters, the first is the name of the field, | ||
* and the second is an optional object that looks just like `FieldArrayProps`, except | ||
* without the name. It returns an object just like `FieldArrayRenderProps`. | ||
* | ||
* `useFieldArray` is used internally inside `FieldArray`. | ||
*/ | ||
const useFieldArray = (name, { subscription = all, defaultValue, initialValue, isEqual = defaultIsEqual, validate: validateProp, } = {}) => { | ||
@@ -19,0 +26,0 @@ const form = useForm("useFieldArray"); |
{ | ||
"name": "@deckstar/react-final-form-arrays", | ||
"version": "1.0.9", | ||
"version": "1.0.10", | ||
"description": "A component for rendering and editing arrays 🏁 React Final Form", | ||
@@ -23,7 +23,7 @@ "main": "dist/cjs", | ||
"peerDependencies": { | ||
"@deckstar/final-form": "1.0.9", | ||
"@deckstar/final-form-arrays": "1.0.9", | ||
"@deckstar/react-final-form": "1.0.9" | ||
"@deckstar/final-form": "1.0.10", | ||
"@deckstar/final-form-arrays": "1.0.10", | ||
"@deckstar/react-final-form": "1.0.10" | ||
}, | ||
"gitHead": "4be4827b5168a4cb36b9a7b019d27943dd5d85a1" | ||
"gitHead": "8af52192175ff0ffea3fb6e0b359c0f1d94c1815" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
46385
611