Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v3 docs #11

Open
wants to merge 76 commits into
base: johnrom/v3
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
7d31376
Strongly typed Formik & FormikRegistration. Next up: Fields.
johnrom Apr 17, 2021
faa1603
Need to figure out how to map to a flat list of possible Field Names …
jawnrom Apr 18, 2021
9184eef
Strongly typed Fields part 2... almost there
johnrom Apr 21, 2021
c5eff7c
Fix App/
johnrom Apr 21, 2021
64b764a
Move test code out, write a strongly typed tutorial in App/. Need to …
johnrom Apr 21, 2021
d137f31
Even strengthier. Need to figure out why auto-inference of TypedField…
johnrom Apr 21, 2021
cc17208
We can now do both `Value = FieldValue<Values, Path>` and `AnyName = …
johnrom Apr 22, 2021
37e9a1b
Fixes, also adding a test for array fields.
johnrom Apr 22, 2021
096cb92
Add number type to NameOf to support array paths.
johnrom Apr 23, 2021
9603f45
Testing and testing and testing... Can't get the inference 100% right.
johnrom Apr 23, 2021
56b7146
Testing Omit<ExtraProps> again.
johnrom Apr 23, 2021
0beed10
Doing some serious type checking. Need to be able to match paths with…
johnrom Apr 23, 2021
19f02d3
Enforced PathMatchingValue<>. Tested out a strongly typed Field in app/.
johnrom Apr 25, 2021
585371b
Getting there, but can't get the right inference between ComponentTyp…
johnrom Apr 25, 2021
3121589
Component works the same as As now.
johnrom Apr 25, 2021
8965788
Starting on FieldArray.
johnrom Apr 25, 2021
9173d00
ExtraProps Extends wasn't doing anything.
johnrom Apr 26, 2021
0397649
Removed ExtraProps to test without it. The benefit is questionable, w…
johnrom Apr 26, 2021
9d84a68
Custom Fields + AsFields + ComponentFields, fully inferred with cheap…
johnrom Apr 28, 2021
a4d9e29
Using only Value + PathMatchingValue. Lose a lil bit of intellisense …
johnrom Apr 29, 2021
dfb1a18
Strengthened PassThroughConfig so we can remove all our casts.
johnrom Apr 29, 2021
76c3948
Allow `any` prop components to work.
johnrom Apr 29, 2021
7bca09e
Switched from `<Values, Value>` to `<Value, Values>` for consistency.…
johnrom Apr 29, 2021
1439e67
Fix to support both Custom Fields and AnyProps.
johnrom Apr 30, 2021
bc96842
Fix FastField
johnrom Apr 30, 2021
b857119
Fix package.json
johnrom Apr 30, 2021
19c60b8
Update npm published version
johnrom Apr 30, 2021
c98b694
Whoops, 3.1.0
johnrom Apr 30, 2021
03b8c48
Type arrays with a magical "0" placeholder, and then replace 0 with $…
johnrom Apr 30, 2021
faac1d7
Merge branch 'johnrom/strong-types-v3' into johnrom/strong-types-publish
johnrom Apr 30, 2021
6caef79
Fix yarn
johnrom Apr 30, 2021
f7d3ac8
Tiny tweaks.
johnrom Apr 30, 2021
53ba9f0
Add default export to FieldTestsPage
johnrom May 4, 2021
a1016f3
Change back to old readmes and stuff, only use experimental readmes o…
johnrom May 4, 2021
572dcf7
Add another changeset for types
johnrom May 4, 2021
14e38b7
Add fallback types for Typescript < 4.1
johnrom May 4, 2021
6e74970
Merge branch 'johnrom/strong-types-v3' into johnrom/strong-types-publish
johnrom May 4, 2021
96c7a91
Whoops, backwards!
johnrom May 4, 2021
86509c2
Merge branch 'johnrom/strong-types-v3' into johnrom/strong-types-publish
johnrom May 4, 2021
8243f3b
types6
johnrom May 5, 2021
9b7300f
add an untyped ts build to redirect
johnrom May 5, 2021
7d59592
Add untyped build and ignore folder.
johnrom May 5, 2021
3b6d859
Merge branch 'johnrom/strong-types-v3' into johnrom/strong-types-publish
johnrom May 5, 2021
eb60c12
types7
johnrom May 5, 2021
43e95a6
update typesVersions and files in package.json
johnrom May 14, 2021
9ecdb56
Merge branch 'johnrom/strong-types-v3' into johnrom/strong-types-publish
johnrom May 14, 2021
f9aed8e
Added PathLikeValue to widen possibilities for setFieldValue. Now set…
johnrom May 14, 2021
ca89525
Merge branch 'johnrom/strong-types-v3' into johnrom/strong-types-publish
johnrom May 14, 2021
2e1338c
Accept either PathMatchingValue or PathLikeValue for setFieldValue.
johnrom May 14, 2021
22073a6
Merge branch 'johnrom/strong-types-v3' into johnrom/strong-types-publish
johnrom May 14, 2021
fd49d6e
Merge branch 'johnrom/parsing-refactor' into johnrom/strong-types-pub…
johnrom Jul 8, 2021
15b38bb
Get the package name right for publishing.
johnrom Jul 8, 2021
4329fce
Some merge fixes.
johnrom Jul 8, 2021
766b7ad
Release types12
johnrom Jul 8, 2021
528412f
Moving all packages to packages/*, to declutter root.
johnrom Oct 8, 2021
c0c1dd6
Update Website Formik version, rename examples package to `@formik/ex…
johnrom Oct 8, 2021
74447f3
Migrate scripts to use new package paths.
johnrom Oct 8, 2021
74a5503
Update Jest command config.
johnrom Oct 8, 2021
c04350e
Merge branch 'johnrom/v3' into johnrom/unified-docs-and-packages
johnrom Oct 8, 2021
529c715
Merge remote-tracking branch 'upstream/pr/3231' into johnrom/unified-…
johnrom Oct 14, 2021
bba47cf
Moving examples to TypeScript and using a root package.json.
johnrom Oct 14, 2021
131797b
Merge branch 'johnrom/v3' into johnrom/unified-docs-and-packages
johnrom Oct 14, 2021
f19ee46
Move all root examples to subdirectories, rename to typescript.
johnrom Oct 14, 2021
5c98b3f
Migrate all examples to TypeScript.
johnrom Oct 14, 2021
46e4feb
Starting to flip tutorial from `complex -> simple` to `simple -> comp…
johnrom Dec 3, 2021
3e2fd7b
Documenting takes a long time. Expanding on FormikState and moving do…
johnrom Dec 4, 2021
0b3e3af
Merge branch 'johnrom/v3' into johnrom/unified-docs-and-packages
johnrom Jan 24, 2022
4426a1e
Redoing the docs into Overview -> Tutorial -> Deep Dive format. Need …
johnrom Mar 18, 2022
3cf5f98
Some docs fixes.
johnrom Mar 25, 2022
ec9bf30
Merge remote-tracking branch 'origin/johnrom/v3' into johnrom/types-a…
johnrom Mar 28, 2022
a3895d3
Merge branch 'johnrom/types-and-batching' into johnrom/unified-docs-a…
johnrom Mar 28, 2022
7fbda3b
Fix a thing.
johnrom Mar 28, 2022
4c937f0
Added external subscriptions.
johnrom Apr 13, 2022
1033d6a
Added external subscriptions.
johnrom Apr 13, 2022
349d1c9
Merge branch 'johnrom/v3' into johnrom/unified-docs-and-packages
johnrom Apr 15, 2022
911e632
Merge branch 'johnrom/v3-with-external-subscriptions' into johnrom/un…
johnrom Apr 15, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 6 additions & 0 deletions .changeset/flat-peaches-hug.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'formik': major
'app': minor
---

Add strongly typed fields in an opt-in fashion using useTypedField() and useTypedFieldArray().
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
dist
dist-untyped
compiled
*.log
coverage
Expand All @@ -7,6 +8,7 @@ next.d.ts
legacy.d.ts
.idea
*.orig
__generated__

node_modules
package-lock.json
Expand Down
32 changes: 23 additions & 9 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,40 @@
"version": "0.2.0",
"configurations": [
{
"name": "Run NPM Dev",
"name": "Run Dev Web App",
"request": "launch",
"type": "node",
"runtimeArgs": [
"run",
"start:app"
"start:web"
],
"runtimeExecutable": "npm",
"cwd": "${workspaceFolder}",
"skipFiles": [
"<node_internals>/**"
]
},
{
"name": "Run Docs Website",
"request": "launch",
"type": "node",
"runtimeArgs": [
"run",
"start:website"
],
"runtimeExecutable": "npm",
"cwd": "${workspaceFolder}",
"skipFiles": [
"<node_internals>/**"
]
},
{
"type": "chrome",
"request": "launch",
"name": "Launch Chrome against localhost",
"url": "http://localhost:3000",
"webRoot": "${workspaceFolder}/app"
},
{
"type": "node",
"name": "vscode-jest-tests",
Expand All @@ -37,13 +58,6 @@
"protocol": "inspector",
"internalConsoleOptions": "neverOpen",
"disableOptimisticBPs": true
},
{
"type": "chrome",
"request": "launch",
"name": "Launch Chrome against localhost",
"url": "http://localhost:3000",
"webRoot": "${workspaceFolder}/app"
}
]
}
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"typescript.tsdk": "node_modules/typescript/lib",
"jest.pathToJest": "npm run test:vscode --",
"jest.jestCommandLine": "npm run test:vscode --",
}
13 changes: 0 additions & 13 deletions app-native/__generated__/AppEntry.js

This file was deleted.

59 changes: 0 additions & 59 deletions app/pages/tutorial/field-array.tsx

This file was deleted.

53 changes: 53 additions & 0 deletions docs/api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
id: api
title: The Formik API
---

### `handleBlur`

> `(e: any) => void`

`onBlur` event handler. Useful for when you need to track whether an input has
been `touched` or not. This should be passed to `<input onBlur={handleBlur} ... />`

### `handleChange`

> `(e: React.ChangeEvent<any>) => void`

General input change event handler. This will update the `values[key]` where
`key` is the event-emitting input's `name` attribute. If the `name` attribute is
not present, `handleChange` will look for an input's `id` attribute. Note:
"input" here means all HTML inputs.

### `handleReset`

> `() => void`

Reset handler. Will reset the form to its initial state. This should be passed
to `<button onClick={handleReset}>...</button>`

### `handleSubmit`

> `(e: React.FormEvent<HTMLFormElement>) => void`

Submit handler. This should be passed to `<form onSubmit={props.handleSubmit}>...</form>`. To learn more about the submission process, see [Form Submission](../guides/form-submission.md).

### `formik.useState()`

> ```ts
> <Values, Return>(
> selector: (state: FormikState<Values>) => Return
> comparer: (prev: Return, next: Return) => boolean
> shouldSubscribe: boolean
> ) => Return;
> ```

A special hook returned by Formik's API to access Formik's State within a render outside of Formik's context. See more in the [deep dive](./deep-dive#formik-state).

### `formik.getState()`

> ```ts
> <Values>() => FormikState<Values>;
> ```

A method to access Formik's State outside of a render, for example in an event handler. See more in the [deep dive](./deep-dive#formik-state).
63 changes: 0 additions & 63 deletions docs/api/useFormikContext.md

This file was deleted.

Loading