Skip to content

Commit

Permalink
Update API refs with typedoc
Browse files Browse the repository at this point in the history
  • Loading branch information
JoseLion committed May 8, 2024
1 parent ccb8ac4 commit 9c78e60
Show file tree
Hide file tree
Showing 61 changed files with 9,779 additions and 11,822 deletions.
686 changes: 26 additions & 660 deletions packages/core/docs/README.md

Large diffs are not rendered by default.

31 changes: 31 additions & 0 deletions packages/core/docs/functions/ArrayField.md
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)
33 changes: 33 additions & 0 deletions packages/core/docs/functions/Field.md
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)
29 changes: 29 additions & 0 deletions packages/core/docs/functions/FormProvider.md
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)
42 changes: 42 additions & 0 deletions packages/core/docs/functions/arrayFieldOf.md
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)
54 changes: 54 additions & 0 deletions packages/core/docs/functions/fieldOf.md
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)
28 changes: 28 additions & 0 deletions packages/core/docs/functions/noValidate.md
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)
35 changes: 35 additions & 0 deletions packages/core/docs/functions/useArrayField.md
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)
42 changes: 42 additions & 0 deletions packages/core/docs/functions/useField.md
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)
31 changes: 31 additions & 0 deletions packages/core/docs/functions/useFieldValidation.md
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)
27 changes: 27 additions & 0 deletions packages/core/docs/functions/useForm.md
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)
33 changes: 33 additions & 0 deletions packages/core/docs/functions/useFormSelector.md
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)
Loading

0 comments on commit 9c78e60

Please sign in to comment.