-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
61 changed files
with
9,779 additions
and
11,822 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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,31 @@ | ||
[**@lynxts/core**](../README.md) • **Docs** | ||
|
||
*** | ||
|
||
[@lynxts/core](../README.md) / ArrayField | ||
|
||
# Function: ArrayField() | ||
|
||
> **ArrayField**\<`T`, `K`\>(`props`): `ReactElement`\<`any`, `string` \| `JSXElementConstructor`\<`any`\>\> | ||
Helper component for array fields with finner control over the re-renders. | ||
|
||
## Type parameters | ||
|
||
• **T** *extends* [`Struct`](../type-aliases/Struct.md) | ||
|
||
• **K** *extends* `string` | ||
|
||
## Parameters | ||
|
||
• **props**: [`ArrayFieldProps`](../interfaces/ArrayFieldProps.md)\<`T`, `K`\> | ||
|
||
the array field props | ||
|
||
## Returns | ||
|
||
`ReactElement`\<`any`, `string` \| `JSXElementConstructor`\<`any`\>\> | ||
|
||
## Source | ||
|
||
[lib/components/ArrayField.component.tsx:62](https://github.com/JoseLion/lynxts/blob/main/packages/core/src/lib/components/ArrayField.component.tsx#L62) |
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,33 @@ | ||
[**@lynxts/core**](../README.md) • **Docs** | ||
|
||
*** | ||
|
||
[@lynxts/core](../README.md) / Field | ||
|
||
# Function: Field() | ||
|
||
> **Field**\<`T`, `K`, `D`\>(`props`): `ReactElement`\<`any`, `string` \| `JSXElementConstructor`\<`any`\>\> | ||
Helper component for rendering fields with finner control over the re-renders | ||
|
||
## Type parameters | ||
|
||
• **T** *extends* [`Struct`](../type-aliases/Struct.md) | ||
|
||
• **K** *extends* `string` | ||
|
||
• **D** = [`Optional`](../type-aliases/Optional.md)\<[`ValueByPath`](../type-aliases/ValueByPath.md)\<`T`, `K`\>\> | ||
|
||
## Parameters | ||
|
||
• **props**: [`FieldProps`](../interfaces/FieldProps.md)\<`T`, `K`, `D`\> | ||
|
||
the field props | ||
|
||
## Returns | ||
|
||
`ReactElement`\<`any`, `string` \| `JSXElementConstructor`\<`any`\>\> | ||
|
||
## Source | ||
|
||
[lib/components/Field.component.tsx:78](https://github.com/JoseLion/lynxts/blob/main/packages/core/src/lib/components/Field.component.tsx#L78) |
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,29 @@ | ||
[**@lynxts/core**](../README.md) • **Docs** | ||
|
||
*** | ||
|
||
[@lynxts/core](../README.md) / FormProvider | ||
|
||
# Function: FormProvider() | ||
|
||
> **FormProvider**\<`T`\>(`props`): `ReactElement`\<`any`, `string` \| `JSXElementConstructor`\<`any`\>\> | ||
The form context provider component. | ||
|
||
## Type parameters | ||
|
||
• **T** *extends* [`Struct`](../type-aliases/Struct.md) | ||
|
||
## Parameters | ||
|
||
• **props**: [`FormProviderProps`](../interfaces/FormProviderProps.md)\<`T`\> | ||
|
||
the provider component props | ||
|
||
## Returns | ||
|
||
`ReactElement`\<`any`, `string` \| `JSXElementConstructor`\<`any`\>\> | ||
|
||
## Source | ||
|
||
[lib/Form.provider.tsx:139](https://github.com/JoseLion/lynxts/blob/main/packages/core/src/lib/Form.provider.tsx#L139) |
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,42 @@ | ||
[**@lynxts/core**](../README.md) • **Docs** | ||
|
||
*** | ||
|
||
[@lynxts/core](../README.md) / arrayFieldOf | ||
|
||
# Function: arrayFieldOf() | ||
|
||
> **arrayFieldOf**\<`T`\>(): [`ArrayFieldOf`](../type-aliases/ArrayFieldOf.md)\<`T`\> | ||
Utility function which helps you create an [ArrayField](ArrayField.md) component of | ||
an specific struct type. Once you have this, the only type parameter left is | ||
the [Path\<T\>](../type-aliases/Path.md) of the property which is an array. | ||
|
||
## Type parameters | ||
|
||
• **T** *extends* [`Struct`](../type-aliases/Struct.md) | ||
|
||
## Returns | ||
|
||
[`ArrayFieldOf`](../type-aliases/ArrayFieldOf.md)\<`T`\> | ||
|
||
an ArrayField of the specified struct type | ||
|
||
## Example | ||
|
||
``` | ||
interface User { | ||
name: string; | ||
roles: Role[]; | ||
} | ||
const ArrayField = arrayFieldOf<User>(); | ||
<ArrayField name="roles"> | ||
... | ||
</ArrayField> | ||
``` | ||
|
||
## Source | ||
|
||
[lib/components/ArrayField.component.tsx:100](https://github.com/JoseLion/lynxts/blob/main/packages/core/src/lib/components/ArrayField.component.tsx#L100) |
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 @@ | ||
[**@lynxts/core**](../README.md) • **Docs** | ||
|
||
*** | ||
|
||
[@lynxts/core](../README.md) / fieldOf | ||
|
||
# Function: fieldOf() | ||
|
||
> **fieldOf**\<`T`\>(): [`FieldOf`](../type-aliases/FieldOf.md)\<`T`\> | ||
Utility function which helps you create a [Field](Field.md) component of an | ||
specific struct type. Once you have this, the only type parameters left is | ||
the [Path\<T\>](../type-aliases/Path.md) of the property and the optional fallback type. | ||
|
||
## Type parameters | ||
|
||
• **T** *extends* [`Struct`](../type-aliases/Struct.md) | ||
|
||
## Returns | ||
|
||
[`FieldOf`](../type-aliases/FieldOf.md)\<`T`\> | ||
|
||
a Field of the specified struct type | ||
|
||
## Example | ||
|
||
``` | ||
interface User { | ||
age: number; | ||
name: string; | ||
} | ||
const Field = fieldOf<User>(); | ||
// Now path may only be "name" or "age" | ||
<Field path="name" fallback={""}> | ||
{({ value, setValue, setTouched, required, error }) => ( | ||
<label> | ||
{`Name: ${required ? "*" : ""}`} | ||
<input | ||
type="number" | ||
onChange={e => setValue(e.target.value)} | ||
onBlur={setTouched} | ||
value={value} | ||
/> | ||
{error && <small>{error}</small>} | ||
</label> | ||
)} | ||
</Field> | ||
``` | ||
|
||
## Source | ||
|
||
[lib/components/Field.component.tsx:137](https://github.com/JoseLion/lynxts/blob/main/packages/core/src/lib/components/Field.component.tsx#L137) |
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 @@ | ||
[**@lynxts/core**](../README.md) • **Docs** | ||
|
||
*** | ||
|
||
[@lynxts/core](../README.md) / noValidate | ||
|
||
# Function: noValidate() | ||
|
||
> **noValidate**\<`T`\>(): [`Adapter`](../interfaces/Adapter.md)\<`T`\> | ||
Helper function that creates an [Adapter\<T\>](../interfaces/Adapter.md) to bypass the | ||
form validation. | ||
|
||
## Type parameters | ||
|
||
• **T** *extends* [`Struct`](../type-aliases/Struct.md) | ||
|
||
struct type of the form values | ||
|
||
## Returns | ||
|
||
[`Adapter`](../interfaces/Adapter.md)\<`T`\> | ||
|
||
an adapter to bypass validation | ||
|
||
## Source | ||
|
||
[lib/helpers/adapters.ts:65](https://github.com/JoseLion/lynxts/blob/main/packages/core/src/lib/helpers/adapters.ts#L65) |
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,35 @@ | ||
[**@lynxts/core**](../README.md) • **Docs** | ||
|
||
*** | ||
|
||
[@lynxts/core](../README.md) / useArrayField | ||
|
||
# Function: useArrayField() | ||
|
||
> **useArrayField**\<`T`, `V`\>(`path`): [`UseArrayField`](../interfaces/UseArrayField.md)\<`V`\> | ||
A hook to handle array field in the form. It provides the array field items | ||
to iterate over and a few helper functions to handle changes and renders on | ||
the array. | ||
|
||
## Type parameters | ||
|
||
• **T** *extends* [`Struct`](../type-aliases/Struct.md) | ||
|
||
• **V** | ||
|
||
## Parameters | ||
|
||
• **path**: [`Path`](../type-aliases/Path.md)\<`T`, `V`[]\> | ||
|
||
the path of the array field in `T` | ||
|
||
## Returns | ||
|
||
[`UseArrayField`](../interfaces/UseArrayField.md)\<`V`\> | ||
|
||
an object containing the array items and helper array functions | ||
|
||
## Source | ||
|
||
[lib/hooks/useArrayField.ts:104](https://github.com/JoseLion/lynxts/blob/main/packages/core/src/lib/hooks/useArrayField.ts#L104) |
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,42 @@ | ||
[**@lynxts/core**](../README.md) • **Docs** | ||
|
||
*** | ||
|
||
[@lynxts/core](../README.md) / useField | ||
|
||
# Function: useField() | ||
|
||
> **useField**\<`T`, `V`, `D`\>(`path`, `fallback`?): [`UseField`](../interfaces/UseField.md)\<`V`, `D`\> | ||
A hook to handle fields in the form. It provides the current value of the | ||
field and helper function to change its state. | ||
|
||
If the `fallback` parameter is not set, the default value is `undefined`. | ||
|
||
## Type parameters | ||
|
||
• **T** *extends* [`Struct`](../type-aliases/Struct.md) | ||
|
||
• **V** | ||
|
||
• **D** = [`Optional`](../type-aliases/Optional.md)\<`V`\> | ||
|
||
## Parameters | ||
|
||
• **path**: [`Path`](../type-aliases/Path.md)\<`T`, [`Optional`](../type-aliases/Optional.md)\<`V`\>\> | ||
|
||
the path of the field in `T` | ||
|
||
• **fallback?**: `D` | ||
|
||
optional default value the field should take | ||
|
||
## Returns | ||
|
||
[`UseField`](../interfaces/UseField.md)\<`V`, `D`\> | ||
|
||
an object with the field value and some helper functions | ||
|
||
## Source | ||
|
||
[lib/hooks/useField.ts:39](https://github.com/JoseLion/lynxts/blob/main/packages/core/src/lib/hooks/useField.ts#L39) |
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,31 @@ | ||
[**@lynxts/core**](../README.md) • **Docs** | ||
|
||
*** | ||
|
||
[@lynxts/core](../README.md) / useFieldValidation | ||
|
||
# Function: useFieldValidation() | ||
|
||
> **useFieldValidation**\<`T`\>(`path`): [`UseFieldValidation`](../interfaces/UseFieldValidation.md) | ||
A hook to retrieve validation related states of a field. | ||
|
||
## Type parameters | ||
|
||
• **T** *extends* [`Struct`](../type-aliases/Struct.md) | ||
|
||
## Parameters | ||
|
||
• **path**: [`Path`](../type-aliases/Path.md)\<`T`\> | ||
|
||
the path of the field in `T` | ||
|
||
## Returns | ||
|
||
[`UseFieldValidation`](../interfaces/UseFieldValidation.md) | ||
|
||
an object with validation related states | ||
|
||
## Source | ||
|
||
[lib/hooks/useFieldValidation.ts:27](https://github.com/JoseLion/lynxts/blob/main/packages/core/src/lib/hooks/useFieldValidation.ts#L27) |
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,27 @@ | ||
[**@lynxts/core**](../README.md) • **Docs** | ||
|
||
*** | ||
|
||
[@lynxts/core](../README.md) / useForm | ||
|
||
# Function: useForm() | ||
|
||
> **useForm**\<`T`\>(): [`FormCtxt`](../interfaces/FormCtxt.md)\<`T`\> | ||
A hook to access the entire value of `FormCtxt<T>`. If you want just some | ||
properties of the context, use [useFormSelector](useFormSelector.md) instead for an | ||
increased performance and avoid unnecessary renders. | ||
|
||
## Type parameters | ||
|
||
• **T** *extends* [`Struct`](../type-aliases/Struct.md) | ||
|
||
## Returns | ||
|
||
[`FormCtxt`](../interfaces/FormCtxt.md)\<`T`\> | ||
|
||
the entire value of the form context | ||
|
||
## Source | ||
|
||
[lib/Form.context.ts:209](https://github.com/JoseLion/lynxts/blob/main/packages/core/src/lib/Form.context.ts#L209) |
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,33 @@ | ||
[**@lynxts/core**](../README.md) • **Docs** | ||
|
||
*** | ||
|
||
[@lynxts/core](../README.md) / useFormSelector | ||
|
||
# Function: useFormSelector() | ||
|
||
> **useFormSelector**\<`T`, `V`\>(`selector`): `V` | ||
A hook to select a value from the form `FormCtxt<T>`. | ||
|
||
## Type parameters | ||
|
||
• **T** *extends* [`Struct`](../type-aliases/Struct.md) | ||
|
||
• **V** | ||
|
||
## Parameters | ||
|
||
• **selector** | ||
|
||
a function to select a value from the context | ||
|
||
## Returns | ||
|
||
`V` | ||
|
||
the selected value | ||
|
||
## Source | ||
|
||
[lib/Form.context.ts:221](https://github.com/JoseLion/lynxts/blob/main/packages/core/src/lib/Form.context.ts#L221) |
Oops, something went wrong.