Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
2a553e7
Initial Lit commit
Christian24 Jan 21, 2024
2b67b07
Fix tests
Christian24 Jan 21, 2024
ff7942c
Fix types
Christian24 Jan 22, 2024
69e867c
Remove unused packages
Christian24 Jan 22, 2024
8b70a3f
Remove unused packages
Christian24 Jan 22, 2024
57c33e0
Run prettier
Christian24 Jan 22, 2024
e3d2516
Removed tsup
Christian24 Jan 22, 2024
c5f4eb8
Change exports
Christian24 Jan 22, 2024
7e3a7af
Add simple example
Christian24 Jan 22, 2024
d9792cf
Prettier
Christian24 Jan 22, 2024
b488673
New example
Christian24 Jan 23, 2024
2f2c5f7
Add docs
Christian24 Jan 23, 2024
ad6b2e1
feat: support array notation in DeepKeys and DeepValue types
crutchcorn Jan 28, 2024
41afa97
fix: support numerical values for arrays in DeepValue better
crutchcorn Jan 28, 2024
87c3eac
feat!: remove form.Provider from React package
crutchcorn Jan 28, 2024
ee69c9b
chore: fix utils tests in regards to arrays
crutchcorn Jan 28, 2024
5f56e9c
feat!: remove form.Provider from Solid package
crutchcorn Jan 28, 2024
20803b8
chore!: proof of working arrays in react
crutchcorn Jan 28, 2024
c74fc86
Update docs/framework/lit/quick-start.md
Christian24 Feb 14, 2024
cfa5ab2
Update packages/lit-form/src/tanstack-form-controller.ts
Christian24 Feb 14, 2024
e1cc779
Update docs/framework/lit/quick-start.md
Christian24 Feb 14, 2024
bc50a5e
Add textarea
Christian24 Feb 18, 2024
c686d12
Merge remote-tracking branch 'origin/main'
Christian24 Feb 18, 2024
e7491f9
Merge branch 'main' into array-and-provider-refactor
crutchcorn Feb 29, 2024
acd30d9
Merge branch 'main' into array-and-provider-refactor
crutchcorn Mar 5, 2024
ce52a3a
chore: change Vue behavior and types
crutchcorn Mar 5, 2024
ce7c6bd
chore: fix CI, apply formatter, etc
crutchcorn Mar 5, 2024
2afe390
docs: remove mention of provider from docs
crutchcorn Mar 5, 2024
709167c
chore: add test to React array usage
crutchcorn Mar 5, 2024
9c2c73f
test: add test to Solid form
crutchcorn Mar 5, 2024
e3829ad
chore: fix Solid test
crutchcorn Mar 5, 2024
8302d49
chore: add array test to Vue
crutchcorn Mar 5, 2024
4468a46
chore: fix CI
crutchcorn Mar 5, 2024
ec09b38
docs: add array example to react docs
crutchcorn Mar 5, 2024
dfa5997
docs: improve the React basic concepts example
crutchcorn Mar 5, 2024
68c5375
chore: add React array example
crutchcorn Mar 5, 2024
cf623c0
docs: add SolidJS example and docs
crutchcorn Mar 5, 2024
be37e6b
chore: add Vue example
crutchcorn Mar 5, 2024
0f00a0e
docs: add array guide to Vue
crutchcorn Mar 5, 2024
6b3f58e
chore: fix CI
crutchcorn Mar 5, 2024
908d6f0
Merge branch 'main' into array-and-provider-refactor
crutchcorn Mar 9, 2024
c740617
chore: fix CI issues
crutchcorn Mar 9, 2024
5bbd418
Merge branch 'main' into Christian24/main
crutchcorn Mar 9, 2024
a413de3
Merge branch 'array-and-provider-refactor' into Christian24/main
crutchcorn Mar 9, 2024
f3f08a7
chore: fix CI
crutchcorn Mar 9, 2024
2bf8b70
chore: add back errorText to UI library demo
crutchcorn Mar 9, 2024
33da9df
chore: add back error validation in simple demo
crutchcorn Mar 9, 2024
fc217a2
chore: fix default value issues
crutchcorn Mar 9, 2024
ef30ec3
docs: remove mention of bind in quickstart docs
crutchcorn Mar 9, 2024
d71df41
docs: add to publish and docs
crutchcorn Mar 9, 2024
a561827
Merge branch 'main' into Christian24/main
crutchcorn Mar 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ body:
- type: dropdown
id: adapter
attributes:
label: Tanstack Form adapter
label: TanStack Form adapter
description: |
Please let us know which adapter of TanStack Form you were using when the issue occurred.
options:
Expand Down
22 changes: 22 additions & 0 deletions docs/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,15 @@
"to": "framework/solid/quick-start"
}
]
},
{
"label": "lit",
"children": [
{
"label": "Quick Start",
"to": "framework/lit/quick-start"
}
]
}
]
},
Expand Down Expand Up @@ -278,6 +287,19 @@
"to": "framework/solid/examples/valibot"
}
]
},
{
"label": "lit",
"children": [
{
"label": "Simple",
"to": "framework/lit/examples/simple"
},
{
"label": "UI Libraries",
"to": "framework/lit/examples/ui-libraries"
}
]
}
]
}
Expand Down
65 changes: 65 additions & 0 deletions docs/framework/lit/quick-start.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
---
id: quick-start
title: Quick Start
---


