Skip to content

Commit ef7fc27

Browse files
authored
Merge branch 'TanStack:main' into fix-isBlurred
2 parents 45410e4 + e07a6ba commit ef7fc27

File tree

100 files changed

+6102
-4965
lines changed

Some content is hidden

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

100 files changed

+6102
-4965
lines changed

.github/workflows/autofix.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,18 @@ permissions:
1414

1515
jobs:
1616
autofix:
17-
if: ${{ !contains(github.event.head_commit.message, 'apply automated fixes')}}
1817
name: autofix
1918
runs-on: ubuntu-latest
2019
steps:
2120
- name: Checkout
22-
uses: actions/checkout@v4
21+
uses: actions/checkout@v4.2.1
2322
- name: Setup Tools
2423
uses: tanstack/config/.github/setup@main
2524
- name: Fix formatting
2625
run: pnpm prettier:write
2726
- name: Generate Docs
28-
if: ${{ github.event_name == 'push' }}
2927
run: pnpm docs:generate
30-
3128
- name: Apply fixes
3229
uses: autofix-ci/action@ff86a557419858bb967097bfc916833f5647fa8c
3330
with:
34-
commit-message: 'ci: apply automated fixes'
31+
commit-message: 'ci: apply automated fixes and generate docs'

docs/framework/angular/guides/validation.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,38 @@ export class AppComponent {
469469
}
470470
```
471471

472+
### Form Level Adapter Validation
473+
474+
You can also use the adapter at the form level:
475+
476+
```typescript
477+
import { zodValidator } from '@tanstack/zod-form-adapter'
478+
import { z } from 'zod'
479+
480+
// ...
481+
482+
const form = injectForm({
483+
validatorAdapter: zodValidator(),
484+
validators: {
485+
onChange: z.object({
486+
age: z.number().gte(13, 'You must be 13 to make an account'),
487+
}),
488+
},
489+
})
490+
```
491+
492+
If you use the adapter at the form level, it will pass the validation to the fields of the same name.
493+
494+
This means that:
495+
496+
```html
497+
<ng-container [tanstackField]="form" name="age" #age="field">
498+
<!-- ... -->
499+
</ng-container>
500+
```
501+
502+
Will still display the error message from the form-level validation.
503+
472504
## Preventing invalid forms from being submitted
473505

474506
The `onChange`, `onBlur` etc... callbacks are also run when the form is submitted and the submission is blocked if the form is invalid.

docs/framework/react/guides/react-native.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Here is an example:
1717
{field => (
1818
<>
1919
<Text>Age:</Text>
20-
<TextInput value={field.state.value} onChangeText={handleChange} />
20+
<TextInput value={field.state.value} onChangeText={field.handleChange} />
2121
{
2222
field.state.meta.errors
2323
? <Text>{field.state.meta.errors.join(', ')}</Text>

docs/framework/react/guides/validation.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,44 @@ These adapters also support async operations using the proper property names:
477477
/>
478478
```
479479
480+
### Form Level Adapter Validation
481+
482+
You can also use the adapter at the form level:
483+
484+
```tsx
485+
import { zodValidator } from '@tanstack/zod-form-adapter'
486+
import { z } from 'zod'
487+
488+
// ...
489+
490+
const formSchema = z.object({
491+
age: z.number().gte(13, 'You must be 13 to make an account'),
492+
})
493+
494+
const form = useForm({
495+
validatorAdapter: zodValidator(),
496+
validators: {
497+
onChange: formSchema
498+
},
499+
})
500+
```
501+
502+
If you use the adapter at the form level, it will pass the validation to the fields of the same name.
503+
504+
This means that:
505+
506+
```tsx
507+
508+
<form.Field
509+
name="age"
510+
children={(field) => {
511+
return <>{/* ... */}</>
512+
}}
513+
/>
514+
```
515+
516+
Will still display the error message from the form-level validation.
517+
480518
## Preventing invalid forms from being submitted
481519
482520
The `onChange`, `onBlur` etc... callbacks are also run when the form is submitted and the submission is blocked if the form is invalid.

docs/framework/solid/guides/validation.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,44 @@ These adapters also support async operations using the proper property names:
376376
/>
377377
```
378378

379+
### Form Level Adapter Validation
380+
381+
382+
You can also use the adapter at the form level:
383+
384+
```tsx
385+
import { zodValidator } from '@tanstack/zod-form-adapter'
386+
import { z } from 'zod'
387+
388+
// ...
389+
390+
const form = createForm(() => ({
391+
validatorAdapter: zodValidator(),
392+
validators: {
393+
onChange: z.object({
394+
age: z.number().gte(13, 'You must be 13 to make an account'),
395+
}),
396+
},
397+
}))
398+
```
399+
400+
If you use the adapter at the form level, it will pass the validation to the fields of the same name.
401+
402+
This means that:
403+
404+
```tsx
405+
406+
<form.Field
407+
name="age"
408+
children={(field) => {
409+
return <>{/* ... */}</>
410+
}}
411+
/>
412+
```
413+
414+
Will still display the error message from the form-level validation.
415+
416+
379417
## Preventing invalid forms from being submitted
380418

381419
The `onChange`, `onBlur` etc... callbacks are also run when the form is submitted and the submission is blocked if the form is invalid.

docs/framework/solid/reference/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ title: "@tanstack/solid-form"
1616

1717
## Functions
1818

19-
- [Field](functions/field.md)
2019
- [createField](functions/createfield.md)
2120
- [createForm](functions/createform.md)
21+
- [Field](functions/field.md)

docs/framework/solid/reference/interfaces/solidformapi.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,18 @@ title: SolidFormApi
1313

1414
## Properties
1515

16+
### createField
17+
18+
```ts
19+
createField: CreateField<TFormData, TFormValidator>;
20+
```
21+
22+
#### Defined in
23+
24+
[createForm.tsx:16](https://github.com/TanStack/form/blob/main/packages/solid-form/src/createForm.tsx#L16)
25+
26+
***
27+
1628
### Field
1729

1830
```ts
@@ -53,18 +65,6 @@ Subscribe: <TSelected>(props) => Element;
5365

5466
***
5567

56-
### createField
57-
58-
```ts
59-
createField: CreateField<TFormData, TFormValidator>;
60-
```
61-
62-
#### Defined in
63-
64-
[createForm.tsx:16](https://github.com/TanStack/form/blob/main/packages/solid-form/src/createForm.tsx#L16)
65-
66-
***
67-
6868
### useStore()
6969

7070
```ts

0 commit comments

Comments
 (0)