Skip to content

Commit 49fea74

Browse files
crutchcornautofix-ci[bot]irwinarrudaLeCarbonator
authored
feat: Reusable app hooks (#1179)
* feat: add ability to create custom form hook for better app-facing DX * test: add tests for createFormHook * feat: add withForm HOC * Revert "feat: add withForm HOC" This reverts commit 36e42f0. * chore: fix typings from `main` * Reapply "feat: add withForm HOC" This reverts commit b6e0f91. * ci: apply automated fixes and generate docs * chore: fix CI * feat: add form components functionality * ci: apply automated fixes and generate docs * fix: type unions should now work properly (#1180) * fix: type unions should now work properly Co-authored-by: irwinarruda <[email protected]> * ci: apply automated fixes and generate docs * chore: reintroduce TDepth for infinate depth issues Co-authored-by: irwinarruda <[email protected]> * ci: apply automated fixes and generate docs * test: add large schema test --------- Co-authored-by: irwinarruda <[email protected]> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> * docs: add initial philosophy doc * docs: add initial docs for form composition * docs: add withForm docs examples * docs: add form composition page to docs config * fix: attempt to fix infinite loops with createFormHook * ci: apply automated fixes and generate docs * docs: Apply suggestions from code review Co-authored-by: LeCarbonator <[email protected]> * feat: make minimum TS supported version 5.4, remove NoInfer hack * chore: fix Sherif TS errors * ci: apply automated fixes and generate docs * docs: add Mermaid chart from the GitHub PR --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: irwinarruda <[email protected]> Co-authored-by: LeCarbonator <[email protected]>
1 parent 9d125c7 commit 49fea74

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+3400
-3011
lines changed

docs/assets/react_form_composability.svg

+3
Loading

docs/config.json

+8
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717
"label": "Installation",
1818
"to": "installation"
1919
},
20+
{
21+
"label": "Philosophy",
22+
"to": "philosophy"
23+
},
2024
{
2125
"label": "Comparison",
2226
"to": "comparison"
@@ -109,6 +113,10 @@
109113
"label": "UI Libraries",
110114
"to": "framework/react/guides/ui-libraries"
111115
},
116+
{
117+
"label": "Form Composition",
118+
"to": "framework/react/guides/form-composition"
119+
},
112120
{
113121
"label": "React Native",
114122
"to": "framework/react/guides/react-native"

docs/framework/angular/reference/classes/tanstackfield.md

+15-15
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ title: TanStackField
77

88
# Class: TanStackField\<TParentData, TName, TData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TFormOnMount, TFormOnChange, TFormOnChangeAsync, TFormOnBlur, TFormOnBlurAsync, TFormOnSubmit, TFormOnSubmitAsync, TFormOnServer, TSubmitMeta\>
99

10-
Defined in: [tanstack-field.directive.ts:32](https://github.com/TanStack/form/blob/main/packages/angular-form/src/tanstack-field.directive.ts#L32)
10+
Defined in: [tanstack-field.directive.ts:31](https://github.com/TanStack/form/blob/main/packages/angular-form/src/tanstack-field.directive.ts#L31)
1111

1212
## Type Parameters
1313

@@ -76,7 +76,7 @@ new TanStackField<TParentData, TName, TData, TOnMount, TOnChange, TOnChangeAsync
7676
api: FieldApi<TParentData, TName, TData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TFormOnMount, TFormOnChange, TFormOnChangeAsync, TFormOnBlur, TFormOnBlurAsync, TFormOnSubmit, TFormOnSubmitAsync, TFormOnServer, TSubmitMeta>;
7777
```
7878

79-
Defined in: [tanstack-field.directive.ts:133](https://github.com/TanStack/form/blob/main/packages/angular-form/src/tanstack-field.directive.ts#L133)
79+
Defined in: [tanstack-field.directive.ts:129](https://github.com/TanStack/form/blob/main/packages/angular-form/src/tanstack-field.directive.ts#L129)
8080

8181
***
8282

@@ -86,7 +86,7 @@ Defined in: [tanstack-field.directive.ts:133](https://github.com/TanStack/form/b
8686
optional asyncAlways: boolean;
8787
```
8888

89-
Defined in: [tanstack-field.directive.ts:82](https://github.com/TanStack/form/blob/main/packages/angular-form/src/tanstack-field.directive.ts#L82)
89+
Defined in: [tanstack-field.directive.ts:78](https://github.com/TanStack/form/blob/main/packages/angular-form/src/tanstack-field.directive.ts#L78)
9090

9191
If `true`, always run async validation, even if there are errors emitted during synchronous validation.
9292

@@ -104,7 +104,7 @@ FieldOptions.asyncAlways
104104
optional asyncDebounceMs: number;
105105
```
106106

107-
Defined in: [tanstack-field.directive.ts:81](https://github.com/TanStack/form/blob/main/packages/angular-form/src/tanstack-field.directive.ts#L81)
107+
Defined in: [tanstack-field.directive.ts:77](https://github.com/TanStack/form/blob/main/packages/angular-form/src/tanstack-field.directive.ts#L77)
108108

109109
The default time to debounce async validation if there is not a more specific debounce time passed.
110110

@@ -122,7 +122,7 @@ FieldOptions.asyncDebounceMs
122122
optional defaultMeta: Partial<FieldMeta<TParentData, TName, TData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TFormOnMount, TFormOnChange, TFormOnChangeAsync, TFormOnBlur, TFormOnBlurAsync, TFormOnSubmit, TFormOnSubmitAsync>>;
123123
```
124124

125-
Defined in: [tanstack-field.directive.ts:110](https://github.com/TanStack/form/blob/main/packages/angular-form/src/tanstack-field.directive.ts#L110)
125+
Defined in: [tanstack-field.directive.ts:106](https://github.com/TanStack/form/blob/main/packages/angular-form/src/tanstack-field.directive.ts#L106)
126126

127127
An optional object with default metadata for the field.
128128

@@ -140,7 +140,7 @@ FieldOptions.defaultMeta
140140
optional defaultValue: NoInfer<TData>;
141141
```
142142

143-
Defined in: [tanstack-field.directive.ts:80](https://github.com/TanStack/form/blob/main/packages/angular-form/src/tanstack-field.directive.ts#L80)
143+
Defined in: [tanstack-field.directive.ts:76](https://github.com/TanStack/form/blob/main/packages/angular-form/src/tanstack-field.directive.ts#L76)
144144

145145
An optional default value for the field.
146146

@@ -158,7 +158,7 @@ FieldOptions.defaultValue
158158
optional disableErrorFlat: boolean;
159159
```
160160

161-
Defined in: [tanstack-field.directive.ts:131](https://github.com/TanStack/form/blob/main/packages/angular-form/src/tanstack-field.directive.ts#L131)
161+
Defined in: [tanstack-field.directive.ts:127](https://github.com/TanStack/form/blob/main/packages/angular-form/src/tanstack-field.directive.ts#L127)
162162

163163
Disable the `flat(1)` operation on `field.errors`. This is useful if you want to keep the error structure as is. Not suggested for most use-cases.
164164

@@ -176,7 +176,7 @@ FieldOptions.disableErrorFlat
176176
optional listeners: NoInfer<FieldListeners<TParentData, TName, TData>>;
177177
```
178178

179-
Defined in: [tanstack-field.directive.ts:109](https://github.com/TanStack/form/blob/main/packages/angular-form/src/tanstack-field.directive.ts#L109)
179+
Defined in: [tanstack-field.directive.ts:105](https://github.com/TanStack/form/blob/main/packages/angular-form/src/tanstack-field.directive.ts#L105)
180180

181181
A list of listeners which attach to the corresponding events
182182

@@ -194,7 +194,7 @@ FieldOptions.listeners
194194
name: TName;
195195
```
196196

197-
Defined in: [tanstack-field.directive.ts:76](https://github.com/TanStack/form/blob/main/packages/angular-form/src/tanstack-field.directive.ts#L76)
197+
Defined in: [tanstack-field.directive.ts:75](https://github.com/TanStack/form/blob/main/packages/angular-form/src/tanstack-field.directive.ts#L75)
198198

199199
The field name. The type will be `DeepKeys<TParentData>` to ensure your name is a deep key of the parent dataset.
200200

@@ -212,7 +212,7 @@ FieldOptions.name
212212
tanstackField: FormApi<TParentData, TFormOnMount, TFormOnChange, TFormOnChangeAsync, TFormOnBlur, TFormOnBlurAsync, TFormOnSubmit, TFormOnSubmitAsync, TFormOnServer, TSubmitMeta>;
213213
```
214214

215-
Defined in: [tanstack-field.directive.ts:83](https://github.com/TanStack/form/blob/main/packages/angular-form/src/tanstack-field.directive.ts#L83)
215+
Defined in: [tanstack-field.directive.ts:79](https://github.com/TanStack/form/blob/main/packages/angular-form/src/tanstack-field.directive.ts#L79)
216216

217217
***
218218

@@ -222,7 +222,7 @@ Defined in: [tanstack-field.directive.ts:83](https://github.com/TanStack/form/bl
222222
optional unmount: () => void;
223223
```
224224

225-
Defined in: [tanstack-field.directive.ts:189](https://github.com/TanStack/form/blob/main/packages/angular-form/src/tanstack-field.directive.ts#L189)
225+
Defined in: [tanstack-field.directive.ts:185](https://github.com/TanStack/form/blob/main/packages/angular-form/src/tanstack-field.directive.ts#L185)
226226

227227
#### Returns
228228

@@ -236,7 +236,7 @@ Defined in: [tanstack-field.directive.ts:189](https://github.com/TanStack/form/b
236236
optional validators: NoInfer<FieldValidators<TParentData, TName, TData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync>>;
237237
```
238238

239-
Defined in: [tanstack-field.directive.ts:95](https://github.com/TanStack/form/blob/main/packages/angular-form/src/tanstack-field.directive.ts#L95)
239+
Defined in: [tanstack-field.directive.ts:91](https://github.com/TanStack/form/blob/main/packages/angular-form/src/tanstack-field.directive.ts#L91)
240240

241241
A list of validators to pass to the field
242242

@@ -254,7 +254,7 @@ FieldOptions.validators
254254
ngOnChanges(): void
255255
```
256256

257-
Defined in: [tanstack-field.directive.ts:201](https://github.com/TanStack/form/blob/main/packages/angular-form/src/tanstack-field.directive.ts#L201)
257+
Defined in: [tanstack-field.directive.ts:197](https://github.com/TanStack/form/blob/main/packages/angular-form/src/tanstack-field.directive.ts#L197)
258258

259259
A callback method that is invoked immediately after the
260260
default change detector has checked data-bound properties
@@ -279,7 +279,7 @@ OnChanges.ngOnChanges
279279
ngOnDestroy(): void
280280
```
281281

282-
Defined in: [tanstack-field.directive.ts:197](https://github.com/TanStack/form/blob/main/packages/angular-form/src/tanstack-field.directive.ts#L197)
282+
Defined in: [tanstack-field.directive.ts:193](https://github.com/TanStack/form/blob/main/packages/angular-form/src/tanstack-field.directive.ts#L193)
283283

284284
A callback method that performs custom clean-up, invoked immediately
285285
before a directive, pipe, or service instance is destroyed.
@@ -302,7 +302,7 @@ OnDestroy.ngOnDestroy
302302
ngOnInit(): void
303303
```
304304

305-
Defined in: [tanstack-field.directive.ts:191](https://github.com/TanStack/form/blob/main/packages/angular-form/src/tanstack-field.directive.ts#L191)
305+
Defined in: [tanstack-field.directive.ts:187](https://github.com/TanStack/form/blob/main/packages/angular-form/src/tanstack-field.directive.ts#L187)
306306

307307
A callback method that is invoked immediately after the
308308
default change detector has checked the directive's

0 commit comments

Comments
 (0)