-
-
Notifications
You must be signed in to change notification settings - Fork 358
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* solid commit -a * fix failing tests and formatting * comments + removed unneeded computed * updated changes * prettierd * chore: add Solid Form to script to be deployed * fix: fix typing of solid's Subscribe data * chore: remove errant createEffect * chore: rename Solid's useForm and useField to createForm and createField * chore: remove old mention of React's memoization * chore: add Solid simple example * chore: add Solid yup example * chore: add Zod Solid example * docs: add initial docs for Solid package --------- Co-authored-by: Corbin Crutchley <[email protected]>
- Loading branch information
1 parent
1b394a7
commit 6050fea
Showing
67 changed files
with
5,165 additions
and
1,868 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
--- | ||
id: quick-start | ||
title: Quick Start | ||
--- | ||
|
||
The bare minimum to get started with TanStack Form is to create a form and add a field. Keep in mind that this example does not include any validation or error handling... yet. | ||
|
||
```tsx | ||
import { createForm } from '@tanstack/solid-form' | ||
|
||
function App() { | ||
const form = createForm(() => ({ | ||
defaultValues: { | ||
fullName: '', | ||
}, | ||
onSubmit: async (values) => { | ||
// Do something with form data | ||
console.log(values) | ||
}, | ||
})) | ||
|
||
return ( | ||
<div> | ||
<h1>Simple Form Example</h1> | ||
<form.Provider> | ||
<form | ||
onSubmit={(e) => { | ||
e.preventDefault() | ||
e.stopPropagation() | ||
void form.handleSubmit() | ||
}} | ||
> | ||
<div> | ||
<form.Field | ||
name="fullName" | ||
children={(field) => ( | ||
<input | ||
name={field().name} | ||
value={field().state.value} | ||
onBlur={field().handleBlur} | ||
onInput={(e) => field().handleChange(e.target.value)} | ||
/> | ||
)} | ||
/> | ||
</div> | ||
<button type="submit">Submit</button> | ||
</form> | ||
</form.Provider> | ||
</div> | ||
) | ||
} | ||
``` | ||
|
||
From here, you'll be ready to explore all of the other features of TanStack Form! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
id: field | ||
title: Field | ||
--- | ||
|
||
Please see [/packages/solid-form/src/createField.tsx](https://github.com/TanStack/form/blob/main/packages/solid-form/src/createField.tsx) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
id: createField | ||
title: createField | ||
--- | ||
|
||
Please see [/packages/solid-form/src/createField.tsx](https://github.com/TanStack/form/blob/main/packages/solid-form/src/createField.tsx) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
id: createForm | ||
title: createForm | ||
--- | ||
|
||
Please see [/packages/solid-form/src/createForm.tsx](https://github.com/TanStack/form/blob/main/packages/solid-form/src/createForm.tsx) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
id: createFormFactory | ||
title: createFormFactory | ||
--- | ||
|
||
Please see [/packages/solid-form/src/createFormFactory.ts](https://github.com/TanStack/form/blob/main/packages/solid-form/src/createFormFactory.ts) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
id: fieldApi | ||
title: Field API | ||
--- | ||
|
||
Please see [/packages/solid-form/src/createField.tsx](https://github.com/TanStack/form/blob/main/packages/solid-form/src/createField.tsx) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
id: formApi | ||
title: Form API | ||
--- | ||
|
||
Please see [/packages/solid-form/src/createForm.tsx](https://github.com/TanStack/form/blob/main/packages/solid-form/src/createForm.tsx) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
pnpm-debug.log* | ||
lerna-debug.log* | ||
|
||
node_modules | ||
dist | ||
dist-ssr | ||
*.local | ||
|
||
# Editor directories and files | ||
.vscode/* | ||
!.vscode/extensions.json | ||
.idea | ||
.DS_Store | ||
*.suo | ||
*.ntvs* | ||
*.njsproj | ||
*.sln | ||
*.sw? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
## Usage | ||
|
||
```bash | ||
$ npm install # or pnpm install or yarn install | ||
``` | ||
|
||
### Learn more on the [Solid Website](https://solidjs.com) and come chat with us on our [Discord](https://discord.com/invite/solidjs) | ||
|
||
## Available Scripts | ||
|
||
In the project directory, you can run: | ||
|
||
### `npm run dev` | ||
|
||
Runs the app in the development mode.<br> | ||
Open [http://localhost:5173](http://localhost:5173) to view it in the browser. | ||
|
||
### `npm run build` | ||
|
||
Builds the app for production to the `dist` folder.<br> | ||
It correctly bundles Solid in production mode and optimizes the build for the best performance. | ||
|
||
The build is minified and the filenames include the hashes.<br> | ||
Your app is ready to be deployed! | ||
|
||
## Deployment | ||
|
||
Learn more about deploying your application with the [documentations](https://vitejs.dev/guide/static-deploy.html) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>TanStack Form Solid Simple Example App</title> | ||
</head> | ||
<body> | ||
<div id="root"></div> | ||
<script type="module" src="/src/index.tsx"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
{ | ||
"name": "@tanstack/form-example-solid-simple", | ||
"private": true, | ||
"type": "module", | ||
"scripts": { | ||
"dev": "vite", | ||
"build": "tsc && vite build", | ||
"test:types": "tsc --noEmit", | ||
"preview": "vite preview" | ||
}, | ||
"dependencies": { | ||
"@tanstack/form-core": "0.4.1", | ||
"@tanstack/solid-form": "0.4.1", | ||
"solid-js": "^1.7.8", | ||
"@tanstack/react-form": "0.4.1", | ||
"@tanstack/zod-form-adapter": "0.4.1", | ||
"@tanstack/yup-form-adapter": "0.4.1" | ||
}, | ||
"devDependencies": { | ||
"typescript": "^5.0.2", | ||
"vite": "^4.4.5", | ||
"vite-plugin-solid": "^2.7.0" | ||
}, | ||
"nx": { | ||
"implicitDependencies": [ | ||
"@tanstack/form-core", | ||
"@tanstack/solid-form" | ||
], | ||
"targets": { | ||
"test:types": { | ||
"dependsOn": [ | ||
"build" | ||
] | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.