The bare minimum to get started with TanStack Form is to create a `TanstackFormController`:

```ts
interface Employee {
firstName: string
lastName: string
employed: boolean
jobTitle: string
}

#form = new TanstackFormController(this, {
defaultValues: {
employees: [] as Employee[],
},
})
```

In this example `this` references the instance of your `LitElement` in which you want to use TanStack Form.

To wire a form element in your template up with TanStack Form, use the `field` method of `TanstackFormController`:

```ts
export class TestForm extends LitElement {
render() {
return html`
<p>Please enter your first name></p>
${this.form.field(
{
name: `firstName`,
validators: {
onChange: ({ value }) =>
value.length < 3 ? 'Not long enough' : undefined,
},
},
(field: FieldApi<Employee, 'firstName'>) => {
return html` <div>
<label>First Name</label>
<input
id="firstName"
type="text"
placeholder="First Name"
@blur="${() => field.handleBlur()}"
.value="${field.getValue()}"
@input="${(event: InputEvent) => {
if (event.currentTarget) {
const newValue = (event.currentTarget as HTMLInputElement).value;
field.handleChange(newValue);
}
}}"
/>
</div>`
},
)}`;
}
}
```

The first parameter of `field` is `FieldOptions` and the second is callback to render your element. Be aware that you need
to handle updating the element and form yourself as seen in the example above.
2 changes: 1 addition & 1 deletion docs/framework/react/guides/react-native.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ id: react-native
title: Usage with React Native
---

Tanstack Form is headless and it should support React Native out-of-the-box without needing any additional configuration.
TanStack Form is headless and it should support React Native out-of-the-box without needing any additional configuration.

Here is an example:

Expand Down
15 changes: 15 additions & 0 deletions examples/lit/simple/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// @ts-check

/** @type {import('eslint').Linter.Config} */
const config = {
extends: ['plugin:react/recommended', 'plugin:react-hooks/recommended'],
parserOptions: {
tsconfigRootDir: __dirname,
project: './tsconfig.json',
},
rules: {
'react/no-children-prop': 'off',
},
}

module.exports = config
27 changes: 27 additions & 0 deletions examples/lit/simple/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build

pnpm-lock.yaml
yarn.lock
package-lock.json

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
6 changes: 6 additions & 0 deletions examples/lit/simple/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Example

To run this example:

- `npm install`
- `npm run dev`
13 changes: 13 additions & 0 deletions examples/lit/simple/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + Lit + TS</title>
<script type="module" src="/src/index.ts"></script>
</head>
<body>
<tanstack-form-demo> </tanstack-form-demo>
</body>
</html>
30 changes: 30 additions & 0 deletions examples/lit/simple/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"name": "@tanstack/form-example-lit-simple",
"version": "0.0.1",
"main": "src/index.jsx",
"scripts": {
"dev": "vite --port=3001",
"build": "vite build",
"preview": "vite preview",
"test:types": "tsc"
},
"dependencies": {
"@tanstack/lit-form": "<1.0.0",
"lit": "^3.1.1"
},
"devDependencies": {
"vite": "^5.0.10"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
Loading