@radicalbit/formbit 2.1.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +150 -400
- package/dist/__tests__/is-validation-error.test.d.ts +1 -0
- package/dist/formbit-context.d.ts +4 -4
- package/dist/index.d.ts +1 -1
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +5 -5
- package/dist/index.modern.js.map +1 -1
- package/dist/types/index.d.ts +118 -273
- package/dist/use-execute-callbacks.d.ts +2 -2
- package/dist/use-formbit.d.ts +5 -5
- package/dist/validate-sync-all.d.ts +2 -2
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -23,7 +23,6 @@ Formbit is a **lightweight React state form library** designed to simplify form
|
|
|
23
23
|
- [Method Types](#method-types)
|
|
24
24
|
- [Options Types](#options-types)
|
|
25
25
|
- [Yup Re-Exports](#yup-re-exports)
|
|
26
|
-
- [Deprecated Types](#deprecated-types)
|
|
27
26
|
- [License](#license)
|
|
28
27
|
|
|
29
28
|
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
|
@@ -343,167 +342,132 @@ For local development we suggest using [Yalc](https://github.com/wclr/yalc) to t
|
|
|
343
342
|
|
|
344
343
|
### FormbitObject
|
|
345
344
|
|
|
346
|
-
Ƭ **FormbitObject**\<`
|
|
345
|
+
Ƭ **FormbitObject**\<`T`\>: `Object`
|
|
347
346
|
|
|
348
|
-
|
|
349
|
-
|
|
347
|
+
The object returned by `useFormbit()` and `useFormbitContext()`. Holds the form
|
|
348
|
+
state and every method needed to read, mutate and validate the form.
|
|
350
349
|
|
|
351
350
|
#### Type parameters
|
|
352
351
|
|
|
353
352
|
| Name | Type |
|
|
354
353
|
| :------ | :------ |
|
|
355
|
-
| `
|
|
354
|
+
| `T` | extends [`FormbitValues`](#formbitvalues) |
|
|
356
355
|
|
|
357
356
|
#### Type declaration
|
|
358
357
|
|
|
359
358
|
| Name | Type | Description |
|
|
360
359
|
| :------ | :------ | :------ |
|
|
361
|
-
| `check` | [`Check`](#check)\<`Partial`\<`
|
|
360
|
+
| `check` | [`Check`](#check)\<`Partial`\<`T`\>\> | Validates `json` against the current schema; returns the errors, or undefined if valid. |
|
|
362
361
|
| `error` | (`path`: `string`) => `string` \| `undefined` | - |
|
|
363
|
-
| `errors` | [`Errors`](#errors) |
|
|
364
|
-
| `form` | `Partial`\<`
|
|
365
|
-
| `initialize` | [`Initialize`](#initialize)\<`
|
|
366
|
-
| `isDirty` | `boolean` |
|
|
362
|
+
| `errors` | [`Errors`](#errors) | Error messages registered since the last validation, keyed by the value's dot-path. **`Example`** ```ts form: { age: 1 } errors: { age: "Age must be greater than 18" } ``` |
|
|
363
|
+
| `form` | `Partial`\<`T`\> | The current form values. Partial: fields may be missing until validated. |
|
|
364
|
+
| `initialize` | [`Initialize`](#initialize)\<`T`\> | Re-initializes the form with new initial values. |
|
|
365
|
+
| `isDirty` | `boolean` | True once the user has interacted with the form. |
|
|
367
366
|
| `isFormInvalid` | () => `boolean` | - |
|
|
368
367
|
| `isFormValid` | () => `boolean` | - |
|
|
369
368
|
| `liveValidation` | (`path`: `string`) => ``true`` \| `undefined` | - |
|
|
370
|
-
| `remove` | [`Remove`](#remove)\<`
|
|
371
|
-
| `removeAll` | [`RemoveAll`](#removeall)\<`
|
|
369
|
+
| `remove` | [`Remove`](#remove)\<`T`\> | Removes the value at `path`, sets `isDirty`, then validates `pathsToValidate` plus every live-validated field. |
|
|
370
|
+
| `removeAll` | [`RemoveAll`](#removeall)\<`T`\> | Removes every given path, sets `isDirty`, then validates `pathsToValidate` plus every live-validated field. |
|
|
372
371
|
| `resetForm` | () => `void` | - |
|
|
373
|
-
| `setError` | [`SetError`](#seterror) |
|
|
374
|
-
| `setSchema` | [`SetSchema`](#setschema)\<`
|
|
375
|
-
| `submitForm` | [`SubmitForm`](#submitform)\<`
|
|
376
|
-
| `validate` | [`Validate`](#validate)\<`
|
|
377
|
-
| `validateAll` | [`ValidateAll`](#validateall)\<`
|
|
378
|
-
| `validateForm` | [`ValidateForm`](#validateform)\<`Partial`\<`
|
|
379
|
-
| `write` | [`Write`](#write)\<`
|
|
380
|
-
| `writeAll` | [`WriteAll`](#writeall)\<`
|
|
372
|
+
| `setError` | [`SetError`](#seterror) | Sets the error message at `path`. |
|
|
373
|
+
| `setSchema` | [`SetSchema`](#setschema)\<`T`\> | Replaces the current validation schema. |
|
|
374
|
+
| `submitForm` | [`SubmitForm`](#submitform)\<`T`\> | Validates the whole form and, if valid, runs the success callback to submit. |
|
|
375
|
+
| `validate` | [`Validate`](#validate)\<`T`\> | Validates only `path` (ignores live-validated fields). |
|
|
376
|
+
| `validateAll` | [`ValidateAll`](#validateall)\<`T`\> | Validates only the given `paths` (ignores live-validated fields). |
|
|
377
|
+
| `validateForm` | [`ValidateForm`](#validateform)\<`Partial`\<`T`\>\> | Validates the whole form and registers any error. |
|
|
378
|
+
| `write` | [`Write`](#write)\<`T`\> | Writes `value` at `path`, sets `isDirty`, then validates `pathsToValidate` plus every live-validated field. |
|
|
379
|
+
| `writeAll` | [`WriteAll`](#writeall)\<`T`\> | Writes every `[path, value]` pair, sets `isDirty`, then validates `pathsToValidate` plus every live-validated field. |
|
|
381
380
|
|
|
382
381
|
#### Defined in
|
|
383
382
|
|
|
384
|
-
[index.ts:
|
|
383
|
+
[index.ts:186](https://github.com/radicalbit/formbit/blob/2ca1a8a/src/types/index.ts#L186)
|
|
385
384
|
### Core Types
|
|
386
385
|
|
|
387
386
|
#### Errors
|
|
388
387
|
|
|
389
388
|
Ƭ **Errors**: `Record`\<`string`, `string`\>
|
|
390
389
|
|
|
391
|
-
|
|
392
|
-
|
|
390
|
+
Error messages registered since the last validation, stored under the same
|
|
391
|
+
dot-path as the corresponding form value.
|
|
393
392
|
|
|
394
393
|
**`Example`**
|
|
395
394
|
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
{
|
|
399
|
-
"age": 1
|
|
400
|
-
}
|
|
401
|
-
```
|
|
402
|
-
and age is a non valid field, errors object will look like this
|
|
403
|
-
```json
|
|
404
|
-
{
|
|
405
|
-
"age": "Age must be greater then 18"
|
|
406
|
-
}
|
|
395
|
+
```ts
|
|
396
|
+
form: { age: 1 }
|
|
397
|
+
errors: { age: "Age must be greater than 18" }
|
|
407
398
|
```
|
|
408
399
|
|
|
409
400
|
#### Defined in
|
|
410
401
|
|
|
411
|
-
[index.ts:
|
|
412
|
-
#### Form
|
|
413
|
-
|
|
414
|
-
Ƭ **Form**: [`FormbitValues`](#formbitvalues)
|
|
415
|
-
|
|
416
|
-
Object containing the updated form.
|
|
417
|
-
|
|
418
|
-
#### Defined in
|
|
419
|
-
|
|
420
|
-
[index.ts:55](https://github.com/radicalbit/formbit/blob/1136d0a/src/types/index.ts#L55)
|
|
402
|
+
[index.ts:23](https://github.com/radicalbit/formbit/blob/2ca1a8a/src/types/index.ts#L23)
|
|
421
403
|
#### FormState
|
|
422
404
|
|
|
423
|
-
Ƭ **FormState**\<`
|
|
405
|
+
Ƭ **FormState**\<`T`\>: `Object`
|
|
424
406
|
|
|
425
|
-
|
|
407
|
+
The whole internal state of the form (everything except the validation schema).
|
|
426
408
|
|
|
427
409
|
#### Type parameters
|
|
428
410
|
|
|
429
411
|
| Name | Type |
|
|
430
412
|
| :------ | :------ |
|
|
431
|
-
| `
|
|
413
|
+
| `T` | extends [`FormbitValues`](#formbitvalues) |
|
|
432
414
|
|
|
433
415
|
#### Type declaration
|
|
434
416
|
|
|
435
417
|
| Name | Type |
|
|
436
418
|
| :------ | :------ |
|
|
437
419
|
| `errors` | [`Errors`](#errors) |
|
|
438
|
-
| `form` | `
|
|
439
|
-
| `initialValues` | `
|
|
420
|
+
| `form` | `T` |
|
|
421
|
+
| `initialValues` | `T` |
|
|
440
422
|
| `isDirty` | `boolean` |
|
|
441
423
|
| `liveValidation` | [`LiveValidation`](#livevalidation) |
|
|
442
424
|
|
|
443
425
|
#### Defined in
|
|
444
426
|
|
|
445
|
-
[index.ts:
|
|
427
|
+
[index.ts:38](https://github.com/radicalbit/formbit/blob/2ca1a8a/src/types/index.ts#L38)
|
|
446
428
|
#### FormbitValues
|
|
447
429
|
|
|
448
|
-
Ƭ **FormbitValues**: \{ `__metadata?`: `
|
|
449
|
-
|
|
450
|
-
Base type for form values: a record of string keys with an optional `__metadata` field.
|
|
451
|
-
|
|
452
|
-
#### Defined in
|
|
453
|
-
|
|
454
|
-
[index.ts:52](https://github.com/radicalbit/formbit/blob/1136d0a/src/types/index.ts#L52)
|
|
455
|
-
#### InitialValues
|
|
430
|
+
Ƭ **FormbitValues**: `Record`\<`string`, `unknown`\> & \{ `__metadata?`: `Record`\<`string`, `unknown`\> }
|
|
456
431
|
|
|
457
|
-
|
|
432
|
+
Base shape of every form handled by formbit: an open record of values, plus an
|
|
433
|
+
optional `__metadata` field formbit uses to carry data that must survive a
|
|
434
|
+
reset/initialize but must NOT be submitted.
|
|
458
435
|
|
|
459
|
-
|
|
436
|
+
The generic `T` you pass to `useFormbit<T>()` must extend this type.
|
|
460
437
|
|
|
461
438
|
#### Defined in
|
|
462
439
|
|
|
463
|
-
[index.ts:
|
|
440
|
+
[index.ts:13](https://github.com/radicalbit/formbit/blob/2ca1a8a/src/types/index.ts#L13)
|
|
464
441
|
#### LiveValidation
|
|
465
442
|
|
|
466
443
|
Ƭ **LiveValidation**: `Record`\<`string`, ``true``\>
|
|
467
444
|
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
will automatically be set to live-validated.
|
|
471
|
-
|
|
472
|
-
A value/path is live-validated when validated at every change of the form.
|
|
473
|
-
|
|
474
|
-
By default no field is live-validated.
|
|
445
|
+
Fields currently under live-validation (re-validated on every form change).
|
|
446
|
+
A field is added here automatically when it fails a validation. Empty by default.
|
|
475
447
|
|
|
476
448
|
**`Example`**
|
|
477
449
|
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
{
|
|
481
|
-
"age": 1
|
|
482
|
-
}
|
|
483
|
-
```
|
|
484
|
-
and age is a field that is being live-validated, liveValidation object will look like this
|
|
485
|
-
```json
|
|
486
|
-
{
|
|
487
|
-
"age": true
|
|
488
|
-
}
|
|
450
|
+
```ts
|
|
451
|
+
form: { age: 1 }
|
|
452
|
+
liveValidation: { age: true }
|
|
489
453
|
```
|
|
490
454
|
|
|
491
455
|
#### Defined in
|
|
492
456
|
|
|
493
|
-
[index.ts:
|
|
457
|
+
[index.ts:33](https://github.com/radicalbit/formbit/blob/2ca1a8a/src/types/index.ts#L33)
|
|
494
458
|
### Callback Types
|
|
495
459
|
|
|
496
460
|
#### CheckErrorCallback
|
|
497
461
|
|
|
498
|
-
Ƭ **CheckErrorCallback**\<`
|
|
462
|
+
Ƭ **CheckErrorCallback**\<`T`\>: (`json`: [`FormbitValues`](#formbitvalues), `inner`: [`ValidationError`](#validationerror)[], `writer`: [`FormState`](#formstate)\<`T`\>, `setError`: [`SetError`](#seterror)) => `void`
|
|
499
463
|
|
|
500
|
-
Invoked
|
|
464
|
+
Invoked by `check()` when the given json is invalid.
|
|
501
465
|
|
|
502
466
|
#### Type parameters
|
|
503
467
|
|
|
504
468
|
| Name | Type |
|
|
505
469
|
| :------ | :------ |
|
|
506
|
-
| `
|
|
470
|
+
| `T` | extends [`FormbitValues`](#formbitvalues) |
|
|
507
471
|
|
|
508
472
|
#### Type declaration
|
|
509
473
|
|
|
@@ -513,9 +477,9 @@ Invoked in case of errors raised by validation of check method.
|
|
|
513
477
|
|
|
514
478
|
| Name | Type |
|
|
515
479
|
| :------ | :------ |
|
|
516
|
-
| `json` | [`
|
|
480
|
+
| `json` | [`FormbitValues`](#formbitvalues) |
|
|
517
481
|
| `inner` | [`ValidationError`](#validationerror)[] |
|
|
518
|
-
| `writer` | [`FormState`](#formstate)\<`
|
|
482
|
+
| `writer` | [`FormState`](#formstate)\<`T`\> |
|
|
519
483
|
| `setError` | [`SetError`](#seterror) |
|
|
520
484
|
|
|
521
485
|
##### Returns
|
|
@@ -524,18 +488,18 @@ Invoked in case of errors raised by validation of check method.
|
|
|
524
488
|
|
|
525
489
|
#### Defined in
|
|
526
490
|
|
|
527
|
-
[index.ts:
|
|
491
|
+
[index.ts:72](https://github.com/radicalbit/formbit/blob/2ca1a8a/src/types/index.ts#L72)
|
|
528
492
|
#### CheckSuccessCallback
|
|
529
493
|
|
|
530
|
-
Ƭ **CheckSuccessCallback**\<`
|
|
494
|
+
Ƭ **CheckSuccessCallback**\<`T`\>: (`json`: [`FormbitValues`](#formbitvalues), `writer`: [`FormState`](#formstate)\<`T`\>, `setError`: [`SetError`](#seterror)) => `void`
|
|
531
495
|
|
|
532
|
-
|
|
496
|
+
Invoked by `check()` when the given json is valid.
|
|
533
497
|
|
|
534
498
|
#### Type parameters
|
|
535
499
|
|
|
536
500
|
| Name | Type |
|
|
537
501
|
| :------ | :------ |
|
|
538
|
-
| `
|
|
502
|
+
| `T` | extends [`FormbitValues`](#formbitvalues) |
|
|
539
503
|
|
|
540
504
|
#### Type declaration
|
|
541
505
|
|
|
@@ -545,8 +509,8 @@ Success callback invoked by the check method when the operation is successful.
|
|
|
545
509
|
|
|
546
510
|
| Name | Type |
|
|
547
511
|
| :------ | :------ |
|
|
548
|
-
| `json` | [`
|
|
549
|
-
| `writer` | [`FormState`](#formstate)\<`
|
|
512
|
+
| `json` | [`FormbitValues`](#formbitvalues) |
|
|
513
|
+
| `writer` | [`FormState`](#formstate)\<`T`\> |
|
|
550
514
|
| `setError` | [`SetError`](#seterror) |
|
|
551
515
|
|
|
552
516
|
##### Returns
|
|
@@ -555,18 +519,18 @@ Success callback invoked by the check method when the operation is successful.
|
|
|
555
519
|
|
|
556
520
|
#### Defined in
|
|
557
521
|
|
|
558
|
-
[index.ts:
|
|
522
|
+
[index.ts:68](https://github.com/radicalbit/formbit/blob/2ca1a8a/src/types/index.ts#L68)
|
|
559
523
|
#### ErrorCallback
|
|
560
524
|
|
|
561
|
-
Ƭ **ErrorCallback**\<`
|
|
525
|
+
Ƭ **ErrorCallback**\<`T`\>: (`writer`: [`FormState`](#formstate)\<`T`\>, `setError`: [`SetError`](#seterror)) => `void`
|
|
562
526
|
|
|
563
|
-
Invoked
|
|
527
|
+
Invoked by validation methods when validation fails.
|
|
564
528
|
|
|
565
529
|
#### Type parameters
|
|
566
530
|
|
|
567
531
|
| Name | Type |
|
|
568
532
|
| :------ | :------ |
|
|
569
|
-
| `
|
|
533
|
+
| `T` | extends [`FormbitValues`](#formbitvalues) |
|
|
570
534
|
|
|
571
535
|
#### Type declaration
|
|
572
536
|
|
|
@@ -576,7 +540,7 @@ Invoked in case of errors raised by validation.
|
|
|
576
540
|
|
|
577
541
|
| Name | Type |
|
|
578
542
|
| :------ | :------ |
|
|
579
|
-
| `writer` | [`FormState`](#formstate)\<`
|
|
543
|
+
| `writer` | [`FormState`](#formstate)\<`T`\> |
|
|
580
544
|
| `setError` | [`SetError`](#seterror) |
|
|
581
545
|
|
|
582
546
|
##### Returns
|
|
@@ -585,19 +549,19 @@ Invoked in case of errors raised by validation.
|
|
|
585
549
|
|
|
586
550
|
#### Defined in
|
|
587
551
|
|
|
588
|
-
[index.ts:
|
|
552
|
+
[index.ts:64](https://github.com/radicalbit/formbit/blob/2ca1a8a/src/types/index.ts#L64)
|
|
589
553
|
#### SubmitSuccessCallback
|
|
590
554
|
|
|
591
|
-
Ƭ **SubmitSuccessCallback**\<`
|
|
555
|
+
Ƭ **SubmitSuccessCallback**\<`T`\>: (`writer`: [`FormState`](#formstate)\<`Omit`\<`T`, ``"__metadata"``\>\>, `setError`: [`SetError`](#seterror), `clearIsDirty`: () => `void`) => `void`
|
|
592
556
|
|
|
593
|
-
|
|
594
|
-
|
|
557
|
+
Invoked by `submitForm()` once the whole form is valid — the place to send data
|
|
558
|
+
to the backend. `__metadata` is stripped from `writer.form` before this runs.
|
|
595
559
|
|
|
596
560
|
#### Type parameters
|
|
597
561
|
|
|
598
562
|
| Name | Type |
|
|
599
563
|
| :------ | :------ |
|
|
600
|
-
| `
|
|
564
|
+
| `T` | extends [`FormbitValues`](#formbitvalues) |
|
|
601
565
|
|
|
602
566
|
#### Type declaration
|
|
603
567
|
|
|
@@ -607,7 +571,7 @@ Is the right place to send your data to the backend.
|
|
|
607
571
|
|
|
608
572
|
| Name | Type |
|
|
609
573
|
| :------ | :------ |
|
|
610
|
-
| `writer` | [`FormState`](#formstate)\<`
|
|
574
|
+
| `writer` | [`FormState`](#formstate)\<`Omit`\<`T`, ``"__metadata"``\>\> |
|
|
611
575
|
| `setError` | [`SetError`](#seterror) |
|
|
612
576
|
| `clearIsDirty` | () => `void` |
|
|
613
577
|
|
|
@@ -617,18 +581,18 @@ Is the right place to send your data to the backend.
|
|
|
617
581
|
|
|
618
582
|
#### Defined in
|
|
619
583
|
|
|
620
|
-
[index.ts:
|
|
584
|
+
[index.ts:79](https://github.com/radicalbit/formbit/blob/2ca1a8a/src/types/index.ts#L79)
|
|
621
585
|
#### SuccessCallback
|
|
622
586
|
|
|
623
|
-
Ƭ **SuccessCallback**\<`
|
|
587
|
+
Ƭ **SuccessCallback**\<`T`\>: (`writer`: [`FormState`](#formstate)\<`T`\>, `setError`: [`SetError`](#seterror)) => `void`
|
|
624
588
|
|
|
625
|
-
|
|
589
|
+
Invoked by validation methods when the form (or the validated paths) are valid.
|
|
626
590
|
|
|
627
591
|
#### Type parameters
|
|
628
592
|
|
|
629
593
|
| Name | Type |
|
|
630
594
|
| :------ | :------ |
|
|
631
|
-
| `
|
|
595
|
+
| `T` | extends [`FormbitValues`](#formbitvalues) |
|
|
632
596
|
|
|
633
597
|
#### Type declaration
|
|
634
598
|
|
|
@@ -638,7 +602,7 @@ Success callback invoked by some formbit methods when the operation is successfu
|
|
|
638
602
|
|
|
639
603
|
| Name | Type |
|
|
640
604
|
| :------ | :------ |
|
|
641
|
-
| `writer` | [`FormState`](#formstate)\<`
|
|
605
|
+
| `writer` | [`FormState`](#formstate)\<`T`\> |
|
|
642
606
|
| `setError` | [`SetError`](#seterror) |
|
|
643
607
|
|
|
644
608
|
##### Returns
|
|
@@ -647,12 +611,12 @@ Success callback invoked by some formbit methods when the operation is successfu
|
|
|
647
611
|
|
|
648
612
|
#### Defined in
|
|
649
613
|
|
|
650
|
-
[index.ts:
|
|
614
|
+
[index.ts:60](https://github.com/radicalbit/formbit/blob/2ca1a8a/src/types/index.ts#L60)
|
|
651
615
|
### Method Types
|
|
652
616
|
|
|
653
617
|
#### Check
|
|
654
618
|
|
|
655
|
-
Ƭ **Check**\<`
|
|
619
|
+
Ƭ **Check**\<`T`\>: (`json`: [`FormbitValues`](#formbitvalues), `options?`: [`CheckFnOptions`](#checkfnoptions)\<`T`\>) => [`ValidationError`](#validationerror)[] \| `undefined`
|
|
656
620
|
|
|
657
621
|
See [FormbitObject.check](#check).
|
|
658
622
|
|
|
@@ -660,7 +624,7 @@ See [FormbitObject.check](#check).
|
|
|
660
624
|
|
|
661
625
|
| Name | Type |
|
|
662
626
|
| :------ | :------ |
|
|
663
|
-
| `
|
|
627
|
+
| `T` | extends [`FormbitValues`](#formbitvalues) |
|
|
664
628
|
|
|
665
629
|
#### Type declaration
|
|
666
630
|
|
|
@@ -670,8 +634,8 @@ See [FormbitObject.check](#check).
|
|
|
670
634
|
|
|
671
635
|
| Name | Type |
|
|
672
636
|
| :------ | :------ |
|
|
673
|
-
| `json` | [`
|
|
674
|
-
| `options?` | [`CheckFnOptions`](#checkfnoptions)\<`
|
|
637
|
+
| `json` | [`FormbitValues`](#formbitvalues) |
|
|
638
|
+
| `options?` | [`CheckFnOptions`](#checkfnoptions)\<`T`\> |
|
|
675
639
|
|
|
676
640
|
##### Returns
|
|
677
641
|
|
|
@@ -679,10 +643,10 @@ See [FormbitObject.check](#check).
|
|
|
679
643
|
|
|
680
644
|
#### Defined in
|
|
681
645
|
|
|
682
|
-
[index.ts:
|
|
646
|
+
[index.ts:89](https://github.com/radicalbit/formbit/blob/2ca1a8a/src/types/index.ts#L89)
|
|
683
647
|
#### Initialize
|
|
684
648
|
|
|
685
|
-
Ƭ **Initialize**\<`
|
|
649
|
+
Ƭ **Initialize**\<`T`\>: (`values`: `Partial`\<`T`\>) => `void`
|
|
686
650
|
|
|
687
651
|
See [FormbitObject.initialize](#initialize).
|
|
688
652
|
|
|
@@ -690,7 +654,7 @@ See [FormbitObject.initialize](#initialize).
|
|
|
690
654
|
|
|
691
655
|
| Name | Type |
|
|
692
656
|
| :------ | :------ |
|
|
693
|
-
| `
|
|
657
|
+
| `T` | extends [`FormbitValues`](#formbitvalues) |
|
|
694
658
|
|
|
695
659
|
#### Type declaration
|
|
696
660
|
|
|
@@ -700,7 +664,7 @@ See [FormbitObject.initialize](#initialize).
|
|
|
700
664
|
|
|
701
665
|
| Name | Type |
|
|
702
666
|
| :------ | :------ |
|
|
703
|
-
| `values` | `Partial`\<`
|
|
667
|
+
| `values` | `Partial`\<`T`\> |
|
|
704
668
|
|
|
705
669
|
##### Returns
|
|
706
670
|
|
|
@@ -708,10 +672,10 @@ See [FormbitObject.initialize](#initialize).
|
|
|
708
672
|
|
|
709
673
|
#### Defined in
|
|
710
674
|
|
|
711
|
-
[index.ts:
|
|
675
|
+
[index.ts:93](https://github.com/radicalbit/formbit/blob/2ca1a8a/src/types/index.ts#L93)
|
|
712
676
|
#### Remove
|
|
713
677
|
|
|
714
|
-
Ƭ **Remove**\<`
|
|
678
|
+
Ƭ **Remove**\<`T`\>: (`path`: `string`, `options?`: [`WriteFnOptions`](#writefnoptions)\<`T`\>) => `void`
|
|
715
679
|
|
|
716
680
|
See [FormbitObject.remove](#remove).
|
|
717
681
|
|
|
@@ -719,7 +683,7 @@ See [FormbitObject.remove](#remove).
|
|
|
719
683
|
|
|
720
684
|
| Name | Type |
|
|
721
685
|
| :------ | :------ |
|
|
722
|
-
| `
|
|
686
|
+
| `T` | extends [`FormbitValues`](#formbitvalues) |
|
|
723
687
|
|
|
724
688
|
#### Type declaration
|
|
725
689
|
|
|
@@ -730,7 +694,7 @@ See [FormbitObject.remove](#remove).
|
|
|
730
694
|
| Name | Type |
|
|
731
695
|
| :------ | :------ |
|
|
732
696
|
| `path` | `string` |
|
|
733
|
-
| `options?` | [`WriteFnOptions`](#writefnoptions)\<`
|
|
697
|
+
| `options?` | [`WriteFnOptions`](#writefnoptions)\<`T`\> |
|
|
734
698
|
|
|
735
699
|
##### Returns
|
|
736
700
|
|
|
@@ -738,10 +702,10 @@ See [FormbitObject.remove](#remove).
|
|
|
738
702
|
|
|
739
703
|
#### Defined in
|
|
740
704
|
|
|
741
|
-
[index.ts:
|
|
705
|
+
[index.ts:96](https://github.com/radicalbit/formbit/blob/2ca1a8a/src/types/index.ts#L96)
|
|
742
706
|
#### RemoveAll
|
|
743
707
|
|
|
744
|
-
Ƭ **RemoveAll**\<`
|
|
708
|
+
Ƭ **RemoveAll**\<`T`\>: (`arr`: `string`[], `options?`: [`WriteFnOptions`](#writefnoptions)\<`T`\>) => `void`
|
|
745
709
|
|
|
746
710
|
See [FormbitObject.removeAll](#removeall).
|
|
747
711
|
|
|
@@ -749,7 +713,7 @@ See [FormbitObject.removeAll](#removeall).
|
|
|
749
713
|
|
|
750
714
|
| Name | Type |
|
|
751
715
|
| :------ | :------ |
|
|
752
|
-
| `
|
|
716
|
+
| `T` | extends [`FormbitValues`](#formbitvalues) |
|
|
753
717
|
|
|
754
718
|
#### Type declaration
|
|
755
719
|
|
|
@@ -760,7 +724,7 @@ See [FormbitObject.removeAll](#removeall).
|
|
|
760
724
|
| Name | Type |
|
|
761
725
|
| :------ | :------ |
|
|
762
726
|
| `arr` | `string`[] |
|
|
763
|
-
| `options?` | [`WriteFnOptions`](#writefnoptions)\<`
|
|
727
|
+
| `options?` | [`WriteFnOptions`](#writefnoptions)\<`T`\> |
|
|
764
728
|
|
|
765
729
|
##### Returns
|
|
766
730
|
|
|
@@ -768,7 +732,7 @@ See [FormbitObject.removeAll](#removeall).
|
|
|
768
732
|
|
|
769
733
|
#### Defined in
|
|
770
734
|
|
|
771
|
-
[index.ts:
|
|
735
|
+
[index.ts:116](https://github.com/radicalbit/formbit/blob/2ca1a8a/src/types/index.ts#L116)
|
|
772
736
|
#### SetError
|
|
773
737
|
|
|
774
738
|
Ƭ **SetError**: (`path`: `string`, `value`: `string`) => `void`
|
|
@@ -792,10 +756,10 @@ See [FormbitObject.setError](#seterror).
|
|
|
792
756
|
|
|
793
757
|
#### Defined in
|
|
794
758
|
|
|
795
|
-
[index.ts:
|
|
759
|
+
[index.ts:99](https://github.com/radicalbit/formbit/blob/2ca1a8a/src/types/index.ts#L99)
|
|
796
760
|
#### SetSchema
|
|
797
761
|
|
|
798
|
-
Ƭ **SetSchema**\<`
|
|
762
|
+
Ƭ **SetSchema**\<`T`\>: (`newSchema`: [`ValidationSchema`](#validationschema)\<`T`\>) => `void`
|
|
799
763
|
|
|
800
764
|
See [FormbitObject.setSchema](#setschema).
|
|
801
765
|
|
|
@@ -803,7 +767,7 @@ See [FormbitObject.setSchema](#setschema).
|
|
|
803
767
|
|
|
804
768
|
| Name | Type |
|
|
805
769
|
| :------ | :------ |
|
|
806
|
-
| `
|
|
770
|
+
| `T` | extends [`FormbitValues`](#formbitvalues) |
|
|
807
771
|
|
|
808
772
|
#### Type declaration
|
|
809
773
|
|
|
@@ -813,7 +777,7 @@ See [FormbitObject.setSchema](#setschema).
|
|
|
813
777
|
|
|
814
778
|
| Name | Type |
|
|
815
779
|
| :------ | :------ |
|
|
816
|
-
| `newSchema` | [`ValidationSchema`](#validationschema)\<`
|
|
780
|
+
| `newSchema` | [`ValidationSchema`](#validationschema)\<`T`\> |
|
|
817
781
|
|
|
818
782
|
##### Returns
|
|
819
783
|
|
|
@@ -821,10 +785,10 @@ See [FormbitObject.setSchema](#setschema).
|
|
|
821
785
|
|
|
822
786
|
#### Defined in
|
|
823
787
|
|
|
824
|
-
[index.ts:
|
|
788
|
+
[index.ts:102](https://github.com/radicalbit/formbit/blob/2ca1a8a/src/types/index.ts#L102)
|
|
825
789
|
#### SubmitForm
|
|
826
790
|
|
|
827
|
-
Ƭ **SubmitForm**\<`
|
|
791
|
+
Ƭ **SubmitForm**\<`T`\>: (`successCallback`: [`SubmitSuccessCallback`](#submitsuccesscallback)\<`T`\>, `errorCallback?`: [`ErrorCallback`](#errorcallback)\<`Partial`\<`T`\>\>, `options?`: [`ValidateOptions`](#validateoptions)) => `void`
|
|
828
792
|
|
|
829
793
|
See [FormbitObject.submitForm](#submitform).
|
|
830
794
|
|
|
@@ -832,7 +796,7 @@ See [FormbitObject.submitForm](#submitform).
|
|
|
832
796
|
|
|
833
797
|
| Name | Type |
|
|
834
798
|
| :------ | :------ |
|
|
835
|
-
| `
|
|
799
|
+
| `T` | extends [`FormbitValues`](#formbitvalues) |
|
|
836
800
|
|
|
837
801
|
#### Type declaration
|
|
838
802
|
|
|
@@ -842,8 +806,8 @@ See [FormbitObject.submitForm](#submitform).
|
|
|
842
806
|
|
|
843
807
|
| Name | Type |
|
|
844
808
|
| :------ | :------ |
|
|
845
|
-
| `successCallback` | [`SubmitSuccessCallback`](#submitsuccesscallback)\<`
|
|
846
|
-
| `errorCallback?` | [`ErrorCallback`](#errorcallback)\<`Partial`\<`
|
|
809
|
+
| `successCallback` | [`SubmitSuccessCallback`](#submitsuccesscallback)\<`T`\> |
|
|
810
|
+
| `errorCallback?` | [`ErrorCallback`](#errorcallback)\<`Partial`\<`T`\>\> |
|
|
847
811
|
| `options?` | [`ValidateOptions`](#validateoptions) |
|
|
848
812
|
|
|
849
813
|
##### Returns
|
|
@@ -852,10 +816,10 @@ See [FormbitObject.submitForm](#submitform).
|
|
|
852
816
|
|
|
853
817
|
#### Defined in
|
|
854
818
|
|
|
855
|
-
[index.ts:
|
|
819
|
+
[index.ts:132](https://github.com/radicalbit/formbit/blob/2ca1a8a/src/types/index.ts#L132)
|
|
856
820
|
#### Validate
|
|
857
821
|
|
|
858
|
-
Ƭ **Validate**\<`
|
|
822
|
+
Ƭ **Validate**\<`T`\>: (`path`: `string`, `options?`: [`ValidateFnOptions`](#validatefnoptions)\<`T`\>) => `void`
|
|
859
823
|
|
|
860
824
|
See [FormbitObject.validate](#validate).
|
|
861
825
|
|
|
@@ -863,7 +827,7 @@ See [FormbitObject.validate](#validate).
|
|
|
863
827
|
|
|
864
828
|
| Name | Type |
|
|
865
829
|
| :------ | :------ |
|
|
866
|
-
| `
|
|
830
|
+
| `T` | extends [`FormbitValues`](#formbitvalues) |
|
|
867
831
|
|
|
868
832
|
#### Type declaration
|
|
869
833
|
|
|
@@ -874,7 +838,7 @@ See [FormbitObject.validate](#validate).
|
|
|
874
838
|
| Name | Type |
|
|
875
839
|
| :------ | :------ |
|
|
876
840
|
| `path` | `string` |
|
|
877
|
-
| `options?` | [`ValidateFnOptions`](#validatefnoptions)\<`
|
|
841
|
+
| `options?` | [`ValidateFnOptions`](#validatefnoptions)\<`T`\> |
|
|
878
842
|
|
|
879
843
|
##### Returns
|
|
880
844
|
|
|
@@ -882,10 +846,10 @@ See [FormbitObject.validate](#validate).
|
|
|
882
846
|
|
|
883
847
|
#### Defined in
|
|
884
848
|
|
|
885
|
-
[index.ts:
|
|
849
|
+
[index.ts:120](https://github.com/radicalbit/formbit/blob/2ca1a8a/src/types/index.ts#L120)
|
|
886
850
|
#### ValidateAll
|
|
887
851
|
|
|
888
|
-
Ƭ **ValidateAll**\<`
|
|
852
|
+
Ƭ **ValidateAll**\<`T`\>: (`paths`: `string`[], `options?`: [`ValidateFnOptions`](#validatefnoptions)\<`T`\>) => `void`
|
|
889
853
|
|
|
890
854
|
See [FormbitObject.validateAll](#validateall).
|
|
891
855
|
|
|
@@ -893,7 +857,7 @@ See [FormbitObject.validateAll](#validateall).
|
|
|
893
857
|
|
|
894
858
|
| Name | Type |
|
|
895
859
|
| :------ | :------ |
|
|
896
|
-
| `
|
|
860
|
+
| `T` | extends [`FormbitValues`](#formbitvalues) |
|
|
897
861
|
|
|
898
862
|
#### Type declaration
|
|
899
863
|
|
|
@@ -904,7 +868,7 @@ See [FormbitObject.validateAll](#validateall).
|
|
|
904
868
|
| Name | Type |
|
|
905
869
|
| :------ | :------ |
|
|
906
870
|
| `paths` | `string`[] |
|
|
907
|
-
| `options?` | [`ValidateFnOptions`](#validatefnoptions)\<`
|
|
871
|
+
| `options?` | [`ValidateFnOptions`](#validatefnoptions)\<`T`\> |
|
|
908
872
|
|
|
909
873
|
##### Returns
|
|
910
874
|
|
|
@@ -912,10 +876,10 @@ See [FormbitObject.validateAll](#validateall).
|
|
|
912
876
|
|
|
913
877
|
#### Defined in
|
|
914
878
|
|
|
915
|
-
[index.ts:
|
|
879
|
+
[index.ts:123](https://github.com/radicalbit/formbit/blob/2ca1a8a/src/types/index.ts#L123)
|
|
916
880
|
#### ValidateForm
|
|
917
881
|
|
|
918
|
-
Ƭ **ValidateForm**\<`
|
|
882
|
+
Ƭ **ValidateForm**\<`T`\>: (`successCallback?`: [`SuccessCallback`](#successcallback)\<`T`\>, `errorCallback?`: [`ErrorCallback`](#errorcallback)\<`T`\>, `options?`: [`ValidateOptions`](#validateoptions)) => `void`
|
|
919
883
|
|
|
920
884
|
See [FormbitObject.validateForm](#validateform).
|
|
921
885
|
|
|
@@ -923,7 +887,7 @@ See [FormbitObject.validateForm](#validateform).
|
|
|
923
887
|
|
|
924
888
|
| Name | Type |
|
|
925
889
|
| :------ | :------ |
|
|
926
|
-
| `
|
|
890
|
+
| `T` | extends [`FormbitValues`](#formbitvalues) |
|
|
927
891
|
|
|
928
892
|
#### Type declaration
|
|
929
893
|
|
|
@@ -933,8 +897,8 @@ See [FormbitObject.validateForm](#validateform).
|
|
|
933
897
|
|
|
934
898
|
| Name | Type |
|
|
935
899
|
| :------ | :------ |
|
|
936
|
-
| `successCallback?` | [`SuccessCallback`](#successcallback)\<`
|
|
937
|
-
| `errorCallback?` | [`ErrorCallback`](#errorcallback)\<`
|
|
900
|
+
| `successCallback?` | [`SuccessCallback`](#successcallback)\<`T`\> |
|
|
901
|
+
| `errorCallback?` | [`ErrorCallback`](#errorcallback)\<`T`\> |
|
|
938
902
|
| `options?` | [`ValidateOptions`](#validateoptions) |
|
|
939
903
|
|
|
940
904
|
##### Returns
|
|
@@ -943,10 +907,10 @@ See [FormbitObject.validateForm](#validateform).
|
|
|
943
907
|
|
|
944
908
|
#### Defined in
|
|
945
909
|
|
|
946
|
-
[index.ts:
|
|
910
|
+
[index.ts:126](https://github.com/radicalbit/formbit/blob/2ca1a8a/src/types/index.ts#L126)
|
|
947
911
|
#### Write
|
|
948
912
|
|
|
949
|
-
Ƭ **Write**\<`
|
|
913
|
+
Ƭ **Write**\<`T`\>: (`path`: keyof `T` \| `string`, `value`: `unknown`, `options?`: [`WriteFnOptions`](#writefnoptions)\<`T`\>) => `void`
|
|
950
914
|
|
|
951
915
|
See [FormbitObject.write](#write).
|
|
952
916
|
|
|
@@ -954,7 +918,7 @@ See [FormbitObject.write](#write).
|
|
|
954
918
|
|
|
955
919
|
| Name | Type |
|
|
956
920
|
| :------ | :------ |
|
|
957
|
-
| `
|
|
921
|
+
| `T` | extends [`FormbitValues`](#formbitvalues) |
|
|
958
922
|
|
|
959
923
|
#### Type declaration
|
|
960
924
|
|
|
@@ -964,9 +928,9 @@ See [FormbitObject.write](#write).
|
|
|
964
928
|
|
|
965
929
|
| Name | Type |
|
|
966
930
|
| :------ | :------ |
|
|
967
|
-
| `path` | keyof `
|
|
931
|
+
| `path` | keyof `T` \| `string` |
|
|
968
932
|
| `value` | `unknown` |
|
|
969
|
-
| `options?` | [`WriteFnOptions`](#writefnoptions)\<`
|
|
933
|
+
| `options?` | [`WriteFnOptions`](#writefnoptions)\<`T`\> |
|
|
970
934
|
|
|
971
935
|
##### Returns
|
|
972
936
|
|
|
@@ -974,10 +938,10 @@ See [FormbitObject.write](#write).
|
|
|
974
938
|
|
|
975
939
|
#### Defined in
|
|
976
940
|
|
|
977
|
-
[index.ts:
|
|
941
|
+
[index.ts:108](https://github.com/radicalbit/formbit/blob/2ca1a8a/src/types/index.ts#L108)
|
|
978
942
|
#### WriteAll
|
|
979
943
|
|
|
980
|
-
Ƭ **WriteAll**\<`
|
|
944
|
+
Ƭ **WriteAll**\<`T`\>: (`arr`: [`WriteAllValue`](#writeallvalue)\<`T`\>[], `options?`: [`WriteFnOptions`](#writefnoptions)\<`T`\>) => `void`
|
|
981
945
|
|
|
982
946
|
See [FormbitObject.writeAll](#writeall).
|
|
983
947
|
|
|
@@ -985,7 +949,7 @@ See [FormbitObject.writeAll](#writeall).
|
|
|
985
949
|
|
|
986
950
|
| Name | Type |
|
|
987
951
|
| :------ | :------ |
|
|
988
|
-
| `
|
|
952
|
+
| `T` | extends [`FormbitValues`](#formbitvalues) |
|
|
989
953
|
|
|
990
954
|
#### Type declaration
|
|
991
955
|
|
|
@@ -995,8 +959,8 @@ See [FormbitObject.writeAll](#writeall).
|
|
|
995
959
|
|
|
996
960
|
| Name | Type |
|
|
997
961
|
| :------ | :------ |
|
|
998
|
-
| `arr` | [`WriteAllValue`](#writeallvalue)\<`
|
|
999
|
-
| `options?` | [`WriteFnOptions`](#writefnoptions)\<`
|
|
962
|
+
| `arr` | [`WriteAllValue`](#writeallvalue)\<`T`\>[] |
|
|
963
|
+
| `options?` | [`WriteFnOptions`](#writefnoptions)\<`T`\> |
|
|
1000
964
|
|
|
1001
965
|
##### Returns
|
|
1002
966
|
|
|
@@ -1004,334 +968,120 @@ See [FormbitObject.writeAll](#writeall).
|
|
|
1004
968
|
|
|
1005
969
|
#### Defined in
|
|
1006
970
|
|
|
1007
|
-
[index.ts:
|
|
971
|
+
[index.ts:112](https://github.com/radicalbit/formbit/blob/2ca1a8a/src/types/index.ts#L112)
|
|
1008
972
|
### Options Types
|
|
1009
973
|
|
|
1010
974
|
#### CheckFnOptions
|
|
1011
975
|
|
|
1012
|
-
Ƭ **CheckFnOptions**\<`
|
|
976
|
+
Ƭ **CheckFnOptions**\<`T`\>: `Object`
|
|
1013
977
|
|
|
1014
|
-
Options
|
|
978
|
+
Options accepted by `check()`.
|
|
1015
979
|
|
|
1016
980
|
#### Type parameters
|
|
1017
981
|
|
|
1018
982
|
| Name | Type |
|
|
1019
983
|
| :------ | :------ |
|
|
1020
|
-
| `
|
|
984
|
+
| `T` | extends [`FormbitValues`](#formbitvalues) |
|
|
1021
985
|
|
|
1022
986
|
#### Type declaration
|
|
1023
987
|
|
|
1024
988
|
| Name | Type |
|
|
1025
989
|
| :------ | :------ |
|
|
1026
|
-
| `errorCallback?` | [`CheckErrorCallback`](#checkerrorcallback)\<`
|
|
990
|
+
| `errorCallback?` | [`CheckErrorCallback`](#checkerrorcallback)\<`T`\> |
|
|
1027
991
|
| `options?` | [`ValidateOptions`](#validateoptions) |
|
|
1028
|
-
| `successCallback?` | [`CheckSuccessCallback`](#checksuccesscallback)\<`
|
|
992
|
+
| `successCallback?` | [`CheckSuccessCallback`](#checksuccesscallback)\<`T`\> |
|
|
1029
993
|
|
|
1030
994
|
#### Defined in
|
|
1031
995
|
|
|
1032
|
-
[index.ts:
|
|
996
|
+
[index.ts:140](https://github.com/radicalbit/formbit/blob/2ca1a8a/src/types/index.ts#L140)
|
|
1033
997
|
#### ValidateFnOptions
|
|
1034
998
|
|
|
1035
|
-
Ƭ **ValidateFnOptions**\<`
|
|
999
|
+
Ƭ **ValidateFnOptions**\<`T`\>: `Object`
|
|
1036
1000
|
|
|
1037
|
-
Options
|
|
1001
|
+
Options accepted by the `validate` methods.
|
|
1038
1002
|
|
|
1039
1003
|
#### Type parameters
|
|
1040
1004
|
|
|
1041
1005
|
| Name | Type |
|
|
1042
1006
|
| :------ | :------ |
|
|
1043
|
-
| `
|
|
1007
|
+
| `T` | extends [`FormbitValues`](#formbitvalues) |
|
|
1044
1008
|
|
|
1045
1009
|
#### Type declaration
|
|
1046
1010
|
|
|
1047
1011
|
| Name | Type |
|
|
1048
1012
|
| :------ | :------ |
|
|
1049
|
-
| `errorCallback?` | [`ErrorCallback`](#errorcallback)\<`Partial`\<`
|
|
1013
|
+
| `errorCallback?` | [`ErrorCallback`](#errorcallback)\<`Partial`\<`T`\>\> |
|
|
1050
1014
|
| `options?` | [`ValidateOptions`](#validateoptions) |
|
|
1051
|
-
| `successCallback?` | [`SuccessCallback`](#successcallback)\<`Partial`\<`
|
|
1015
|
+
| `successCallback?` | [`SuccessCallback`](#successcallback)\<`Partial`\<`T`\>\> |
|
|
1052
1016
|
|
|
1053
1017
|
#### Defined in
|
|
1054
1018
|
|
|
1055
|
-
[index.ts:
|
|
1019
|
+
[index.ts:147](https://github.com/radicalbit/formbit/blob/2ca1a8a/src/types/index.ts#L147)
|
|
1056
1020
|
#### WriteAllValue
|
|
1057
1021
|
|
|
1058
|
-
Ƭ **WriteAllValue**\<`
|
|
1022
|
+
Ƭ **WriteAllValue**\<`T`\>: [keyof `T` \| `string`, `unknown`]
|
|
1059
1023
|
|
|
1060
|
-
|
|
1024
|
+
A single `[path, value]` pair accepted by `writeAll`.
|
|
1061
1025
|
|
|
1062
1026
|
#### Type parameters
|
|
1063
1027
|
|
|
1064
1028
|
| Name | Type |
|
|
1065
1029
|
| :------ | :------ |
|
|
1066
|
-
| `
|
|
1030
|
+
| `T` | extends [`FormbitValues`](#formbitvalues) |
|
|
1067
1031
|
|
|
1068
1032
|
#### Defined in
|
|
1069
1033
|
|
|
1070
|
-
[index.ts:
|
|
1034
|
+
[index.ts:105](https://github.com/radicalbit/formbit/blob/2ca1a8a/src/types/index.ts#L105)
|
|
1071
1035
|
#### WriteFnOptions
|
|
1072
1036
|
|
|
1073
|
-
Ƭ **WriteFnOptions**\<`
|
|
1037
|
+
Ƭ **WriteFnOptions**\<`T`\>: \{ `noLiveValidation?`: `boolean` ; `pathsToValidate?`: `string`[] } & [`ValidateFnOptions`](#validatefnoptions)\<`T`\>
|
|
1074
1038
|
|
|
1075
|
-
Options
|
|
1039
|
+
Options accepted by the `write`/`remove` methods (validate options plus path control).
|
|
1076
1040
|
|
|
1077
1041
|
#### Type parameters
|
|
1078
1042
|
|
|
1079
1043
|
| Name | Type |
|
|
1080
1044
|
| :------ | :------ |
|
|
1081
|
-
| `
|
|
1045
|
+
| `T` | extends [`FormbitValues`](#formbitvalues) |
|
|
1082
1046
|
|
|
1083
1047
|
#### Defined in
|
|
1084
1048
|
|
|
1085
|
-
[index.ts:
|
|
1049
|
+
[index.ts:154](https://github.com/radicalbit/formbit/blob/2ca1a8a/src/types/index.ts#L154)
|
|
1086
1050
|
### Yup Re-Exports
|
|
1087
1051
|
|
|
1088
1052
|
#### ValidateOptions
|
|
1089
1053
|
|
|
1090
1054
|
Ƭ **ValidateOptions**: `YupValidateOptions`
|
|
1091
1055
|
|
|
1092
|
-
|
|
1093
|
-
It represents the object with all the options that can be passed to the internal yup validation method.
|
|
1094
|
-
|
|
1095
|
-
Link to the Yup documentation [https://github.com/jquense/yup](https://github.com/jquense/yup)
|
|
1056
|
+
Options forwarded to yup's validation methods. See [https://github.com/jquense/yup](https://github.com/jquense/yup).
|
|
1096
1057
|
|
|
1097
1058
|
#### Defined in
|
|
1098
1059
|
|
|
1099
|
-
[index.ts:
|
|
1060
|
+
[index.ts:52](https://github.com/radicalbit/formbit/blob/2ca1a8a/src/types/index.ts#L52)
|
|
1100
1061
|
#### ValidationError
|
|
1101
1062
|
|
|
1102
1063
|
Ƭ **ValidationError**: `YupValidationError`
|
|
1103
1064
|
|
|
1104
|
-
|
|
1105
|
-
It represents the error object returned when a validation fails.
|
|
1106
|
-
|
|
1107
|
-
Link to the Yup documentation [https://github.com/jquense/yup](https://github.com/jquense/yup)
|
|
1065
|
+
The error object yup throws when a validation fails. See [https://github.com/jquense/yup](https://github.com/jquense/yup).
|
|
1108
1066
|
|
|
1109
1067
|
#### Defined in
|
|
1110
1068
|
|
|
1111
|
-
[index.ts:
|
|
1069
|
+
[index.ts:55](https://github.com/radicalbit/formbit/blob/2ca1a8a/src/types/index.ts#L55)
|
|
1112
1070
|
#### ValidationSchema
|
|
1113
1071
|
|
|
1114
|
-
Ƭ **ValidationSchema**\<`
|
|
1115
|
-
|
|
1116
|
-
Type imported from the yup library.
|
|
1117
|
-
It represents any validation schema created with the yup.object() method.
|
|
1118
|
-
|
|
1119
|
-
Link to the Yup documentation [https://github.com/jquense/yup](https://github.com/jquense/yup)
|
|
1120
|
-
|
|
1121
|
-
#### Type parameters
|
|
1122
|
-
|
|
1123
|
-
| Name | Type |
|
|
1124
|
-
| :------ | :------ |
|
|
1125
|
-
| `Values` | extends [`InitialValues`](#initialvalues) |
|
|
1126
|
-
|
|
1127
|
-
#### Defined in
|
|
1128
|
-
|
|
1129
|
-
[index.ts:129](https://github.com/radicalbit/formbit/blob/1136d0a/src/types/index.ts#L129)
|
|
1130
|
-
### Deprecated Types
|
|
1131
|
-
|
|
1132
|
-
<details>
|
|
1133
|
-
<summary>Show deprecated types</summary>
|
|
1134
|
-
|
|
1135
|
-
#### ClearIsDirty
|
|
1136
|
-
|
|
1137
|
-
Ƭ **ClearIsDirty**: () => `void`
|
|
1138
|
-
|
|
1139
|
-
**`Deprecated`**
|
|
1140
|
-
|
|
1141
|
-
Inlined into [FormbitObject](#formbitobject).
|
|
1142
|
-
|
|
1143
|
-
#### Type declaration
|
|
1144
|
-
|
|
1145
|
-
▸ (): `void`
|
|
1146
|
-
|
|
1147
|
-
##### Returns
|
|
1148
|
-
|
|
1149
|
-
`void`
|
|
1150
|
-
|
|
1151
|
-
#### Defined in
|
|
1152
|
-
|
|
1153
|
-
[index.ts:199](https://github.com/radicalbit/formbit/blob/1136d0a/src/types/index.ts#L199)
|
|
1154
|
-
#### ErrorCheckCallback
|
|
1155
|
-
|
|
1156
|
-
Ƭ **ErrorCheckCallback**\<`Values`\>: [`CheckErrorCallback`](#checkerrorcallback)\<`Values`\>
|
|
1157
|
-
|
|
1158
|
-
**`Deprecated`**
|
|
1159
|
-
|
|
1160
|
-
Use [CheckErrorCallback](#checkerrorcallback) instead.
|
|
1161
|
-
|
|
1162
|
-
#### Type parameters
|
|
1163
|
-
|
|
1164
|
-
| Name | Type |
|
|
1165
|
-
| :------ | :------ |
|
|
1166
|
-
| `Values` | extends [`InitialValues`](#initialvalues) |
|
|
1167
|
-
|
|
1168
|
-
#### Defined in
|
|
1169
|
-
|
|
1170
|
-
[index.ts:175](https://github.com/radicalbit/formbit/blob/1136d0a/src/types/index.ts#L175)
|
|
1171
|
-
#### ErrorFn
|
|
1172
|
-
|
|
1173
|
-
Ƭ **ErrorFn**: (`path`: `string`) => `string` \| `undefined`
|
|
1174
|
-
|
|
1175
|
-
**`Deprecated`**
|
|
1176
|
-
|
|
1177
|
-
Inlined into [FormbitObject](#formbitobject).
|
|
1178
|
-
|
|
1179
|
-
#### Type declaration
|
|
1180
|
-
|
|
1181
|
-
▸ (`path`): `string` \| `undefined`
|
|
1182
|
-
|
|
1183
|
-
##### Parameters
|
|
1184
|
-
|
|
1185
|
-
| Name | Type |
|
|
1186
|
-
| :------ | :------ |
|
|
1187
|
-
| `path` | `string` |
|
|
1188
|
-
|
|
1189
|
-
##### Returns
|
|
1190
|
-
|
|
1191
|
-
`string` \| `undefined`
|
|
1192
|
-
|
|
1193
|
-
#### Defined in
|
|
1194
|
-
|
|
1195
|
-
[index.ts:190](https://github.com/radicalbit/formbit/blob/1136d0a/src/types/index.ts#L190)
|
|
1196
|
-
#### IsDirty
|
|
1197
|
-
|
|
1198
|
-
Ƭ **IsDirty**: `boolean`
|
|
1199
|
-
|
|
1200
|
-
**`Deprecated`**
|
|
1201
|
-
|
|
1202
|
-
Inlined into [FormbitObject](#formbitobject).
|
|
1203
|
-
|
|
1204
|
-
#### Defined in
|
|
1205
|
-
|
|
1206
|
-
[index.ts:208](https://github.com/radicalbit/formbit/blob/1136d0a/src/types/index.ts#L208)
|
|
1207
|
-
#### IsFormInvalid
|
|
1208
|
-
|
|
1209
|
-
Ƭ **IsFormInvalid**: () => `boolean`
|
|
1210
|
-
|
|
1211
|
-
**`Deprecated`**
|
|
1212
|
-
|
|
1213
|
-
Inlined into [FormbitObject](#formbitobject).
|
|
1214
|
-
|
|
1215
|
-
#### Type declaration
|
|
1216
|
-
|
|
1217
|
-
▸ (): `boolean`
|
|
1218
|
-
|
|
1219
|
-
##### Returns
|
|
1220
|
-
|
|
1221
|
-
`boolean`
|
|
1222
|
-
|
|
1223
|
-
#### Defined in
|
|
1224
|
-
|
|
1225
|
-
[index.ts:196](https://github.com/radicalbit/formbit/blob/1136d0a/src/types/index.ts#L196)
|
|
1226
|
-
#### IsFormValid
|
|
1227
|
-
|
|
1228
|
-
Ƭ **IsFormValid**: () => `boolean`
|
|
1229
|
-
|
|
1230
|
-
**`Deprecated`**
|
|
1231
|
-
|
|
1232
|
-
Inlined into [FormbitObject](#formbitobject).
|
|
1233
|
-
|
|
1234
|
-
#### Type declaration
|
|
1235
|
-
|
|
1236
|
-
▸ (): `boolean`
|
|
1237
|
-
|
|
1238
|
-
##### Returns
|
|
1239
|
-
|
|
1240
|
-
`boolean`
|
|
1241
|
-
|
|
1242
|
-
#### Defined in
|
|
1243
|
-
|
|
1244
|
-
[index.ts:193](https://github.com/radicalbit/formbit/blob/1136d0a/src/types/index.ts#L193)
|
|
1245
|
-
#### LiveValidationFn
|
|
1246
|
-
|
|
1247
|
-
Ƭ **LiveValidationFn**: (`path`: `string`) => ``true`` \| `undefined`
|
|
1248
|
-
|
|
1249
|
-
**`Deprecated`**
|
|
1250
|
-
|
|
1251
|
-
Inlined into [FormbitObject](#formbitobject).
|
|
1252
|
-
|
|
1253
|
-
#### Type declaration
|
|
1254
|
-
|
|
1255
|
-
▸ (`path`): ``true`` \| `undefined`
|
|
1256
|
-
|
|
1257
|
-
##### Parameters
|
|
1258
|
-
|
|
1259
|
-
| Name | Type |
|
|
1260
|
-
| :------ | :------ |
|
|
1261
|
-
| `path` | `string` |
|
|
1262
|
-
|
|
1263
|
-
##### Returns
|
|
1264
|
-
|
|
1265
|
-
``true`` \| `undefined`
|
|
1266
|
-
|
|
1267
|
-
#### Defined in
|
|
1268
|
-
|
|
1269
|
-
[index.ts:205](https://github.com/radicalbit/formbit/blob/1136d0a/src/types/index.ts#L205)
|
|
1270
|
-
#### Object
|
|
1271
|
-
|
|
1272
|
-
Ƭ **Object**: `FormbitRecord`
|
|
1273
|
-
|
|
1274
|
-
**`Deprecated`**
|
|
1275
|
-
|
|
1276
|
-
Use FormbitRecord instead. Renamed to avoid shadowing the global `Object`.
|
|
1277
|
-
|
|
1278
|
-
#### Defined in
|
|
1279
|
-
|
|
1280
|
-
[index.ts:19](https://github.com/radicalbit/formbit/blob/1136d0a/src/types/index.ts#L19)
|
|
1281
|
-
#### ResetForm
|
|
1282
|
-
|
|
1283
|
-
Ƭ **ResetForm**: () => `void`
|
|
1284
|
-
|
|
1285
|
-
**`Deprecated`**
|
|
1286
|
-
|
|
1287
|
-
Inlined into [FormbitObject](#formbitobject).
|
|
1288
|
-
|
|
1289
|
-
#### Type declaration
|
|
1290
|
-
|
|
1291
|
-
▸ (): `void`
|
|
1292
|
-
|
|
1293
|
-
##### Returns
|
|
1294
|
-
|
|
1295
|
-
`void`
|
|
1296
|
-
|
|
1297
|
-
#### Defined in
|
|
1298
|
-
|
|
1299
|
-
[index.ts:202](https://github.com/radicalbit/formbit/blob/1136d0a/src/types/index.ts#L202)
|
|
1300
|
-
#### SuccessCheckCallback
|
|
1301
|
-
|
|
1302
|
-
Ƭ **SuccessCheckCallback**\<`Values`\>: [`CheckSuccessCallback`](#checksuccesscallback)\<`Values`\>
|
|
1303
|
-
|
|
1304
|
-
**`Deprecated`**
|
|
1305
|
-
|
|
1306
|
-
Use [CheckSuccessCallback](#checksuccesscallback) instead.
|
|
1307
|
-
|
|
1308
|
-
#### Type parameters
|
|
1309
|
-
|
|
1310
|
-
| Name | Type |
|
|
1311
|
-
| :------ | :------ |
|
|
1312
|
-
| `Values` | extends [`InitialValues`](#initialvalues) |
|
|
1313
|
-
|
|
1314
|
-
#### Defined in
|
|
1315
|
-
|
|
1316
|
-
[index.ts:166](https://github.com/radicalbit/formbit/blob/1136d0a/src/types/index.ts#L166)
|
|
1317
|
-
#### Writer
|
|
1318
|
-
|
|
1319
|
-
Ƭ **Writer**\<`Values`\>: [`FormState`](#formstate)\<`Values`\>
|
|
1320
|
-
|
|
1321
|
-
**`Deprecated`**
|
|
1072
|
+
Ƭ **ValidationSchema**\<`T`\>: `ObjectSchema`\<`T`\>
|
|
1322
1073
|
|
|
1323
|
-
|
|
1074
|
+
A validation schema built with `yup.object()`. See [https://github.com/jquense/yup](https://github.com/jquense/yup).
|
|
1324
1075
|
|
|
1325
1076
|
#### Type parameters
|
|
1326
1077
|
|
|
1327
1078
|
| Name | Type |
|
|
1328
1079
|
| :------ | :------ |
|
|
1329
|
-
| `
|
|
1080
|
+
| `T` | extends [`FormbitValues`](#formbitvalues) |
|
|
1330
1081
|
|
|
1331
1082
|
#### Defined in
|
|
1332
1083
|
|
|
1333
|
-
[index.ts:
|
|
1334
|
-
</details>
|
|
1084
|
+
[index.ts:49](https://github.com/radicalbit/formbit/blob/2ca1a8a/src/types/index.ts#L49)
|
|
1335
1085
|
<!-- END_TYPES_DOC -->
|
|
1336
1086
|
|
|
1337
1087
|
## License
|