Open History to see the last commit
1import type {
2 DeepKeys,
3 DeepKeysWhereValueIncludes,
4 DeepValue,
5 FieldValidators,
6 FormApiArrayMethods,
7 FormApiFieldMethods,
8 FormErrorTypes,
9 FormState,
10 ValidationIssue,
11} from '@tanstack/form-core'
12import type { FunctionComponent } from 'preact/compat'
13import type { CrossVersionPreactNode } from '../preactTypes.public'
14import type {
15 PreactFormFieldProps,
16 PreactFormSubscribeProps,
17} from '../PreactForm/Components.public'
18import type { ReadonlyAtom } from '@tanstack/preact-store'
19β
20export interface FieldGroupFieldComponent<
21 in out TFieldData,
22 in out TFieldComponents extends Record<string, FunctionComponent<any>>,
23> {
24 <const TFieldName extends DeepKeys<TFieldData>>(
25 props: PreactFormFieldProps<
26 TFieldData,
27 TFieldName,
28 DeepValue<TFieldData, TFieldName>,
29 FieldValidators<
30 TFieldData,
31 TFieldName,
32 DeepValue<TFieldData, TFieldName>
33 >,
34 ValidationIssue,
35 unknown,
36 FormErrorTypes,
37 TFieldComponents
38 >,
39 ): CrossVersionPreactNode
40}
41β
42export interface FieldGroupArrayFieldComponent<
43 in out TFieldData,
44 in out TFieldComponents extends Record<string, FunctionComponent<any>>,
45> {
46 <const TFieldName extends DeepKeysWhereValueIncludes<TFieldData, Array<any>>>(
47 props: PreactFormFieldProps<
48 TFieldData,
49 TFieldName,
50 DeepValue<TFieldData, TFieldName>,
51 FieldValidators<
52 TFieldData,
53 TFieldName,
54 DeepValue<TFieldData, TFieldName>
55 >,
56 ValidationIssue,
57 unknown,
58 FormErrorTypes,
59 TFieldComponents
60 >,
61 ): CrossVersionPreactNode
62}
63β
64export type FieldGroupSubscribeProps<TSelected> = PreactFormSubscribeProps<
65 unknown,
66 FormErrorTypes,
67 TSelected
68>
69β
70export type FieldGroupSubscribeComponent = <const TSelected>(
71 props: FieldGroupSubscribeProps<TSelected>,
72) => CrossVersionPreactNode
73β
74export interface FieldGroupApi<
75 in out TFieldData,
76 in out TFieldComponents extends Record<string, FunctionComponent<any>> =
77 Record<never, never>,
78>
79 extends FormApiFieldMethods<TFieldData>, FormApiArrayMethods<TFieldData> {
80 atom: ReadonlyAtom<TFieldData>
81 Field: FieldGroupFieldComponent<TFieldData, TFieldComponents>
82 ArrayField: FieldGroupArrayFieldComponent<TFieldData, TFieldComponents>
83 Subscribe: FieldGroupSubscribeComponent
84}
85β
86export type AnyFieldGroupApi = FieldGroupApi<
87 any,
88 Record<string, FunctionComponent<any>>
89>
90β
91export type FieldGroupFormState = FormState<unknown, FormErrorTypes>