-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: basic form group impl with aria support * feat: add inline component implementation * feat: form group context and path prefixes * refactor: move useformfield to top level * refactor: move form folder to useform * feat: implement field level schema * fix: util bug * fix: combine field and form level errors * test: use flush before submit * feat: implement useFormGroup state aggregator * feat: form-group level validation * feat: added support for output merging * style: fix lint rule * feat: added tests and changed native validation enum value * fix: sort merged outputs correctly * refactor: rename merge to stitch because it is cooler * fix: import path * feat: added schema prop to all input composables
- Loading branch information
Showing
40 changed files
with
1,062 additions
and
153 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,4 +13,5 @@ dist | |
.DS_STORE | ||
|
||
lerna-debug.log | ||
packages/*/dist/** | ||
packages/*/src/playground.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
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 @@ | ||
declare const __DEV__: boolean; |
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 |
---|---|---|
@@ -1,9 +1,37 @@ | ||
import { Schema, Simplify } from 'type-fest'; | ||
import { FormObject } from './common'; | ||
import { Path } from './paths'; | ||
import { TypedSchemaError } from './typedSchema'; | ||
import { FormValidationMode } from '../useForm/formContext'; | ||
|
||
export type TouchedSchema<TForm extends FormObject> = Simplify<Schema<TForm, boolean>>; | ||
|
||
export type DisabledSchema<TForm extends FormObject> = Partial<Record<Path<TForm>, boolean>>; | ||
|
||
export type ErrorsSchema<TForm extends FormObject> = Partial<Record<Path<TForm>, string[]>>; | ||
|
||
type BaseValidationResult = { | ||
isValid: boolean; | ||
errors: TypedSchemaError[]; | ||
}; | ||
|
||
export interface ValidationResult<TValue = unknown> extends BaseValidationResult { | ||
type: 'FIELD'; | ||
output: TValue; | ||
path: string; | ||
} | ||
|
||
export interface GroupValidationResult<TOutput extends FormObject = FormObject> extends BaseValidationResult { | ||
type: 'GROUP'; | ||
path: string; | ||
output: TOutput; | ||
mode: FormValidationMode; | ||
} | ||
|
||
export interface FormValidationResult<TOutput extends FormObject = FormObject> extends BaseValidationResult { | ||
type: 'FORM'; | ||
output: TOutput; | ||
mode: FormValidationMode; | ||
} | ||
|
||
export type AnyValidationResult = GroupValidationResult | ValidationResult; |
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
File renamed without changes.
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 @@ | ||
export * from './useForm'; |
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
Oops, something went wrong.