diff --git a/README.md b/README.md index 8dbba2b..dbf5760 100644 --- a/README.md +++ b/README.md @@ -9,51 +9,21 @@ Formbit is a **lightweight React state form library** designed to simplify form - [Features](#features) -- [Abstract](#abstract) - [Install](#install) -- [Getting started](#getting-started) +- [Getting Started](#getting-started) +- [Usage Patterns](#usage-patterns) + - [Context Provider](#context-provider) + - [Edit / Initialize Pattern](#edit--initialize-pattern) + - [Multi-Step Form](#multi-step-form) - [Local Development](#local-development) -- [Type Aliases](#type-aliases) - - [Check](#check) - - [CheckFnOptions](#checkfnoptions) - - [ClearIsDirty](#clearisdirty) - - [ErrorCallback](#errorcallback) - - [ErrorCheckCallback](#errorcheckcallback) - - [ErrorFn](#errorfn) - - [Errors](#errors) - - [Form](#form) +- [API Reference](#api-reference) - [FormbitObject](#formbitobject) - - [GenericCallback](#genericcallback) - - [InitialValues](#initialvalues) - - [Initialize](#initialize) - - [IsDirty](#isdirty) - - [IsFormInvalid](#isforminvalid) - - [IsFormValid](#isformvalid) - - [LiveValidation](#livevalidation) - - [LiveValidationFn](#livevalidationfn) - - [Object](#object) - - [Remove](#remove) - - [RemoveAll](#removeall) - - [ResetForm](#resetform) - - [SetError](#seterror) - - [SetSchema](#setschema) - - [SubmitForm](#submitform) - - [SuccessCallback](#successcallback) - - [SuccessCheckCallback](#successcheckcallback) - - [SuccessSubmitCallback](#successsubmitcallback) - - [Validate](#validate) - - [ValidateAll](#validateall) - - [ValidateFnOptions](#validatefnoptions) - - [ValidateForm](#validateform) - - [ValidateOptions](#validateoptions) - - [ValidationError](#validationerror) - - [ValidationFormbitError](#validationformbiterror) - - [ValidationSchema](#validationschema) - - [Write](#write) - - [WriteAll](#writeall) - - [WriteAllValue](#writeallvalue) - - [WriteFnOptions](#writefnoptions) - - [Writer](#writer) + - [Core Types](#core-types) + - [Callback Types](#callback-types) + - [Method Types](#method-types) + - [Options Types](#options-types) + - [Yup Re-Exports](#yup-re-exports) + - [Deprecated Types](#deprecated-types) - [License](#license) @@ -64,13 +34,10 @@ Formbit is a **lightweight React state form library** designed to simplify form - Intuitive and easy-to-use form state management. - Out of the box support for validation with [yup](https://github.com/jquense/yup). -- Support for handling complex forms with dynamic and nested fields. -- Seamless and flexible integration with React. -- Full Typescript support. - -## Abstract - -The concept behind Formbit is to offer a lightweight library that assists you in managing all aspects of form state and error handling, while allowing you the flexibility to choose how to design the UI. It seamlessly integrates with various UI frameworks such as Antd, MaterialUI, or even plain HTML, as it provides solely a React hook that exposes methods to manage the form's React state. The responsibility of designing the UI remains entirely yours. +- Full **TypeScript generics** — `useFormbit(...)` infers paths, values, and callbacks. +- Support for handling complex forms with dynamic and nested fields via **dot-path notation**. +- **Context Provider** for sharing form state across deeply nested component trees. +- Seamless and flexible integration with React — works with Antd, MaterialUI, or plain HTML. ## Install @@ -82,65 +49,68 @@ npm install --save formbit yarn add formbit ``` -## Getting started +## Getting Started + +Three steps: **define a schema**, **call the hook**, **bind the UI**. -```jsx +```tsx import * as yup from 'yup'; -import useFormbit from 'formbit'; +import useFormbit from '@radicalbit/formbit'; -const initialValues = { name: undefined, age: undefined }; +// 1. Define a Yup schema and infer the TypeScript type from it +const schema = yup.object({ + name: yup.string().max(25, 'Max 25 characters').required('Name is required'), + age: yup.number().max(120, 'Must be 0–120').required('Age is required'), +}); -const schema = yup.object().shape({ - name: yup - .string() - .max(25, 'Name max length is 25 characters') - .required('Name is required'), +type FormData = yup.InferType; - age: yup - .number() - .max(120, 'Age must be between 0 and 120') - .required('Age is required') -}); +const initialValues: Partial = { name: undefined, age: undefined }; +// 2. Call the hook with generics so every callback is fully typed function Example() { - const { form, submitForm, write, error, isFormInvalid } = useFormbit({ + const { form, submitForm, write, error, isDirty } = useFormbit({ initialValues, - yup: schema + yup: schema, }); - const handleChangeName = ({ target: { value } }) => { write('name', value); } - const handleChangeAge = ({ target: { value } }) => { write('age', value); } + const handleChangeName = ({ target: { value } }: React.ChangeEvent) => { + write('name', value); + }; + + const handleChangeAge = ({ target: { value } }: React.ChangeEvent) => { + write('age', Number(value)); + }; + const handleSubmit = () => { submitForm( - (writer) => { - console.log("Your validated form is: ", writer.form) - }, - (writer) => { - console.error("The validation errors are: ", writer.errors) - }); - } + ({ form }) => console.log('Validated form:', form), + ({ errors }) => console.error('Validation errors:', errors), + ); + }; + // 3. Bind inputs, errors, and submit — Formbit stays out of your UI return (
- +
{error('name')}
- +
{error('age')}
-
@@ -150,97 +120,233 @@ function Example() { export default Example; ``` -## Local Development -For local development we suggest using [Yalc](https://github.com/wclr/yalc) to test your local version of formbit in your projects. +## Usage Patterns - -## Type Aliases +### Context Provider -### Check +Use `FormbitContextProvider` when you need to share form state across deeply nested components without prop drilling. -Ƭ **Check**\<`Values`\>: (`json`: [`Form`](#form), `options?`: [`CheckFnOptions`](#checkfnoptions)\<`Values`\>) => [`ValidationError`](#validationerror)[] \| `undefined` +```tsx +import { FormbitContextProvider, useFormbitContext } from '@radicalbit/formbit'; +import * as yup from 'yup'; -Checks the given json against the form schema and returns and array of errors. -It returns undefined if the json is valid. +const schema = yup.object({ + name: yup.string().required('Name is required'), + surname: yup.string().required('Surname is required'), + age: yup.number().required('Age is required'), +}); -#### Type parameters +type FormData = yup.InferType; -| Name | Type | -| :------ | :------ | -| `Values` | extends [`InitialValues`](#initialvalues) | +const initialValues: Partial = { name: undefined, surname: undefined, age: undefined }; -#### Type declaration +// Wrap your form tree with the provider +function App() { + return ( + + initialValues={initialValues} + yup={schema} + > + + + + ); +} -▸ (`json`, `options?`): [`ValidationError`](#validationerror)[] \| `undefined` +// Any child can access form state without props +function NameField() { + const { form, write, error } = useFormbitContext(); -##### Parameters + const handleChangeName = ({ target: { value } }: React.ChangeEvent) => { + write('name', value); + }; -| Name | Type | -| :------ | :------ | -| `json` | [`Form`](#form) | -| `options?` | [`CheckFnOptions`](#checkfnoptions)\<`Values`\> | + return ( +
+ + {error('name')} +
+ ); +} -##### Returns +function SubmitButton() { + const { submitForm, isDirty } = useFormbitContext(); -[`ValidationError`](#validationerror)[] \| `undefined` + return ( + + ); +} +``` -#### Defined in +### Edit / Initialize Pattern -[index.ts:14](https://github.com/radicalbit/formbit/blob/a28ef40/src/types/index.ts#L14) +Start with empty initial values and call `initialize()` once data arrives from an API. -___ +```tsx +import { useEffect, useState } from 'react'; +import useFormbit from '@radicalbit/formbit'; +import * as yup from 'yup'; -### CheckFnOptions +const schema = yup.object({ + name: yup.string().required(), + email: yup.string().email().required(), +}); -Ƭ **CheckFnOptions**\<`Values`\>: `Object` +type FormData = yup.InferType; -Options object to change the behavior of the check method +const initialValues: Partial = { name: undefined, email: undefined }; -#### Type parameters +function EditUserForm({ userId }: { userId: string }) { + const { form, write, error, initialize, submitForm } = useFormbit({ + initialValues, + yup: schema, + }); -| Name | Type | -| :------ | :------ | -| `Values` | extends [`InitialValues`](#initialvalues) | + const [loading, setLoading] = useState(true); -#### Type declaration + // Fetch and initialize — resetForm() will revert to these values + useEffect(() => { + fetch(`/api/users/${userId}`) + .then((res) => res.json()) + .then((user) => { initialize(user); setLoading(false); }); + }, [userId]); -| Name | Type | -| :------ | :------ | -| `errorCallback?` | [`ErrorCheckCallback`](#errorcheckcallback)\<`Values`\> | -| `options?` | [`ValidateOptions`](#validateoptions) | -| `successCallback?` | [`SuccessCheckCallback`](#successcheckcallback)\<`Values`\> | + const handleChangeName = ({ target: { value } }: React.ChangeEvent) => { + write('name', value); + }; -#### Defined in + const handleChangeEmail = ({ target: { value } }: React.ChangeEvent) => { + write('email', value); + }; -[index.ts:309](https://github.com/radicalbit/formbit/blob/a28ef40/src/types/index.ts#L309) + const handleSubmit = (e: React.FormEvent) => { + e.preventDefault(); + submitForm(({ form }) => console.log(form)); + }; -___ + if (loading) return

Loading...

; -### ClearIsDirty + return ( +
+ +
{error('name')}
-Ƭ **ClearIsDirty**: () => `void` + +
{error('email')}
-Reset isDirty value to false + +
+ ); +} +``` -#### Type declaration +### Multi-Step Form -▸ (): `void` +Use `__metadata` to store step state and `validateAll` to gate navigation between steps. -##### Returns +```tsx +import useFormbit from '@radicalbit/formbit'; +import * as yup from 'yup'; -`void` +const schema = yup.object({ + name: yup.string().required('Name is required'), + age: yup.number().required('Age is required'), + email: yup.string().email().required('Email is required'), +}); -#### Defined in +type FormData = yup.InferType; + +const initialValues: Partial & { __metadata: { step: number } } = { + name: undefined, + age: undefined, + email: undefined, + __metadata: { step: 0 }, +}; + +function MultiStepForm() { + const { form, write, error, validateAll, submitForm } = useFormbit({ + initialValues, + yup: schema, + }); + + const step = (form.__metadata?.step as number) ?? 0; + const goTo = (n: number) => write('__metadata.step', n); + + // Validate only the current step's fields before advancing + const next = (paths: string[]) => { + validateAll(paths, { + successCallback: () => goTo(step + 1), + }); + }; + + const handleChangeName = ({ target: { value } }: React.ChangeEvent) => { + write('name', value); + }; + + const handleChangeAge = ({ target: { value } }: React.ChangeEvent) => { + write('age', Number(value)); + }; + + const handleChangeEmail = ({ target: { value } }: React.ChangeEvent) => { + write('email', value); + }; + + const handleSubmit = () => { + submitForm(({ form }) => console.log('Submit:', form)); + }; + + return ( +
+ {step === 0 && ( +
+ +
{error('name')}
+ +
+ )} + + {step === 1 && ( +
+ +
{error('age')}
+ + +
+ )} + + {step === 2 && ( +
+ +
{error('email')}
+ + +
+ )} +
+ ); +} +``` -[index.ts:20](https://github.com/radicalbit/formbit/blob/a28ef40/src/types/index.ts#L20) +## Local Development +For local development we suggest using [Yalc](https://github.com/wclr/yalc) to test your local version of formbit in your projects. -___ + +## API Reference -### ErrorCallback +### FormbitObject -Ƭ **ErrorCallback**\<`Values`\>: (`writer`: [`Writer`](#writer)\<`Values`\>, `setError`: [`SetError`](#seterror)) => `void` +Ƭ **FormbitObject**\<`Values`\>: `Object` -Invoked in case of errors raised by validation +Object returned by useFormbit() and useFormbitContextHook(). +It contains all the data and methods needed to handle the form. #### Type parameters @@ -250,30 +356,73 @@ Invoked in case of errors raised by validation #### Type declaration -▸ (`writer`, `setError`): `void` +| Name | Type | Description | +| :------ | :------ | :------ | +| `check` | [`Check`](#check)\<`Partial`\<`Values`\>\> | Checks the given json against the form schema and returns an array of errors. It returns undefined if the json is valid. | +| `error` | (`path`: `string`) => `string` \| `undefined` | - | +| `errors` | [`Errors`](#errors) | Object including all the registered error messages since the last validation. Errors are stored using the same path of the corresponding form values. **`Example`** If the form object has this structure: ```json { "age": 1 } ``` and age is a non valid field, errors object will look like this ```json { "age": "Age must be greater then 18" } ``` | +| `form` | `Partial`\<`Values`\> | Object containing the updated form. | +| `initialize` | [`Initialize`](#initialize)\<`Values`\> | Initialize the form with new initial values. | +| `isDirty` | `boolean` | Returns true if the form is Dirty (user already interacted with the form), false otherwise. | +| `isFormInvalid` | () => `boolean` | - | +| `isFormValid` | () => `boolean` | - | +| `liveValidation` | (`path`: `string`) => ``true`` \| `undefined` | - | +| `remove` | [`Remove`](#remove)\<`Values`\> | This method updates the form state deleting value, setting isDirty to true. After writing, it validates all the paths contained into pathsToValidate (if any) and all the fields that have the live validation active. | +| `removeAll` | [`RemoveAll`](#removeall)\<`Values`\> | This method updates the form state deleting multiple values, setting isDirty to true. | +| `resetForm` | () => `void` | - | +| `setError` | [`SetError`](#seterror) | Set a message (value) to the given error path. | +| `setSchema` | [`SetSchema`](#setschema)\<`Values`\> | Override the current schema with the given one. | +| `submitForm` | [`SubmitForm`](#submitform)\<`Values`\> | Perform a validation against the current form object, and execute the successCallback if the validation passes, otherwise it executes the errorCallback. | +| `validate` | [`Validate`](#validate)\<`Values`\> | This method only validates the specified path. Does not check for fields that have the live validation active. | +| `validateAll` | [`ValidateAll`](#validateall)\<`Values`\> | This method only validates the specified paths. Does not check for fields that have the live validation active. | +| `validateForm` | [`ValidateForm`](#validateform)\<`Partial`\<`Values`\>\> | This method validates the entire form and sets the corresponding errors if any. | +| `write` | [`Write`](#write)\<`Values`\> | This method updates the form state writing $value into the $path, setting isDirty to true. After writing, it validates all the paths contained into $pathsToValidate (if any) and all the fields that have the live validation active. | +| `writeAll` | [`WriteAll`](#writeall)\<`Values`\> | This method takes an array of [path, value] and updates the form state writing all those values into the specified paths. It sets isDirty to true. After writing, it validates all the paths contained into $pathToValidate and all the fields that have the live validation active. | -##### Parameters +#### Defined in -| Name | Type | -| :------ | :------ | -| `writer` | [`Writer`](#writer)\<`Values`\> | -| `setError` | [`SetError`](#seterror) | +[index.ts:300](https://github.com/radicalbit/formbit/blob/35e7e34/src/types/index.ts#L300) +### Core Types -##### Returns +#### Errors -`void` +Ƭ **Errors**: `Record`\<`string`, `string`\> + +Object including all the registered error messages since the last validation. +Errors are stored using the same path of the corresponding form values. + +**`Example`** + +If the form object has this structure: +```json +{ + "age": 1 +} +``` +and age is a non valid field, errors object will look like this +```json +{ + "age": "Age must be greater then 18" +} +``` #### Defined in -[index.ts:25](https://github.com/radicalbit/formbit/blob/a28ef40/src/types/index.ts#L25) +[index.ts:78](https://github.com/radicalbit/formbit/blob/35e7e34/src/types/index.ts#L78) +#### Form -___ +Ƭ **Form**: [`FormbitValues`](#formbitvalues) -### ErrorCheckCallback +Object containing the updated form. + +#### Defined in -Ƭ **ErrorCheckCallback**\<`Values`\>: (`json`: [`Form`](#form), `inner`: [`ValidationError`](#validationerror)[], `writer`: [`Writer`](#writer)\<`Values`\>, `setError`: [`SetError`](#seterror)) => `void` +[index.ts:55](https://github.com/radicalbit/formbit/blob/35e7e34/src/types/index.ts#L55) +#### FormState -Invoked in case of errors raised by validation of check method +Ƭ **FormState**\<`Values`\>: `Object` + +Internal form state storing all the data of the form (except the validation schema). #### Type parameters @@ -283,60 +432,46 @@ Invoked in case of errors raised by validation of check method #### Type declaration -▸ (`json`, `inner`, `writer`, `setError`): `void` - -##### Parameters - | Name | Type | | :------ | :------ | -| `json` | [`Form`](#form) | -| `inner` | [`ValidationError`](#validationerror)[] | -| `writer` | [`Writer`](#writer)\<`Values`\> | -| `setError` | [`SetError`](#seterror) | - -##### Returns - -`void` +| `errors` | [`Errors`](#errors) | +| `form` | `Values` | +| `initialValues` | `Values` | +| `isDirty` | `boolean` | +| `liveValidation` | [`LiveValidation`](#livevalidation) | #### Defined in -[index.ts:31](https://github.com/radicalbit/formbit/blob/a28ef40/src/types/index.ts#L31) - -___ - -### ErrorFn +[index.ts:110](https://github.com/radicalbit/formbit/blob/35e7e34/src/types/index.ts#L110) +#### FormbitValues -Ƭ **ErrorFn**: (`path`: `string`) => `string` \| `undefined` - -Returns the error message for the given path if any. -It doesn't trigger any validation - -#### Type declaration +Ƭ **FormbitValues**: \{ `__metadata?`: `FormbitRecord` } & `FormbitRecord` -▸ (`path`): `string` \| `undefined` +Base type for form values: a record of string keys with an optional `__metadata` field. -##### Parameters +#### Defined in -| Name | Type | -| :------ | :------ | -| `path` | `string` | +[index.ts:52](https://github.com/radicalbit/formbit/blob/35e7e34/src/types/index.ts#L52) +#### InitialValues -##### Returns +Ƭ **InitialValues**: [`FormbitValues`](#formbitvalues) -`string` \| `undefined` +InitialValues used to set up formbit; also used to reset the form to its original version. #### Defined in -[index.ts:39](https://github.com/radicalbit/formbit/blob/a28ef40/src/types/index.ts#L39) +[index.ts:58](https://github.com/radicalbit/formbit/blob/35e7e34/src/types/index.ts#L58) +#### LiveValidation -___ +Ƭ **LiveValidation**: `Record`\<`string`, ``true``\> -### Errors +Object including all the values that are being live validated. +Usually fields that fail validation (using one of the methods that triggers validation) +will automatically be set to live-validated. -Ƭ **Errors**: `Record`\<`string`, `string`\> +A value/path is live-validated when validated at every change of the form. -Object including all the registered errors messages since the last validation. -Errors are stored using the same path of the corresponding form values. +By default no field is live-validated. **`Example`** @@ -346,78 +481,55 @@ If the form object has this structure: "age": 1 } ``` -and age is a non valid field, errors object will look like this +and age is a field that is being live-validated, liveValidation object will look like this ```json { - "age": "Age must be greater then 18" + "age": true } ``` #### Defined in -[index.ts:60](https://github.com/radicalbit/formbit/blob/a28ef40/src/types/index.ts#L60) - -___ - -### Form +[index.ts:103](https://github.com/radicalbit/formbit/blob/35e7e34/src/types/index.ts#L103) +### Callback Types -Ƭ **Form**: \{ `__metadata?`: [`Object`](#object) } & [`Object`](#object) +#### CheckErrorCallback -Object containing the updated form +Ƭ **CheckErrorCallback**\<`Values`\>: (`json`: [`Form`](#form), `inner`: [`ValidationError`](#validationerror)[], `writer`: [`FormState`](#formstate)\<`Values`\>, `setError`: [`SetError`](#seterror)) => `void` -#### Defined in - -[index.ts:65](https://github.com/radicalbit/formbit/blob/a28ef40/src/types/index.ts#L65) +Invoked in case of errors raised by validation of check method. -___ +#### Type parameters -### FormbitObject +| Name | Type | +| :------ | :------ | +| `Values` | extends [`InitialValues`](#initialvalues) | -Ƭ **FormbitObject**\<`Values`\>: `Object` +#### Type declaration -Object returned by useFormbit() and useFormbitContextHook() -It contains all the data and methods needed to handle the form. +▸ (`json`, `inner`, `writer`, `setError`): `void` -#### Type parameters +##### Parameters | Name | Type | | :------ | :------ | -| `Values` | extends [`InitialValues`](#initialvalues) | +| `json` | [`Form`](#form) | +| `inner` | [`ValidationError`](#validationerror)[] | +| `writer` | [`FormState`](#formstate)\<`Values`\> | +| `setError` | [`SetError`](#seterror) | -#### Type declaration +##### Returns -| Name | Type | Description | -| :------ | :------ | :------ | -| `check` | [`Check`](#check)\<`Partial`\<`Values`\>\> | Checks the given json against the form schema and returns and array of errors. It returns undefined if the json is valid. | -| `error` | [`ErrorFn`](#errorfn) | Returns the error message for the given path if any. It doesn't trigger any validation | -| `errors` | [`Errors`](#errors) | Object including all the registered errors messages since the last validation. Errors are stored using the same path of the corresponding form values. **`Example`** If the form object has this structure: ```json { "age": 1 } ``` and age is a non valid field, errors object will look like this ```json { "age": "Age must be greater then 18" } ``` | -| `form` | `Partial`\<`Values`\> | Object containing the updated form | -| `initialize` | [`Initialize`](#initialize)\<`Values`\> | Initialize the form with new initial values | -| `isDirty` | `boolean` | Returns true if the form is Dirty (user already interacted with the form), false otherwise. | -| `isFormInvalid` | [`IsFormInvalid`](#isforminvalid) | Returns true if the form is NOT valid It doesn't perform any validation, it checks if any errors are present | -| `isFormValid` | [`IsFormValid`](#isformvalid) | Returns true id the form is valid It doesn't perform any validation, it checks if any errors are present | -| `liveValidation` | [`LiveValidationFn`](#livevalidationfn) | Returns true if live validation is active for the given path | -| `remove` | [`Remove`](#remove)\<`Values`\> | This method updates the form state deleting value, setting isDirty to true. After writing, it validates all the paths contained into pathsToValidate (if any) and all the fields that have the live validation active. | -| `removeAll` | [`RemoveAll`](#removeall)\<`Values`\> | This method updates the form state deleting multiple values, setting isDirty to true. | -| `resetForm` | [`ResetForm`](#resetform) | Reset form to the initial state. Errors and liveValidation are set back to empty objects. isDirty is set back to false | -| `setError` | [`SetError`](#seterror) | Set a message(value) to the given error path. | -| `setSchema` | [`SetSchema`](#setschema)\<`Values`\> | Override the current schema with the given one. | -| `submitForm` | [`SubmitForm`](#submitform)\<`Values`\> | Perform a validation against the current form object, and execute the successCallback if the validation pass otherwise it executes the errorCallback | -| `validate` | [`Validate`](#validate)\<`Values`\> | This method only validate the specified path. Do not check for fields that have the live validation active. | -| `validateAll` | [`ValidateAll`](#validateall)\<`Values`\> | This method only validate the specified paths. Do not check for fields that have the live validation active. | -| `validateForm` | [`ValidateForm`](#validateform)\<`Partial`\<`Values`\>\> | This method validates the entire form and set the corresponding errors if any. | -| `write` | [`Write`](#write)\<`Values`\> | This method update the form state writing $value into the $path, setting isDirty to true. After writing, it validates all the paths contained into $pathsToValidate (if any) and all the fields that have the live validation active. | -| `writeAll` | [`WriteAll`](#writeall)\<`Values`\> | This method takes an array of [path, value] and update the form state writing all those values into the specified paths. It set isDirty to true. After writing, it validate all the paths contained into $pathToValidate and all the fields that have the live validation active. | +`void` #### Defined in -[index.ts:348](https://github.com/radicalbit/formbit/blob/a28ef40/src/types/index.ts#L348) - -___ +[index.ts:171](https://github.com/radicalbit/formbit/blob/35e7e34/src/types/index.ts#L171) +#### CheckSuccessCallback -### GenericCallback +Ƭ **CheckSuccessCallback**\<`Values`\>: (`json`: [`Form`](#form), `writer`: [`FormState`](#formstate)\<`Values`\>, `setError`: [`SetError`](#seterror)) => `void` -Ƭ **GenericCallback**\<`Values`\>: [`SuccessCallback`](#successcallback)\<`Values`\> \| [`ErrorCallback`](#errorcallback)\<`Values`\> +Success callback invoked by the check method when the operation is successful. #### Type parameters @@ -425,29 +537,30 @@ ___ | :------ | :------ | | `Values` | extends [`InitialValues`](#initialvalues) | -#### Defined in +#### Type declaration -[index.ts:67](https://github.com/radicalbit/formbit/blob/a28ef40/src/types/index.ts#L67) +▸ (`json`, `writer`, `setError`): `void` -___ +##### Parameters -### InitialValues +| Name | Type | +| :------ | :------ | +| `json` | [`Form`](#form) | +| `writer` | [`FormState`](#formstate)\<`Values`\> | +| `setError` | [`SetError`](#seterror) | -Ƭ **InitialValues**: \{ `__metadata?`: [`Object`](#object) } & [`Object`](#object) +##### Returns -InitialValues used to setup formbit, used also to reset the form to the original version. +`void` #### Defined in -[index.ts:77](https://github.com/radicalbit/formbit/blob/a28ef40/src/types/index.ts#L77) - -___ +[index.ts:162](https://github.com/radicalbit/formbit/blob/35e7e34/src/types/index.ts#L162) +#### ErrorCallback -### Initialize - -Ƭ **Initialize**\<`Values`\>: (`values`: `Partial`\<`Values`\>) => `void` +Ƭ **ErrorCallback**\<`Values`\>: (`writer`: [`FormState`](#formstate)\<`Values`\>, `setError`: [`SetError`](#seterror)) => `void` -Initialize the form with new initial values +Invoked in case of errors raised by validation. #### Type parameters @@ -457,13 +570,14 @@ Initialize the form with new initial values #### Type declaration -▸ (`values`): `void` +▸ (`writer`, `setError`): `void` ##### Parameters | Name | Type | | :------ | :------ | -| `values` | `Partial`\<`Values`\> | +| `writer` | [`FormState`](#formstate)\<`Values`\> | +| `setError` | [`SetError`](#seterror) | ##### Returns @@ -471,143 +585,135 @@ Initialize the form with new initial values #### Defined in -[index.ts:71](https://github.com/radicalbit/formbit/blob/a28ef40/src/types/index.ts#L71) +[index.ts:157](https://github.com/radicalbit/formbit/blob/35e7e34/src/types/index.ts#L157) +#### SubmitSuccessCallback -___ +Ƭ **SubmitSuccessCallback**\<`Values`\>: (`writer`: [`FormState`](#formstate)\<`Values` \| `Omit`\<`Values`, ``"__metadata"``\>\>, `setError`: [`SetError`](#seterror), `clearIsDirty`: () => `void`) => `void` -### IsDirty - -Ƭ **IsDirty**: `boolean` - -Returns true if the form is Dirty (user already interacted with the form), false otherwise. - -#### Defined in - -[index.ts:83](https://github.com/radicalbit/formbit/blob/a28ef40/src/types/index.ts#L83) +Success callback invoked by the submit method when the validation is successful. +Is the right place to send your data to the backend. -___ +#### Type parameters -### IsFormInvalid +| Name | Type | +| :------ | :------ | +| `Values` | extends [`InitialValues`](#initialvalues) | -Ƭ **IsFormInvalid**: () => `boolean` +#### Type declaration -Returns true if the form is NOT valid -It doesn't perform any validation, it checks if any errors are present +▸ (`writer`, `setError`, `clearIsDirty`): `void` -#### Type declaration +##### Parameters -▸ (): `boolean` +| Name | Type | +| :------ | :------ | +| `writer` | [`FormState`](#formstate)\<`Values` \| `Omit`\<`Values`, ``"__metadata"``\>\> | +| `setError` | [`SetError`](#seterror) | +| `clearIsDirty` | () => `void` | ##### Returns -`boolean` +`void` #### Defined in -[index.ts:89](https://github.com/radicalbit/formbit/blob/a28ef40/src/types/index.ts#L89) +[index.ts:181](https://github.com/radicalbit/formbit/blob/35e7e34/src/types/index.ts#L181) +#### SuccessCallback -___ +Ƭ **SuccessCallback**\<`Values`\>: (`writer`: [`FormState`](#formstate)\<`Values`\>, `setError`: [`SetError`](#seterror)) => `void` -### IsFormValid +Success callback invoked by some formbit methods when the operation is successful. -Ƭ **IsFormValid**: () => `boolean` +#### Type parameters -Returns true id the form is valid -It doesn't perform any validation, it checks if any errors are present +| Name | Type | +| :------ | :------ | +| `Values` | extends [`InitialValues`](#initialvalues) | #### Type declaration -▸ (): `boolean` +▸ (`writer`, `setError`): `void` + +##### Parameters + +| Name | Type | +| :------ | :------ | +| `writer` | [`FormState`](#formstate)\<`Values`\> | +| `setError` | [`SetError`](#seterror) | ##### Returns -`boolean` +`void` #### Defined in -[index.ts:95](https://github.com/radicalbit/formbit/blob/a28ef40/src/types/index.ts#L95) +[index.ts:152](https://github.com/radicalbit/formbit/blob/35e7e34/src/types/index.ts#L152) +### Method Types -___ +#### Check -### LiveValidation +Ƭ **Check**\<`Values`\>: (`json`: [`Form`](#form), `options?`: [`CheckFnOptions`](#checkfnoptions)\<`Values`\>) => [`ValidationError`](#validationerror)[] \| `undefined` -Ƭ **LiveValidation**: `Record`\<`string`, ``true``\> +See [FormbitObject.check](#check). -Object including all the values that are being live validated. -Usually fields that fail validation (using one of the method that triggers validation) -will automatically set to be live-validated. +#### Type parameters -A value/path is live-validated when validated at every change of the form. +| Name | Type | +| :------ | :------ | +| `Values` | extends [`InitialValues`](#initialvalues) | -By default no field is live-validated +#### Type declaration -**`Example`** +▸ (`json`, `options?`): [`ValidationError`](#validationerror)[] \| `undefined` -If the form object has this structure: -```json -{ - "age": 1 -} -``` -and age is a field that is being live-validated, liveValidation object will look like this -```json -{ - "age": "Age must be greater then 18" -} -``` +##### Parameters + +| Name | Type | +| :------ | :------ | +| `json` | [`Form`](#form) | +| `options?` | [`CheckFnOptions`](#checkfnoptions)\<`Values`\> | + +##### Returns + +[`ValidationError`](#validationerror)[] \| `undefined` #### Defined in -[index.ts:121](https://github.com/radicalbit/formbit/blob/a28ef40/src/types/index.ts#L121) +[index.ts:216](https://github.com/radicalbit/formbit/blob/35e7e34/src/types/index.ts#L216) +#### Initialize -___ +Ƭ **Initialize**\<`Values`\>: (`values`: `Partial`\<`Values`\>) => `void` -### LiveValidationFn +See [FormbitObject.initialize](#initialize). -Ƭ **LiveValidationFn**: (`path`: `string`) => ``true`` \| `undefined` +#### Type parameters -Returns true if live validation is active for the given path +| Name | Type | +| :------ | :------ | +| `Values` | extends [`InitialValues`](#initialvalues) | #### Type declaration -▸ (`path`): ``true`` \| `undefined` +▸ (`values`): `void` ##### Parameters | Name | Type | | :------ | :------ | -| `path` | `string` | +| `values` | `Partial`\<`Values`\> | ##### Returns -``true`` \| `undefined` - -#### Defined in - -[index.ts:127](https://github.com/radicalbit/formbit/blob/a28ef40/src/types/index.ts#L127) - -___ - -### Object - -Ƭ **Object**: `Record`\<`string`, `unknown`\> - -Generic object with string as keys +`void` #### Defined in -[index.ts:133](https://github.com/radicalbit/formbit/blob/a28ef40/src/types/index.ts#L133) - -___ - -### Remove +[index.ts:220](https://github.com/radicalbit/formbit/blob/35e7e34/src/types/index.ts#L220) +#### Remove Ƭ **Remove**\<`Values`\>: (`path`: `string`, `options?`: [`WriteFnOptions`](#writefnoptions)\<`Values`\>) => `void` -This method updates the form state deleting value and set isDirty to true. - -After writing, it validates all the paths contained into pathsToValidate (if any) -and all the fields that have the live validation active. +See [FormbitObject.remove](#remove). #### Type parameters @@ -632,15 +738,12 @@ and all the fields that have the live validation active. #### Defined in -[index.ts:152](https://github.com/radicalbit/formbit/blob/a28ef40/src/types/index.ts#L152) - -___ - -### RemoveAll +[index.ts:223](https://github.com/radicalbit/formbit/blob/35e7e34/src/types/index.ts#L223) +#### RemoveAll Ƭ **RemoveAll**\<`Values`\>: (`arr`: `string`[], `options?`: [`WriteFnOptions`](#writefnoptions)\<`Values`\>) => `void` -This method updates the form state deleting multiple values, setting isDirty to true. +See [FormbitObject.removeAll](#removeall). #### Type parameters @@ -665,37 +768,12 @@ This method updates the form state deleting multiple values, setting isDirty to #### Defined in -[index.ts:278](https://github.com/radicalbit/formbit/blob/a28ef40/src/types/index.ts#L278) - -___ - -### ResetForm - -Ƭ **ResetForm**: () => `void` - -Reset form to the initial state. -Errors and liveValidation are set back to empty objects. -isDirty is set back to false - -#### Type declaration - -▸ (): `void` - -##### Returns - -`void` - -#### Defined in - -[index.ts:160](https://github.com/radicalbit/formbit/blob/a28ef40/src/types/index.ts#L160) - -___ - -### SetError +[index.ts:258](https://github.com/radicalbit/formbit/blob/35e7e34/src/types/index.ts#L258) +#### SetError Ƭ **SetError**: (`path`: `string`, `value`: `string`) => `void` -Set a message(value) to the given error path. +See [FormbitObject.setError](#seterror). #### Type declaration @@ -714,15 +792,12 @@ Set a message(value) to the given error path. #### Defined in -[index.ts:175](https://github.com/radicalbit/formbit/blob/a28ef40/src/types/index.ts#L175) - -___ - -### SetSchema +[index.ts:226](https://github.com/radicalbit/formbit/blob/35e7e34/src/types/index.ts#L226) +#### SetSchema Ƭ **SetSchema**\<`Values`\>: (`newSchema`: [`ValidationSchema`](#validationschema)\<`Values`\>) => `void` -Override the current schema with the given one. +See [FormbitObject.setSchema](#setschema). #### Type parameters @@ -746,16 +821,12 @@ Override the current schema with the given one. #### Defined in -[index.ts:181](https://github.com/radicalbit/formbit/blob/a28ef40/src/types/index.ts#L181) - -___ +[index.ts:229](https://github.com/radicalbit/formbit/blob/35e7e34/src/types/index.ts#L229) +#### SubmitForm -### SubmitForm +Ƭ **SubmitForm**\<`Values`\>: (`successCallback`: [`SubmitSuccessCallback`](#submitsuccesscallback)\<`Values`\>, `errorCallback?`: [`ErrorCallback`](#errorcallback)\<`Partial`\<`Values`\>\>, `options?`: [`ValidateOptions`](#validateoptions)) => `void` -Ƭ **SubmitForm**\<`Values`\>: (`successCallback`: [`SuccessSubmitCallback`](#successsubmitcallback)\<`Values`\>, `errorCallback?`: [`ErrorCallback`](#errorcallback)\<`Partial`\<`Values`\>\>, `options?`: [`ValidateOptions`](#validateoptions)) => `void` - -Perform a validation against the current form object, and execute the successCallback if the validation pass -otherwise it executes the errorCallback +See [FormbitObject.submitForm](#submitform). #### Type parameters @@ -771,7 +842,7 @@ otherwise it executes the errorCallback | Name | Type | | :------ | :------ | -| `successCallback` | [`SuccessSubmitCallback`](#successsubmitcallback)\<`Values`\> | +| `successCallback` | [`SubmitSuccessCallback`](#submitsuccesscallback)\<`Values`\> | | `errorCallback?` | [`ErrorCallback`](#errorcallback)\<`Partial`\<`Values`\>\> | | `options?` | [`ValidateOptions`](#validateoptions) | @@ -781,15 +852,12 @@ otherwise it executes the errorCallback #### Defined in -[index.ts:188](https://github.com/radicalbit/formbit/blob/a28ef40/src/types/index.ts#L188) - -___ +[index.ts:232](https://github.com/radicalbit/formbit/blob/35e7e34/src/types/index.ts#L232) +#### Validate -### SuccessCallback - -Ƭ **SuccessCallback**\<`Values`\>: (`writer`: [`Writer`](#writer)\<`Values`\>, `setError`: [`SetError`](#seterror)) => `void` +Ƭ **Validate**\<`Values`\>: (`path`: `string`, `options?`: [`ValidateFnOptions`](#validatefnoptions)\<`Values`\>) => `void` -Success callback invoked by some formbit methods when the operation is successful. +See [FormbitObject.validate](#validate). #### Type parameters @@ -799,14 +867,14 @@ Success callback invoked by some formbit methods when the operation is successfu #### Type declaration -▸ (`writer`, `setError`): `void` +▸ (`path`, `options?`): `void` ##### Parameters | Name | Type | | :------ | :------ | -| `writer` | [`Writer`](#writer)\<`Values`\> | -| `setError` | [`SetError`](#seterror) | +| `path` | `string` | +| `options?` | [`ValidateFnOptions`](#validatefnoptions)\<`Values`\> | ##### Returns @@ -814,15 +882,12 @@ Success callback invoked by some formbit methods when the operation is successfu #### Defined in -[index.ts:197](https://github.com/radicalbit/formbit/blob/a28ef40/src/types/index.ts#L197) +[index.ts:238](https://github.com/radicalbit/formbit/blob/35e7e34/src/types/index.ts#L238) +#### ValidateAll -___ - -### SuccessCheckCallback - -Ƭ **SuccessCheckCallback**\<`Values`\>: (`json`: [`Form`](#form), `writer`: [`Writer`](#writer)\<`Values`\>, `setError`: [`SetError`](#seterror)) => `void` +Ƭ **ValidateAll**\<`Values`\>: (`paths`: `string`[], `options?`: [`ValidateFnOptions`](#validatefnoptions)\<`Values`\>) => `void` -Success callback invoked by the check method when the operation is successful. +See [FormbitObject.validateAll](#validateall). #### Type parameters @@ -832,15 +897,14 @@ Success callback invoked by the check method when the operation is successful. #### Type declaration -▸ (`json`, `writer`, `setError`): `void` +▸ (`paths`, `options?`): `void` ##### Parameters | Name | Type | | :------ | :------ | -| `json` | [`Form`](#form) | -| `writer` | [`Writer`](#writer)\<`Values`\> | -| `setError` | [`SetError`](#seterror) | +| `paths` | `string`[] | +| `options?` | [`ValidateFnOptions`](#validatefnoptions)\<`Values`\> | ##### Returns @@ -848,16 +912,12 @@ Success callback invoked by the check method when the operation is successful. #### Defined in -[index.ts:203](https://github.com/radicalbit/formbit/blob/a28ef40/src/types/index.ts#L203) - -___ - -### SuccessSubmitCallback +[index.ts:241](https://github.com/radicalbit/formbit/blob/35e7e34/src/types/index.ts#L241) +#### ValidateForm -Ƭ **SuccessSubmitCallback**\<`Values`\>: (`writer`: [`Writer`](#writer)\<`Values` \| `Omit`\<`Values`, ``"__metadata"``\>\>, `setError`: [`SetError`](#seterror), `clearIsDirty`: [`ClearIsDirty`](#clearisdirty)) => `void` +Ƭ **ValidateForm**\<`Values`\>: (`successCallback?`: [`SuccessCallback`](#successcallback)\<`Values`\>, `errorCallback?`: [`ErrorCallback`](#errorcallback)\<`Values`\>, `options?`: [`ValidateOptions`](#validateoptions)) => `void` -Success callback invoked by the submit method when the validation is successful. -Is the right place to send your data to the backend. +See [FormbitObject.validateForm](#validateform). #### Type parameters @@ -867,15 +927,15 @@ Is the right place to send your data to the backend. #### Type declaration -▸ (`writer`, `setError`, `clearIsDirty`): `void` +▸ (`successCallback?`, `errorCallback?`, `options?`): `void` ##### Parameters | Name | Type | | :------ | :------ | -| `writer` | [`Writer`](#writer)\<`Values` \| `Omit`\<`Values`, ``"__metadata"``\>\> | -| `setError` | [`SetError`](#seterror) | -| `clearIsDirty` | [`ClearIsDirty`](#clearisdirty) | +| `successCallback?` | [`SuccessCallback`](#successcallback)\<`Values`\> | +| `errorCallback?` | [`ErrorCallback`](#errorcallback)\<`Values`\> | +| `options?` | [`ValidateOptions`](#validateoptions) | ##### Returns @@ -883,16 +943,12 @@ Is the right place to send your data to the backend. #### Defined in -[index.ts:211](https://github.com/radicalbit/formbit/blob/a28ef40/src/types/index.ts#L211) - -___ +[index.ts:244](https://github.com/radicalbit/formbit/blob/35e7e34/src/types/index.ts#L244) +#### Write -### Validate - -Ƭ **Validate**\<`Values`\>: (`path`: `string`, `options?`: [`ValidateFnOptions`](#validatefnoptions)\<`Values`\>) => `void` +Ƭ **Write**\<`Values`\>: (`path`: keyof `Values` \| `string`, `value`: `unknown`, `options?`: [`WriteFnOptions`](#writefnoptions)\<`Values`\>) => `void` -This method only validate the specified path. Do not check for fields that have the -live validation active. +See [FormbitObject.write](#write). #### Type parameters @@ -902,14 +958,15 @@ live validation active. #### Type declaration -▸ (`path`, `options?`): `void` +▸ (`path`, `value`, `options?`): `void` ##### Parameters | Name | Type | | :------ | :------ | -| `path` | `string` | -| `options?` | [`ValidateFnOptions`](#validatefnoptions)\<`Values`\> | +| `path` | keyof `Values` \| `string` | +| `value` | `unknown` | +| `options?` | [`WriteFnOptions`](#writefnoptions)\<`Values`\> | ##### Returns @@ -917,16 +974,12 @@ live validation active. #### Defined in -[index.ts:222](https://github.com/radicalbit/formbit/blob/a28ef40/src/types/index.ts#L222) +[index.ts:250](https://github.com/radicalbit/formbit/blob/35e7e34/src/types/index.ts#L250) +#### WriteAll -___ - -### ValidateAll - -Ƭ **ValidateAll**\<`Values`\>: (`paths`: `string`[], `options?`: [`ValidateFnOptions`](#validatefnoptions)\<`Values`\>) => `void` +Ƭ **WriteAll**\<`Values`\>: (`arr`: [`WriteAllValue`](#writeallvalue)\<`Values`\>[], `options?`: [`WriteFnOptions`](#writefnoptions)\<`Values`\>) => `void` -This method only validate the specified paths. Do not check for fields that have the -live validation active. +See [FormbitObject.writeAll](#writeall). #### Type parameters @@ -936,14 +989,14 @@ live validation active. #### Type declaration -▸ (`paths`, `options?`): `void` +▸ (`arr`, `options?`): `void` ##### Parameters | Name | Type | | :------ | :------ | -| `paths` | `string`[] | -| `options?` | [`ValidateFnOptions`](#validatefnoptions)\<`Values`\> | +| `arr` | [`WriteAllValue`](#writeallvalue)\<`Values`\>[] | +| `options?` | [`WriteFnOptions`](#writefnoptions)\<`Values`\> | ##### Returns @@ -951,15 +1004,14 @@ live validation active. #### Defined in -[index.ts:229](https://github.com/radicalbit/formbit/blob/a28ef40/src/types/index.ts#L229) +[index.ts:254](https://github.com/radicalbit/formbit/blob/35e7e34/src/types/index.ts#L254) +### Options Types -___ +#### CheckFnOptions -### ValidateFnOptions - -Ƭ **ValidateFnOptions**\<`Values`\>: `Object` +Ƭ **CheckFnOptions**\<`Values`\>: `Object` -Options object to change the behavior of the validate methods +Options object to change the behavior of the check method. #### Type parameters @@ -971,21 +1023,18 @@ Options object to change the behavior of the validate methods | Name | Type | | :------ | :------ | -| `errorCallback?` | [`ErrorCallback`](#errorcallback)\<`Partial`\<`Values`\>\> | +| `errorCallback?` | [`CheckErrorCallback`](#checkerrorcallback)\<`Values`\> | | `options?` | [`ValidateOptions`](#validateoptions) | -| `successCallback?` | [`SuccessCallback`](#successcallback)\<`Partial`\<`Values`\>\> | +| `successCallback?` | [`CheckSuccessCallback`](#checksuccesscallback)\<`Values`\> | #### Defined in -[index.ts:319](https://github.com/radicalbit/formbit/blob/a28ef40/src/types/index.ts#L319) - -___ +[index.ts:271](https://github.com/radicalbit/formbit/blob/35e7e34/src/types/index.ts#L271) +#### ValidateFnOptions -### ValidateForm - -Ƭ **ValidateForm**\<`Values`\>: (`successCallback?`: [`SuccessCallback`](#successcallback)\<`Values`\>, `errorCallback?`: [`ErrorCallback`](#errorcallback)\<`Values`\>, `options?`: [`ValidateOptions`](#validateoptions)) => `void` +Ƭ **ValidateFnOptions**\<`Values`\>: `Object` -This method validates the entire form and set the corresponding errors if any. +Options object to change the behavior of the validate methods. #### Type parameters @@ -995,72 +1044,77 @@ This method validates the entire form and set the corresponding errors if any. #### Type declaration -▸ (`successCallback?`, `errorCallback?`, `options?`): `void` - -##### Parameters - | Name | Type | | :------ | :------ | -| `successCallback?` | [`SuccessCallback`](#successcallback)\<`Values`\> | -| `errorCallback?` | [`ErrorCallback`](#errorcallback)\<`Values`\> | +| `errorCallback?` | [`ErrorCallback`](#errorcallback)\<`Partial`\<`Values`\>\> | | `options?` | [`ValidateOptions`](#validateoptions) | +| `successCallback?` | [`SuccessCallback`](#successcallback)\<`Partial`\<`Values`\>\> | -##### Returns +#### Defined in -`void` +[index.ts:280](https://github.com/radicalbit/formbit/blob/35e7e34/src/types/index.ts#L280) +#### WriteAllValue -#### Defined in +Ƭ **WriteAllValue**\<`Values`\>: [keyof `Values` \| `string`, `unknown`] -[index.ts:235](https://github.com/radicalbit/formbit/blob/a28ef40/src/types/index.ts#L235) +Tuple of [key, value] pair. -___ +#### Type parameters -### ValidateOptions +| Name | Type | +| :------ | :------ | +| `Values` | extends [`InitialValues`](#initialvalues) | -Ƭ **ValidateOptions**: `YupValidateOptions` +#### Defined in -Type imported from the yup library. -It represents the object with all the options that can be passed to the internal yup validation method, +[index.ts:264](https://github.com/radicalbit/formbit/blob/35e7e34/src/types/index.ts#L264) +#### WriteFnOptions -Link to the Yup documentation [https://github.com/jquense/yup](https://github.com/jquense/yup) +Ƭ **WriteFnOptions**\<`Values`\>: \{ `noLiveValidation?`: `boolean` ; `pathsToValidate?`: `string`[] } & [`ValidateFnOptions`](#validatefnoptions)\<`Values`\> -#### Defined in +Options object to change the behavior of the write methods. + +#### Type parameters + +| Name | Type | +| :------ | :------ | +| `Values` | extends [`InitialValues`](#initialvalues) | -[index.ts:249](https://github.com/radicalbit/formbit/blob/a28ef40/src/types/index.ts#L249) +#### Defined in -___ +[index.ts:289](https://github.com/radicalbit/formbit/blob/35e7e34/src/types/index.ts#L289) +### Yup Re-Exports -### ValidationError +#### ValidateOptions -Ƭ **ValidationError**: `YupValidationError` +Ƭ **ValidateOptions**: `YupValidateOptions` Type imported from the yup library. -It represents the error object returned when a validation fails +It represents the object with all the options that can be passed to the internal yup validation method. Link to the Yup documentation [https://github.com/jquense/yup](https://github.com/jquense/yup) #### Defined in -[index.ts:332](https://github.com/radicalbit/formbit/blob/a28ef40/src/types/index.ts#L332) +[index.ts:137](https://github.com/radicalbit/formbit/blob/35e7e34/src/types/index.ts#L137) +#### ValidationError -___ +Ƭ **ValidationError**: `YupValidationError` -### ValidationFormbitError +Type imported from the yup library. +It represents the error object returned when a validation fails. -Ƭ **ValidationFormbitError**: `Pick`\<[`ValidationError`](#validationerror), ``"message"`` \| ``"path"``\> +Link to the Yup documentation [https://github.com/jquense/yup](https://github.com/jquense/yup) #### Defined in -[index.ts:240](https://github.com/radicalbit/formbit/blob/a28ef40/src/types/index.ts#L240) - -___ - -### ValidationSchema +[index.ts:145](https://github.com/radicalbit/formbit/blob/35e7e34/src/types/index.ts#L145) +#### ValidationSchema Ƭ **ValidationSchema**\<`Values`\>: `ObjectSchema`\<`Values`\> Type imported from the yup library. -It represents any validation schema created with the yup.object() method +It represents any validation schema created with the yup.object() method. Link to the Yup documentation [https://github.com/jquense/yup](https://github.com/jquense/yup) @@ -1072,18 +1126,38 @@ Link to the Yup documentation [https://github.com/jquense/yup](https://github.co #### Defined in -[index.ts:169](https://github.com/radicalbit/formbit/blob/a28ef40/src/types/index.ts#L169) +[index.ts:129](https://github.com/radicalbit/formbit/blob/35e7e34/src/types/index.ts#L129) +### Deprecated Types -___ +
+Show deprecated types -### Write +#### ClearIsDirty -Ƭ **Write**\<`Values`\>: (`path`: keyof `Values` \| `string`, `value`: `unknown`, `options?`: [`WriteFnOptions`](#writefnoptions)\<`Values`\>) => `void` +Ƭ **ClearIsDirty**: () => `void` + +**`Deprecated`** + +Inlined into [FormbitObject](#formbitobject). + +#### Type declaration + +▸ (): `void` + +##### Returns + +`void` + +#### Defined in + +[index.ts:202](https://github.com/radicalbit/formbit/blob/35e7e34/src/types/index.ts#L202) +#### ErrorCheckCallback -This method update the form state writing $value into the $path, setting isDirty to true. +Ƭ **ErrorCheckCallback**\<`Values`\>: [`CheckErrorCallback`](#checkerrorcallback)\<`Values`\> -After writing, it validates all the paths contained into $pathsToValidate (if any) -and all the fields that have the live validation active. +**`Deprecated`** + +Use [CheckErrorCallback](#checkerrorcallback) instead. #### Type parameters @@ -1091,90 +1165,145 @@ and all the fields that have the live validation active. | :------ | :------ | | `Values` | extends [`InitialValues`](#initialvalues) | +#### Defined in + +[index.ts:175](https://github.com/radicalbit/formbit/blob/35e7e34/src/types/index.ts#L175) +#### ErrorFn + +Ƭ **ErrorFn**: (`path`: `string`) => `string` \| `undefined` + +**`Deprecated`** + +Inlined into [FormbitObject](#formbitobject). + #### Type declaration -▸ (`path`, `value`, `options?`): `void` +▸ (`path`): `string` \| `undefined` ##### Parameters | Name | Type | | :------ | :------ | -| `path` | keyof `Values` \| `string` | -| `value` | `unknown` | -| `options?` | [`WriteFnOptions`](#writefnoptions)\<`Values`\> | +| `path` | `string` | ##### Returns -`void` +`string` \| `undefined` #### Defined in -[index.ts:258](https://github.com/radicalbit/formbit/blob/a28ef40/src/types/index.ts#L258) +[index.ts:193](https://github.com/radicalbit/formbit/blob/35e7e34/src/types/index.ts#L193) +#### IsDirty -___ +Ƭ **IsDirty**: `boolean` -### WriteAll +**`Deprecated`** -Ƭ **WriteAll**\<`Values`\>: (`arr`: [`WriteAllValue`](#writeallvalue)\<`Values`\>[], `options?`: [`WriteFnOptions`](#writefnoptions)\<`Values`\>) => `void` +Inlined into [FormbitObject](#formbitobject). -This method takes an array of [path, value] and update the form state writing -all those values into the specified paths. +#### Defined in -It set isDirty to true. +[index.ts:211](https://github.com/radicalbit/formbit/blob/35e7e34/src/types/index.ts#L211) +#### IsFormInvalid -After writing, it validate all the paths contained into $pathToValidate and all -the fields that have the live validation active. +Ƭ **IsFormInvalid**: () => `boolean` -#### Type parameters +**`Deprecated`** -| Name | Type | -| :------ | :------ | -| `Values` | extends [`InitialValues`](#initialvalues) | +Inlined into [FormbitObject](#formbitobject). #### Type declaration -▸ (`arr`, `options?`): `void` +▸ (): `boolean` -##### Parameters +##### Returns -| Name | Type | -| :------ | :------ | -| `arr` | [`WriteAllValue`](#writeallvalue)\<`Values`\>[] | -| `options?` | [`WriteFnOptions`](#writefnoptions)\<`Values`\> | +`boolean` + +#### Defined in + +[index.ts:199](https://github.com/radicalbit/formbit/blob/35e7e34/src/types/index.ts#L199) +#### IsFormValid + +Ƭ **IsFormValid**: () => `boolean` + +**`Deprecated`** + +Inlined into [FormbitObject](#formbitobject). + +#### Type declaration + +▸ (): `boolean` ##### Returns -`void` +`boolean` #### Defined in -[index.ts:271](https://github.com/radicalbit/formbit/blob/a28ef40/src/types/index.ts#L271) +[index.ts:196](https://github.com/radicalbit/formbit/blob/35e7e34/src/types/index.ts#L196) +#### LiveValidationFn -___ +Ƭ **LiveValidationFn**: (`path`: `string`) => ``true`` \| `undefined` -### WriteAllValue +**`Deprecated`** -Ƭ **WriteAllValue**\<`Values`\>: [keyof `Values` \| `string`, `unknown`] +Inlined into [FormbitObject](#formbitobject). -Tuple of [key, value] pair. +#### Type declaration -#### Type parameters +▸ (`path`): ``true`` \| `undefined` + +##### Parameters | Name | Type | | :------ | :------ | -| `Values` | extends [`InitialValues`](#initialvalues) | +| `path` | `string` | + +##### Returns + +``true`` \| `undefined` #### Defined in -[index.ts:285](https://github.com/radicalbit/formbit/blob/a28ef40/src/types/index.ts#L285) +[index.ts:208](https://github.com/radicalbit/formbit/blob/35e7e34/src/types/index.ts#L208) +#### Object -___ +Ƭ **Object**: `FormbitRecord` -### WriteFnOptions +**`Deprecated`** -Ƭ **WriteFnOptions**\<`Values`\>: \{ `noLiveValidation?`: `boolean` ; `pathsToValidate?`: `string`[] } & [`ValidateFnOptions`](#validatefnoptions)\<`Values`\> +Use FormbitRecord instead. Renamed to avoid shadowing the global `Object`. + +#### Defined in + +[index.ts:19](https://github.com/radicalbit/formbit/blob/35e7e34/src/types/index.ts#L19) +#### ResetForm -Options object to change the behavior of the write methods +Ƭ **ResetForm**: () => `void` + +**`Deprecated`** + +Inlined into [FormbitObject](#formbitobject). + +#### Type declaration + +▸ (): `void` + +##### Returns + +`void` + +#### Defined in + +[index.ts:205](https://github.com/radicalbit/formbit/blob/35e7e34/src/types/index.ts#L205) +#### SuccessCheckCallback + +Ƭ **SuccessCheckCallback**\<`Values`\>: [`CheckSuccessCallback`](#checksuccesscallback)\<`Values`\> + +**`Deprecated`** + +Use [CheckSuccessCallback](#checksuccesscallback) instead. #### Type parameters @@ -1184,15 +1313,14 @@ Options object to change the behavior of the write methods #### Defined in -[index.ts:338](https://github.com/radicalbit/formbit/blob/a28ef40/src/types/index.ts#L338) - -___ +[index.ts:166](https://github.com/radicalbit/formbit/blob/35e7e34/src/types/index.ts#L166) +#### SuccessSubmitCallback -### Writer +Ƭ **SuccessSubmitCallback**\<`Values`\>: [`SubmitSuccessCallback`](#submitsuccesscallback)\<`Values`\> -Ƭ **Writer**\<`Values`\>: `Object` +**`Deprecated`** -Internal form state storing all the data of the form (except the validation schema) +Use [SubmitSuccessCallback](#submitsuccesscallback) instead. #### Type parameters @@ -1200,20 +1328,27 @@ Internal form state storing all the data of the form (except the validation sche | :------ | :------ | | `Values` | extends [`InitialValues`](#initialvalues) | -#### Type declaration +#### Defined in + +[index.ts:188](https://github.com/radicalbit/formbit/blob/35e7e34/src/types/index.ts#L188) +#### Writer + +Ƭ **Writer**\<`Values`\>: [`FormState`](#formstate)\<`Values`\> + +**`Deprecated`** + +Use [FormState](#formstate) instead. + +#### Type parameters | Name | Type | | :------ | :------ | -| `errors` | [`Errors`](#errors) | -| `form` | `Values` | -| `initialValues` | `Values` | -| `isDirty` | [`IsDirty`](#isdirty) | -| `liveValidation` | [`LiveValidation`](#livevalidation) | +| `Values` | extends [`InitialValues`](#initialvalues) | #### Defined in -[index.ts:297](https://github.com/radicalbit/formbit/blob/a28ef40/src/types/index.ts#L297) - +[index.ts:119](https://github.com/radicalbit/formbit/blob/35e7e34/src/types/index.ts#L119) +
## License diff --git a/example/package.json b/example/package.json index 54d176f..c87e4be 100644 --- a/example/package.json +++ b/example/package.json @@ -12,10 +12,10 @@ "cypress:components": "cypress run --component" }, "dependencies": { - "@fortawesome/free-solid-svg-icons": "^6.5.2", + "@fortawesome/free-solid-svg-icons": "6.7.2", + "@radicalbit/radicalbit-design-system": "2.13.1", "cypress": "^13.7.3", "formbit": "link:..", - "@radicalbit/radicalbit-design-system": "1.0.0", "react": "^18.2.0", "react-dom": "^18.2.0", "yup": "^1.4.0" @@ -33,4 +33,4 @@ "typescript": "^5.2.2", "vite": "^5.2.0" } -} \ No newline at end of file +} diff --git a/example/src/App.tsx b/example/src/App.tsx index 0510242..dc894dd 100644 --- a/example/src/App.tsx +++ b/example/src/App.tsx @@ -5,7 +5,7 @@ import { MultipleStepsForm } from './forms/multiple-steps' import { AddableFieldsForm } from './forms/addable-fields' import { EditLikeForm } from './forms/edit-like' import { FakeApiProvider } from "./forms/context/api-context" -import FormbitLogo from "./img/formbit-logo.svg" +import Logo from "./img/LogoRB_PositivoBN.png" import { WriteRemoveAllForm } from "./forms/remove-all" enum EXAMPLES { @@ -19,50 +19,56 @@ enum EXAMPLES { function App() { return ( -
-
- Formbit Logo -
+
+
+
+ Logo +
- - - }, - { - label: 'Basic Context', - key: EXAMPLES.CONTEXT, - children: - }, - { - label: 'Multi-step Form', - key: EXAMPLES.MULTI, - children: - }, - { - label: 'Addable-Fields Form', - key: EXAMPLES.ADDABLE, - children: - }, - { - label: 'Edit Form', - key: EXAMPLES.EDIT, - children: - }, - { - label: 'Write/Remove All Form', - key: EXAMPLES.WRITEREMOVEALL, - children: - }, - ]} /> - + + + }, + { + label: 'Basic Context', + key: EXAMPLES.CONTEXT, + children: + }, + { + label: 'Multi-step Form', + key: EXAMPLES.MULTI, + children: + }, + { + label: 'Addable-Fields Form', + key: EXAMPLES.ADDABLE, + children: + }, + { + label: 'Edit Form', + key: EXAMPLES.EDIT, + children: + }, + { + label: 'Write/Remove All Form', + key: EXAMPLES.WRITEREMOVEALL, + children: + }, + ]} /> + +
+ +
) } diff --git a/example/src/forms/addable-fields/index.tsx b/example/src/forms/addable-fields/index.tsx index f7d7bd4..aa63f78 100644 --- a/example/src/forms/addable-fields/index.tsx +++ b/example/src/forms/addable-fields/index.tsx @@ -8,12 +8,9 @@ import { } from "@radicalbit/radicalbit-design-system"; import { InputRef } from 'rc-input'; import { ChangeEvent, ChangeEventHandler, useRef, useState } from 'react'; -import * as yup from 'yup'; import { useAutoFocus } from '../../helpers/use-autofocus'; import { useHandleOnSubmit } from '../context/use-handle-on-submit'; -import { schema } from './schema'; - -type FormData = yup.InferType +import { FormData, schema } from './schema'; const useAddableFieldsForm = () => useFormbitContext(); @@ -193,7 +190,7 @@ function Actions() { Submit - diff --git a/example/src/forms/basic-form-context/index.tsx b/example/src/forms/basic-form-context/index.tsx index b770b97..e0a3c25 100644 --- a/example/src/forms/basic-form-context/index.tsx +++ b/example/src/forms/basic-form-context/index.tsx @@ -6,12 +6,9 @@ import { } from "@radicalbit/radicalbit-design-system"; import { InputRef } from 'rc-input'; import { ChangeEvent } from 'react'; -import * as yup from 'yup'; import { useAutoFocus } from '../../helpers/use-autofocus'; import { useHandleOnSubmit } from '../context/use-handle-on-submit'; -import { schema } from './schema'; - -type FormData = yup.InferType +import { FormData, schema } from './schema'; const useBasicFormContext = () => useFormbitContext(); @@ -120,7 +117,7 @@ function Actions() { Submit - diff --git a/example/src/forms/basic-form-context/schema.ts b/example/src/forms/basic-form-context/schema.ts index f2c6408..b7d42e2 100644 --- a/example/src/forms/basic-form-context/schema.ts +++ b/example/src/forms/basic-form-context/schema.ts @@ -4,4 +4,6 @@ export const schema = yup.object().shape({ name: yup.string().min(2).required(), surname: yup.string().min(2).required(), age: yup.number().min(18).required() -}); \ No newline at end of file +}); + +export type FormData = yup.InferType \ No newline at end of file diff --git a/example/src/forms/basic-form-hook/index.tsx b/example/src/forms/basic-form-hook/index.tsx index 2dd09fa..36006fc 100644 --- a/example/src/forms/basic-form-hook/index.tsx +++ b/example/src/forms/basic-form-hook/index.tsx @@ -9,7 +9,7 @@ import { ChangeEvent } from 'react'; import { usePost } from '../context/api-context'; import { useAutoFocus } from '../../helpers/use-autofocus'; import { success } from '../../helpers/message'; -import { schema } from './schema'; +import { FormData, schema } from './schema'; type FieldProps = { value?: string, @@ -28,7 +28,7 @@ type ActionsProps = { export function BasicFormHook() { const [triggerMutation, isLoading] = usePost() - const { form, error, write, resetForm, submitForm, isFormInvalid, isDirty } = useFormbit({ initialValues: {}, yup: schema }); + const { form, error, write, resetForm, submitForm, isFormInvalid, isDirty } = useFormbit({ initialValues: {}, yup: schema }); const handleOnChangeName = (e: ChangeEvent) => write('name', e.target.value); const handleOnChangeSurname = (e: ChangeEvent) => write('surname', e.target.value); @@ -99,7 +99,7 @@ function Actions({ onSubmit, onReset, isLoading, isDisabled }: ActionsProps) { Submit -
diff --git a/example/src/forms/basic-form-hook/schema.ts b/example/src/forms/basic-form-hook/schema.ts index 9d167b6..66bf878 100644 --- a/example/src/forms/basic-form-hook/schema.ts +++ b/example/src/forms/basic-form-hook/schema.ts @@ -3,4 +3,6 @@ import * as yup from 'yup' export const schema = yup.object().shape({ name: yup.string().min(2).required(), surname: yup.string().min(2).required(), -}); \ No newline at end of file +}); + +export type FormData = yup.InferType \ No newline at end of file diff --git a/example/src/forms/context/use-handle-on-submit.tsx b/example/src/forms/context/use-handle-on-submit.tsx index b15e4ef..b769a3d 100644 --- a/example/src/forms/context/use-handle-on-submit.tsx +++ b/example/src/forms/context/use-handle-on-submit.tsx @@ -1,9 +1,9 @@ -import { useFormbitContext } from "formbit"; +import { useFormbitContext, type FormbitValues } from "formbit"; import { success } from "../../helpers/message"; import { usePost } from "./api-context"; -type Context = { - __metadata: { +type Context = FormbitValues & { + __metadata?: { resetSteps?: () => void } } @@ -20,10 +20,11 @@ export const useHandleOnSubmit = () => { const handleOnSubmit = () => { if (isSubmitDisabled || isLoading) return; - submitForm(async ({ form }) => { + submitForm(async ({ form }, _setError, clearIsDirty) => { await triggerMutation(form); success(form); resetForm(); + clearIsDirty(); resetSteps?.(); }); }; diff --git a/example/src/forms/edit-like/index.tsx b/example/src/forms/edit-like/index.tsx index 681718e..dc2ca56 100644 --- a/example/src/forms/edit-like/index.tsx +++ b/example/src/forms/edit-like/index.tsx @@ -7,17 +7,10 @@ import { } from "@radicalbit/radicalbit-design-system"; import { InputRef } from 'rc-input'; import { ChangeEvent, useEffect } from 'react'; -import * as yup from 'yup'; import { FakeApiProvider, useGetUser } from '../context/api-context'; import { useAutoFocus } from '../../helpers/use-autofocus'; import { useHandleOnSubmit } from '../context/use-handle-on-submit'; -import { schema } from './schema'; - -type FormData = yup.InferType & { - __metadata?: { - isLoading?: boolean - } -} +import { FormData, schema } from './schema'; const useEditLikeContext = () => useFormbitContext(); diff --git a/example/src/forms/edit-like/schema.ts b/example/src/forms/edit-like/schema.ts index 8b3cb73..6fd4700 100644 --- a/example/src/forms/edit-like/schema.ts +++ b/example/src/forms/edit-like/schema.ts @@ -4,4 +4,6 @@ export const schema = yup.object().shape({ name: yup.string().min(2).required(), surname: yup.string().min(2).required(), email: yup.string().email().required() -}); \ No newline at end of file +}); + +export type FormData = yup.InferType \ No newline at end of file diff --git a/example/src/forms/multiple-steps/step-three.tsx b/example/src/forms/multiple-steps/step-three.tsx index 0a9c2eb..be5068e 100644 --- a/example/src/forms/multiple-steps/step-three.tsx +++ b/example/src/forms/multiple-steps/step-three.tsx @@ -55,7 +55,7 @@ function Actions() { Submit - diff --git a/example/src/forms/multiple-steps/step-two.tsx b/example/src/forms/multiple-steps/step-two.tsx index d579a2b..c337807 100644 --- a/example/src/forms/multiple-steps/step-two.tsx +++ b/example/src/forms/multiple-steps/step-two.tsx @@ -63,7 +63,7 @@ function Actions() { diff --git a/example/src/forms/multiple-steps/use-handle-next-step.ts b/example/src/forms/multiple-steps/use-handle-next-step.ts index 1b61c30..0cc5f3b 100644 --- a/example/src/forms/multiple-steps/use-handle-next-step.ts +++ b/example/src/forms/multiple-steps/use-handle-next-step.ts @@ -1,12 +1,11 @@ -import { useFormbitContext } from "formbit"; +import { useFormbitContext, type FormbitValues } from "formbit"; import { useCallback } from "react"; - -type Context = { +type Context = FormbitValues & { __metadata: { nextStep?: () => void } - } +} export const useHandleNextStep = (fields: string[]) => { const { form: { __metadata }, validateAll, error } = useFormbitContext(); diff --git a/example/src/forms/remove-all/index.tsx b/example/src/forms/remove-all/index.tsx index 4ed510e..dd34319 100644 --- a/example/src/forms/remove-all/index.tsx +++ b/example/src/forms/remove-all/index.tsx @@ -6,12 +6,9 @@ import { } from "@radicalbit/radicalbit-design-system"; import { InputRef } from 'rc-input'; import { ChangeEvent } from 'react'; -import * as yup from 'yup'; import { useAutoFocus } from '../../helpers/use-autofocus'; import { useHandleOnSubmit } from '../context/use-handle-on-submit'; -import { schema } from './schema'; - -type FormData = yup.InferType +import { FormData, schema } from './schema'; const useBasicFormContext = () => useFormbitContext(); @@ -124,15 +121,15 @@ function Actions() { Submit - - - diff --git a/example/src/forms/remove-all/schema.ts b/example/src/forms/remove-all/schema.ts index f2c6408..b7d42e2 100644 --- a/example/src/forms/remove-all/schema.ts +++ b/example/src/forms/remove-all/schema.ts @@ -4,4 +4,6 @@ export const schema = yup.object().shape({ name: yup.string().min(2).required(), surname: yup.string().min(2).required(), age: yup.number().min(18).required() -}); \ No newline at end of file +}); + +export type FormData = yup.InferType \ No newline at end of file diff --git a/example/src/img/LogoRB_PositivoBN.png b/example/src/img/LogoRB_PositivoBN.png new file mode 100644 index 0000000..4d06505 Binary files /dev/null and b/example/src/img/LogoRB_PositivoBN.png differ diff --git a/example/src/index.css b/example/src/index.css index e48186d..7c05d4d 100644 --- a/example/src/index.css +++ b/example/src/index.css @@ -1,6 +1,2 @@ @tailwind components; @tailwind utilities; - -body { - background: url(./img/background-image.svg) bottom left no-repeat; -} \ No newline at end of file diff --git a/example/yarn.lock b/example/yarn.lock index 30665fc..383863c 100644 --- a/example/yarn.lock +++ b/example/yarn.lock @@ -15,40 +15,68 @@ "@jridgewell/gen-mapping" "^0.3.5" "@jridgewell/trace-mapping" "^0.3.24" -"@ant-design/colors@^6.0.0": - version "6.0.0" - resolved "https://registry.yarnpkg.com/@ant-design/colors/-/colors-6.0.0.tgz#9b9366257cffcc47db42b9d0203bb592c13c0298" - integrity sha512-qAZRvPzfdWHtfameEGP2Qvuf838NhergR35o+EuVyB5XvSA98xod5r4utvi4TJ3ywmevm290g9nsCG5MryrdWQ== +"@ant-design/colors@^7.0.0", "@ant-design/colors@^7.2.0": + version "7.2.1" + resolved "https://registry.yarnpkg.com/@ant-design/colors/-/colors-7.2.1.tgz#3bbc1c6c18550020d1622a0067ff03492318df98" + integrity sha512-lCHDcEzieu4GA3n8ELeZ5VQ8pKQAWcGGLRTQ50aQM2iqPpq2evTxER84jfdPvsPAtEcZ7m44NI45edFMo8oOYQ== + dependencies: + "@ant-design/fast-color" "^2.0.6" + +"@ant-design/cssinjs-utils@^1.1.3": + version "1.1.3" + resolved "https://registry.yarnpkg.com/@ant-design/cssinjs-utils/-/cssinjs-utils-1.1.3.tgz#5dd79126057920a6992d57b38dd84e2c0b707977" + integrity sha512-nOoQMLW1l+xR1Co8NFVYiP8pZp3VjIIzqV6D6ShYF2ljtdwWJn5WSsH+7kvCktXL/yhEtWURKOfH5Xz/gzlwsg== + dependencies: + "@ant-design/cssinjs" "^1.21.0" + "@babel/runtime" "^7.23.2" + rc-util "^5.38.0" + +"@ant-design/cssinjs@^1.21.0", "@ant-design/cssinjs@^1.22.0": + version "1.24.0" + resolved "https://registry.yarnpkg.com/@ant-design/cssinjs/-/cssinjs-1.24.0.tgz#7db091f03f189abc77a13cbd27a2293802cd7285" + integrity sha512-K4cYrJBsgvL+IoozUXYjbT6LHHNt+19a9zkvpBPxLjFHas1UpPM2A5MlhROb0BT8N8WoavM5VsP9MeSeNK/3mg== + dependencies: + "@babel/runtime" "^7.11.1" + "@emotion/hash" "^0.8.0" + "@emotion/unitless" "^0.7.5" + classnames "^2.3.1" + csstype "^3.1.3" + rc-util "^5.35.0" + stylis "^4.3.4" + +"@ant-design/fast-color@^2.0.6": + version "2.0.6" + resolved "https://registry.yarnpkg.com/@ant-design/fast-color/-/fast-color-2.0.6.tgz#ab4d4455c1542c9017d367c2fa8ca3e4215d0ba2" + integrity sha512-y2217gk4NqL35giHl72o6Zzqji9O7vHh9YmhUVkPtAOpoTCH4uWxo/pr4VE8t0+ChEPs0qo4eJRC5Q1eXWo3vA== dependencies: - "@ctrl/tinycolor" "^3.4.0" + "@babel/runtime" "^7.24.7" -"@ant-design/icons-svg@^4.3.0": +"@ant-design/icons-svg@^4.4.0": version "4.4.2" resolved "https://registry.yarnpkg.com/@ant-design/icons-svg/-/icons-svg-4.4.2.tgz#ed2be7fb4d82ac7e1d45a54a5b06d6cecf8be6f6" integrity sha512-vHbT+zJEVzllwP+CM+ul7reTEfBR0vgxFe7+lREAsAA7YGsYpboiq2sQNeQeRvh09GfQgs/GyFEvZpJ9cLXpXA== -"@ant-design/icons@^4.7.0": - version "4.8.3" - resolved "https://registry.yarnpkg.com/@ant-design/icons/-/icons-4.8.3.tgz#41555408ed5e9b0c3d53f3f24fe6a73abfcf4000" - integrity sha512-HGlIQZzrEbAhpJR6+IGdzfbPym94Owr6JZkJ2QCCnOkPVIWMO2xgIVcOKnl8YcpijIo39V7l2qQL5fmtw56cMw== +"@ant-design/icons@^5.5.2": + version "5.6.1" + resolved "https://registry.yarnpkg.com/@ant-design/icons/-/icons-5.6.1.tgz#7290fcdc3d96ff3fca793ed399053cd29ad5dbd3" + integrity sha512-0/xS39c91WjPAZOWsvi1//zjx6kAp4kxWwctR6kuU6p133w8RU0D2dSCvZC19uQyharg/sAvYxGYWl01BbZZfg== dependencies: - "@ant-design/colors" "^6.0.0" - "@ant-design/icons-svg" "^4.3.0" - "@babel/runtime" "^7.11.2" + "@ant-design/colors" "^7.0.0" + "@ant-design/icons-svg" "^4.4.0" + "@babel/runtime" "^7.24.8" classnames "^2.2.6" - lodash "^4.17.15" - rc-util "^5.9.4" + rc-util "^5.31.1" -"@ant-design/react-slick@~0.29.1": - version "0.29.2" - resolved "https://registry.yarnpkg.com/@ant-design/react-slick/-/react-slick-0.29.2.tgz#53e6a7920ea3562eebb304c15a7fc2d7e619d29c" - integrity sha512-kgjtKmkGHa19FW21lHnAfyyH9AAoh35pBdcJ53rHmQ3O+cfFHGHnUbj/HFrRNJ5vIts09FKJVAD8RpaC+RaWfA== +"@ant-design/react-slick@~1.1.2": + version "1.1.2" + resolved "https://registry.yarnpkg.com/@ant-design/react-slick/-/react-slick-1.1.2.tgz#f84ce3e4d0dc941f02b16f1d1d6d7a371ffbb4f1" + integrity sha512-EzlvzE6xQUBrZuuhSAFTdsr4P2bBBHGZwKFemEfq8gIGyIQCxalYfZW/T2ORbtQx5rU69o+WycP3exY/7T1hGA== dependencies: "@babel/runtime" "^7.10.4" classnames "^2.2.5" json2mq "^0.2.0" - lodash "^4.17.21" resize-observer-polyfill "^1.5.1" + throttle-debounce "^5.0.0" "@babel/code-frame@^7.24.7": version "7.24.7" @@ -248,13 +276,18 @@ core-js "^2.6.12" regenerator-runtime "^0.14.0" -"@babel/runtime@^7.0.0", "@babel/runtime@^7.10.1", "@babel/runtime@^7.10.4", "@babel/runtime@^7.11.1", "@babel/runtime@^7.11.2", "@babel/runtime@^7.12.13", "@babel/runtime@^7.12.5", "@babel/runtime@^7.16.7", "@babel/runtime@^7.18.0", "@babel/runtime@^7.18.3", "@babel/runtime@^7.20.0", "@babel/runtime@^7.20.7", "@babel/runtime@^7.21.0", "@babel/runtime@^7.9.2": +"@babel/runtime@^7.0.0", "@babel/runtime@^7.10.1", "@babel/runtime@^7.10.4", "@babel/runtime@^7.11.1", "@babel/runtime@^7.11.2", "@babel/runtime@^7.12.13", "@babel/runtime@^7.16.7", "@babel/runtime@^7.18.0", "@babel/runtime@^7.18.3", "@babel/runtime@^7.20.0", "@babel/runtime@^7.20.7", "@babel/runtime@^7.21.0", "@babel/runtime@^7.9.2": version "7.24.7" resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.24.7.tgz#f4f0d5530e8dbdf59b3451b9b3e594b6ba082e12" integrity sha512-UwgBRMjJP+xv857DCngvqXI3Iq6J4v0wXmwc6sapg+zyhbwmQX67LUEFrkK5tbyJ30jGuG3ZvWpBiB9LCy1kWw== dependencies: regenerator-runtime "^0.14.0" +"@babel/runtime@^7.22.5", "@babel/runtime@^7.23.2", "@babel/runtime@^7.23.6", "@babel/runtime@^7.23.9", "@babel/runtime@^7.24.4", "@babel/runtime@^7.24.7", "@babel/runtime@^7.24.8", "@babel/runtime@^7.25.7", "@babel/runtime@^7.26.0": + version "7.28.6" + resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.28.6.tgz#d267a43cb1836dc4d182cce93ae75ba954ef6d2b" + integrity sha512-05WQkdpL9COIMz4LjTxGpPNCdlpyimKppYNoJ5Di5EUObifl8t4tuLuUBBZEpoLYOmfvIWrsp9fCl0HoPRVTdA== + "@babel/template@^7.24.7": version "7.24.7" resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.24.7.tgz#02efcee317d0609d2c07117cb70ef8fb17ab7315" @@ -294,11 +327,6 @@ resolved "https://registry.yarnpkg.com/@colors/colors/-/colors-1.5.0.tgz#bb504579c1cae923e6576a4f5da43d25f97bdbd9" integrity sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ== -"@ctrl/tinycolor@^3.4.0": - version "3.6.1" - resolved "https://registry.yarnpkg.com/@ctrl/tinycolor/-/tinycolor-3.6.1.tgz#b6c75a56a1947cc916ea058772d666a2c8932f31" - integrity sha512-SITSV6aIXsuVNV3f3O0f2n/cgyEDWoSqtZMYiAmcsYHydcKrOz3gUxB/iXd/Qf08+IZX4KpgNbvUdMBmWz+kcA== - "@cypress/request@^3.0.0": version "3.0.1" resolved "https://registry.yarnpkg.com/@cypress/request/-/request-3.0.1.tgz#72d7d5425236a2413bd3d8bb66d02d9dc3168960" @@ -331,6 +359,11 @@ debug "^3.1.0" lodash.once "^4.1.1" +"@emotion/hash@^0.8.0": + version "0.8.0" + resolved "https://registry.yarnpkg.com/@emotion/hash/-/hash-0.8.0.tgz#bbbff68978fefdbe68ccb533bc8cbe1d1afb5413" + integrity sha512-kBJtf7PH6aWwZ6fka3zQ0p6SBYzx4fl1LoZXE2RrnYST9Xljm7WfKJrU4g/Xr3Beg72MLrp1AWNUmuYJTL7Cow== + "@emotion/is-prop-valid@^0.8.1": version "0.8.8" resolved "https://registry.yarnpkg.com/@emotion/is-prop-valid/-/is-prop-valid-0.8.8.tgz#db28b1c4368a259b60a97311d6a952d4fd01ac1a" @@ -343,7 +376,7 @@ resolved "https://registry.yarnpkg.com/@emotion/memoize/-/memoize-0.7.4.tgz#19bf0f5af19149111c40d98bb0cf82119f5d9eeb" integrity sha512-Ja/Vfqe3HpuzRsG1oBtWTHk2PGZ7GR+2Vz5iYGelAw8dx32K0y7PjVuxK6z1nMpZOqAFsRUPCkK1YjJ56qJlgw== -"@emotion/unitless@^0.7.0": +"@emotion/unitless@^0.7.0", "@emotion/unitless@^0.7.5": version "0.7.5" resolved "https://registry.yarnpkg.com/@emotion/unitless/-/unitless-0.7.5.tgz#77211291c1900a700b8a78cfafda3160d76949ed" integrity sha512-OWORNpfjMsSSUBVrRBVGECkhWcULOAJz9ZW8uK9qgxD+87M7jHRcvh/A96XXNhXTLmKcoYSQtBEX7lHMO7YRwg== @@ -500,14 +533,33 @@ resolved "https://registry.yarnpkg.com/@fortawesome/fontawesome-common-types/-/fontawesome-common-types-6.5.2.tgz#eaf2f5699f73cef198454ebc0c414e3688898179" integrity sha512-gBxPg3aVO6J0kpfHNILc+NMhXnqHumFxOmjYCFfOiLZfwhnnfhtsdA2hfJlDnj+8PjAs6kKQPenOTKj3Rf7zHw== -"@fortawesome/fontawesome-svg-core@^6.4.0", "@fortawesome/fontawesome-svg-core@^6.5.1": +"@fortawesome/fontawesome-common-types@6.7.2": + version "6.7.2" + resolved "https://registry.yarnpkg.com/@fortawesome/fontawesome-common-types/-/fontawesome-common-types-6.7.2.tgz#7123d74b0c1e726794aed1184795dbce12186470" + integrity sha512-Zs+YeHUC5fkt7Mg1l6XTniei3k4bwG/yo3iFUtZWd/pMx9g3fdvkSK9E0FOC+++phXOka78uJcYb8JaFkW52Xg== + +"@fortawesome/fontawesome-svg-core@6.7.2": + version "6.7.2" + resolved "https://registry.yarnpkg.com/@fortawesome/fontawesome-svg-core/-/fontawesome-svg-core-6.7.2.tgz#0ac6013724d5cc327c1eb81335b91300a4fce2f2" + integrity sha512-yxtOBWDrdi5DD5o1pmVdq3WMCvnobT0LU6R8RyyVXPvFRd2o79/0NCuQoCjNTeZz9EzA9xS3JxNWfv54RIHFEA== + dependencies: + "@fortawesome/fontawesome-common-types" "6.7.2" + +"@fortawesome/fontawesome-svg-core@^6.4.0": version "6.5.2" resolved "https://registry.yarnpkg.com/@fortawesome/fontawesome-svg-core/-/fontawesome-svg-core-6.5.2.tgz#4b42de71e196039b0d5ccf88559b8044e3296c21" integrity sha512-5CdaCBGl8Rh9ohNdxeeTMxIj8oc3KNBgIeLMvJosBMdslK/UnEB8rzyDRrbKdL1kDweqBPo4GT9wvnakHWucZw== dependencies: "@fortawesome/fontawesome-common-types" "6.5.2" -"@fortawesome/free-solid-svg-icons@^6.4.0", "@fortawesome/free-solid-svg-icons@^6.5.1", "@fortawesome/free-solid-svg-icons@^6.5.2": +"@fortawesome/free-solid-svg-icons@6.7.2": + version "6.7.2" + resolved "https://registry.yarnpkg.com/@fortawesome/free-solid-svg-icons/-/free-solid-svg-icons-6.7.2.tgz#fe25883b5eb8464a82918599950d283c465b57f6" + integrity sha512-GsBrnOzU8uj0LECDfD5zomZJIjrPhIlWU82AHwa2s40FKH+kcxQaBvBo3Z4TxyZHIyX8XTDxsyA33/Vx9eFuQA== + dependencies: + "@fortawesome/fontawesome-common-types" "6.7.2" + +"@fortawesome/free-solid-svg-icons@^6.4.0", "@fortawesome/free-solid-svg-icons@^6.5.1": version "6.5.2" resolved "https://registry.yarnpkg.com/@fortawesome/free-solid-svg-icons/-/free-solid-svg-icons-6.5.2.tgz#9b40b077b27400a5e9fcbf2d15b986c7be69e9ca" integrity sha512-QWFZYXFE7O1Gr1dTIp+D6UcFUF0qElOnZptpi7PBUMylJh+vFmIedVe1Ir6RM1t2tEQLLSV1k7bR4o92M+uqlw== @@ -634,18 +686,18 @@ resolved "https://registry.yarnpkg.com/@pkgjs/parseargs/-/parseargs-0.11.0.tgz#a77ea742fab25775145434eb1d2328cf5013ac33" integrity sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg== -"@radicalbit/radicalbit-design-system@1.0.0": - version "1.0.0" - resolved "https://registry.yarnpkg.com/@radicalbit/radicalbit-design-system/-/radicalbit-design-system-1.0.0.tgz#e89b4c574df9beb547c88b447783e05bfe987933" - integrity sha512-CGTAVJjBL8eVH+X3wOUmLlgMaxgPHIqV/UjmT9IvILEPQb/MQYXQMXpTcnMk6wcjawvSH0wUsctY/8wmBb2T+g== +"@radicalbit/radicalbit-design-system@2.13.1": + version "2.13.1" + resolved "https://registry.yarnpkg.com/@radicalbit/radicalbit-design-system/-/radicalbit-design-system-2.13.1.tgz#1017d2382033c24a1d5e795f58d67a9a1788bef0" + integrity sha512-QBR+UHDRfLh0TzRBnDLoKBKohgEGVb5vQ5rX4fsOTPe4BE1ZQ1x6H7srYZO1nHVRK6iumuAiQjkSki5ZbV2BbQ== dependencies: "@babel/polyfill" "7.12.1" - "@fortawesome/fontawesome-svg-core" "^6.5.1" + "@fortawesome/fontawesome-svg-core" "6.7.2" "@fortawesome/free-solid-svg-icons" "^6.5.1" "@fortawesome/react-fontawesome" "0.2.0" "@lucataglia/react-json-tree" "0.18.0" ace-builds "^1.4.12" - antd "4.24.10" + antd "5.23.2" classnames "^2.2.6" codemirror "^5.49.2" immutability-helper "^3.1.1" @@ -655,7 +707,7 @@ react "^18.2.0" react-ace "^9.4.0" react-codemirror2 "^6.0.0" - react-color "^2.19.3" + react-color "2.19.3" react-dnd "^14.0.3" react-dnd-html5-backend "^14.0.1" react-dom "^18.2.0" @@ -671,7 +723,48 @@ ts-loader "9.5.1" typescript "5.1.6" -"@rc-component/portal@^1.0.0-6", "@rc-component/portal@^1.0.0-8", "@rc-component/portal@^1.0.2": +"@rc-component/async-validator@^5.0.3": + version "5.1.0" + resolved "https://registry.yarnpkg.com/@rc-component/async-validator/-/async-validator-5.1.0.tgz#e81f31e676d9cadc71e4310bbf1749c7a5882291" + integrity sha512-n4HcR5siNUXRX23nDizbZBQPO0ZM/5oTtmKZ6/eqL0L2bo747cklFdZGRN2f+c9qWGICwDzrhW0H7tE9PptdcA== + dependencies: + "@babel/runtime" "^7.24.4" + +"@rc-component/color-picker@~2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@rc-component/color-picker/-/color-picker-2.0.1.tgz#6b9b96152466a9d4475cbe72b40b594bfda164be" + integrity sha512-WcZYwAThV/b2GISQ8F+7650r5ZZJ043E57aVBFkQ+kSY4C6wdofXgB0hBx+GPGpIU0Z81eETNoDUJMr7oy/P8Q== + dependencies: + "@ant-design/fast-color" "^2.0.6" + "@babel/runtime" "^7.23.6" + classnames "^2.2.6" + rc-util "^5.38.1" + +"@rc-component/context@^1.4.0": + version "1.4.0" + resolved "https://registry.yarnpkg.com/@rc-component/context/-/context-1.4.0.tgz#dc6fb021d6773546af8f016ae4ce9aea088395e8" + integrity sha512-kFcNxg9oLRMoL3qki0OMxK+7g5mypjgaaJp/pkOis/6rVxma9nJBF/8kCIuTYHUQNr0ii7MxqE33wirPZLJQ2w== + dependencies: + "@babel/runtime" "^7.10.1" + rc-util "^5.27.0" + +"@rc-component/mini-decimal@^1.0.1": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@rc-component/mini-decimal/-/mini-decimal-1.1.0.tgz#7b7a362b14a0a54cb5bc6fd2b82731f29f11d9b0" + integrity sha512-jS4E7T9Li2GuYwI6PyiVXmxTiM6b07rlD9Ge8uGZSCz3WlzcG5ZK7g5bbuKNeZ9pgUuPK/5guV781ujdVpm4HQ== + dependencies: + "@babel/runtime" "^7.18.0" + +"@rc-component/mutate-observer@^1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@rc-component/mutate-observer/-/mutate-observer-1.1.0.tgz#ee53cc88b78aade3cd0653609215a44779386fd8" + integrity sha512-QjrOsDXQusNwGZPf4/qRQasg7UFEj06XiCJ8iuiq/Io7CrHrgVi6Uuetw60WAMG1799v+aM8kyc+1L/GBbHSlw== + dependencies: + "@babel/runtime" "^7.18.0" + classnames "^2.3.2" + rc-util "^5.24.4" + +"@rc-component/portal@^1.0.0-8", "@rc-component/portal@^1.0.0-9", "@rc-component/portal@^1.0.2", "@rc-component/portal@^1.1.0", "@rc-component/portal@^1.1.1": version "1.1.2" resolved "https://registry.yarnpkg.com/@rc-component/portal/-/portal-1.1.2.tgz#55db1e51d784e034442e9700536faaa6ab63fc71" integrity sha512-6f813C0IsasTZms08kfA8kPAGxbbkYToa8ALaiDIGGECU4i9hj8Plgbx0sNJDrey3EtHO30hmdaxtT0138xZcg== @@ -680,6 +773,37 @@ classnames "^2.3.2" rc-util "^5.24.4" +"@rc-component/qrcode@~1.0.0": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@rc-component/qrcode/-/qrcode-1.0.1.tgz#98e0a79dc95f26fe211b59d04ef3312bc70dedbe" + integrity sha512-g8eeeaMyFXVlq8cZUeaxCDhfIYjpao0l9cvm5gFwKXy/Vm1yDWV7h2sjH5jHYzdFedlVKBpATFB1VKMrHzwaWQ== + dependencies: + "@babel/runtime" "^7.24.7" + classnames "^2.3.2" + +"@rc-component/tour@~1.15.1": + version "1.15.1" + resolved "https://registry.yarnpkg.com/@rc-component/tour/-/tour-1.15.1.tgz#9b79808254185fc19e964172d99e25e8c6800ded" + integrity sha512-Tr2t7J1DKZUpfJuDZWHxyxWpfmj8EZrqSgyMZ+BCdvKZ6r1UDsfU46M/iWAAFBy961Ssfom2kv5f3UcjIL2CmQ== + dependencies: + "@babel/runtime" "^7.18.0" + "@rc-component/portal" "^1.0.0-9" + "@rc-component/trigger" "^2.0.0" + classnames "^2.3.2" + rc-util "^5.24.4" + +"@rc-component/trigger@^2.0.0", "@rc-component/trigger@^2.1.1", "@rc-component/trigger@^2.2.6": + version "2.3.1" + resolved "https://registry.yarnpkg.com/@rc-component/trigger/-/trigger-2.3.1.tgz#83fc0c4165a58fdc66bd9171082d08acf31be6bb" + integrity sha512-ORENF39PeXTzM+gQEshuk460Z8N4+6DkjpxlpE7Q3gYy1iBpLrx0FOJz3h62ryrJZ/3zCAUIkT1Pb/8hHWpb3A== + dependencies: + "@babel/runtime" "^7.23.2" + "@rc-component/portal" "^1.1.0" + classnames "^2.3.2" + rc-motion "^2.0.0" + rc-resize-observer "^1.3.1" + rc-util "^5.44.0" + "@react-dnd/asap@^4.0.0": version "4.0.1" resolved "https://registry.yarnpkg.com/@react-dnd/asap/-/asap-4.0.1.tgz#5291850a6b58ce6f2da25352a64f1b0674871aab" @@ -1086,54 +1210,60 @@ ansi-styles@^6.1.0: resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-6.2.1.tgz#0e62320cf99c21afff3b3012192546aacbfb05c5" integrity sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug== -antd@4.24.10: - version "4.24.10" - resolved "https://registry.yarnpkg.com/antd/-/antd-4.24.10.tgz#9bf371c3b351b881c5b56049a410d5cf16f077ac" - integrity sha512-GihdwTGFW0dUaWjcvSIfejFcT63HjEp2EbYd+ojEXayldhey230KrHDJ+C53rkrkzLvymrPBfSxlLxJzyFIZsg== - dependencies: - "@ant-design/colors" "^6.0.0" - "@ant-design/icons" "^4.7.0" - "@ant-design/react-slick" "~0.29.1" - "@babel/runtime" "^7.18.3" - "@ctrl/tinycolor" "^3.4.0" - classnames "^2.2.6" - copy-to-clipboard "^3.2.0" - lodash "^4.17.21" - moment "^2.29.2" - rc-cascader "~3.7.0" - rc-checkbox "~3.0.0" - rc-collapse "~3.4.2" - rc-dialog "~9.0.2" - rc-drawer "~6.1.0" - rc-dropdown "~4.0.0" - rc-field-form "~1.27.0" - rc-image "~5.13.0" - rc-input "~0.1.4" - rc-input-number "~7.3.9" - rc-mentions "~1.13.1" - rc-menu "~9.8.0" - rc-motion "^2.6.1" - rc-notification "~4.6.0" - rc-pagination "~3.2.0" - rc-picker "~2.7.0" - rc-progress "~3.4.1" - rc-rate "~2.9.0" - rc-resize-observer "^1.2.0" - rc-segmented "~2.1.0" - rc-select "~14.1.17" - rc-slider "~10.0.0" - rc-steps "~5.0.0-alpha.2" - rc-switch "~3.2.0" - rc-table "~7.26.0" - rc-tabs "~12.5.6" - rc-textarea "~0.4.5" - rc-tooltip "~5.2.0" - rc-tree "~5.7.0" - rc-tree-select "~5.5.0" - rc-trigger "^5.2.10" - rc-upload "~4.3.0" - rc-util "^5.22.5" - scroll-into-view-if-needed "^2.2.25" +antd@5.23.2: + version "5.23.2" + resolved "https://registry.yarnpkg.com/antd/-/antd-5.23.2.tgz#c052a78b9109b77674760288fae24182fccf0c56" + integrity sha512-h39z/uSeNvF3FtSMytle58s68zQFXJ+XuLm31l6mPBBq99tUSxO9b1Wfnw7b8Q5Mfl4hsXjoz85+/jIRGfYJ5Q== + dependencies: + "@ant-design/colors" "^7.2.0" + "@ant-design/cssinjs" "^1.22.0" + "@ant-design/cssinjs-utils" "^1.1.3" + "@ant-design/fast-color" "^2.0.6" + "@ant-design/icons" "^5.5.2" + "@ant-design/react-slick" "~1.1.2" + "@babel/runtime" "^7.26.0" + "@rc-component/color-picker" "~2.0.1" + "@rc-component/mutate-observer" "^1.1.0" + "@rc-component/qrcode" "~1.0.0" + "@rc-component/tour" "~1.15.1" + "@rc-component/trigger" "^2.2.6" + classnames "^2.5.1" + copy-to-clipboard "^3.3.3" + dayjs "^1.11.11" + rc-cascader "~3.33.0" + rc-checkbox "~3.5.0" + rc-collapse "~3.9.0" + rc-dialog "~9.6.0" + rc-drawer "~7.2.0" + rc-dropdown "~4.2.1" + rc-field-form "~2.7.0" + rc-image "~7.11.0" + rc-input "~1.7.2" + rc-input-number "~9.4.0" + rc-mentions "~2.19.1" + rc-menu "~9.16.0" + rc-motion "^2.9.5" + rc-notification "~5.6.2" + rc-pagination "~5.0.0" + rc-picker "~4.9.2" + rc-progress "~4.0.0" + rc-rate "~2.13.0" + rc-resize-observer "^1.4.3" + rc-segmented "~2.7.0" + rc-select "~14.16.6" + rc-slider "~11.1.8" + rc-steps "~6.0.1" + rc-switch "~4.1.0" + rc-table "~7.50.2" + rc-tabs "~15.5.0" + rc-textarea "~1.9.0" + rc-tooltip "~6.3.2" + rc-tree "~5.13.0" + rc-tree-select "~5.27.0" + rc-upload "~4.8.1" + rc-util "^5.44.3" + scroll-into-view-if-needed "^3.1.0" + throttle-debounce "^5.0.2" any-promise@^1.0.0: version "1.3.0" @@ -1163,11 +1293,6 @@ argparse@^2.0.1: resolved "https://registry.yarnpkg.com/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38" integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q== -array-tree-filter@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/array-tree-filter/-/array-tree-filter-2.1.0.tgz#873ac00fec83749f255ac8dd083814b4f6329190" - integrity sha512-4ROwICNlNw/Hqa9v+rk5h22KjmzB1JGTMVKP2AKJBOCgb0yL0ASf0+YvCcLNNwquOHNX48jkeZIJ3a+oOQqKcw== - array-union@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/array-union/-/array-union-2.1.0.tgz#b798420adbeb1de828d84acd8a2e23d3efe85e8d" @@ -1190,11 +1315,6 @@ astral-regex@^2.0.0: resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-2.0.0.tgz#483143c567aeed4785759c0865786dc77d7d2e31" integrity sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ== -async-validator@^4.1.0: - version "4.2.5" - resolved "https://registry.yarnpkg.com/async-validator/-/async-validator-4.2.5.tgz#c96ea3332a521699d0afaaceed510a54656c6339" - integrity sha512-7HhHjtERjqlNbZtqNqy2rckN/SpOOlmDliet+lP7k+eKZEjPk3DgyeU9lIXLdeLz0uBbbVp+9Qdow9wJWgwwfg== - async@^3.2.0: version "3.2.5" resolved "https://registry.yarnpkg.com/async/-/async-3.2.5.tgz#ebd52a8fdaf7a2289a24df399f8d8485c8a46b66" @@ -1436,7 +1556,7 @@ classnames@2.3.1: resolved "https://registry.yarnpkg.com/classnames/-/classnames-2.3.1.tgz#dfcfa3891e306ec1dad105d0e88f4417b8535e8e" integrity sha512-OlQdbZ7gLfGarSqxesMesDa5uz7KFbID8Kpq/SxIoNGDqY8lSYs0D+hhtBXhcdB3rcbXArFr7vlHheLk1voeNA== -classnames@2.x, classnames@^2.2.1, classnames@^2.2.3, classnames@^2.2.5, classnames@^2.2.6, classnames@^2.3.1, classnames@^2.3.2: +classnames@2.x, classnames@^2.2.1, classnames@^2.2.3, classnames@^2.2.5, classnames@^2.2.6, classnames@^2.3.1, classnames@^2.3.2, classnames@^2.5.1: version "2.5.1" resolved "https://registry.yarnpkg.com/classnames/-/classnames-2.5.1.tgz#ba774c614be0f016da105c858e7159eae8e7687b" integrity sha512-saHYOzhIQs6wy2sVxTM6bUDsQO4F50V9RQ22qBpEdCW+I+/Wmke2HOl6lS6dTpdxVhb88/I6+Hs+438c3lfUow== @@ -1547,10 +1667,10 @@ common-tags@^1.8.0: resolved "https://registry.yarnpkg.com/common-tags/-/common-tags-1.8.2.tgz#94ebb3c076d26032745fd54face7f688ef5ac9c6" integrity sha512-gk/Z852D2Wtb//0I+kRFNKKE9dIIVirjoqPoA1wJU+XePVXZfGeBpk45+A1rKO4Q43prqWBNY/MiIeRLbPWUaA== -compute-scroll-into-view@^1.0.20: - version "1.0.20" - resolved "https://registry.yarnpkg.com/compute-scroll-into-view/-/compute-scroll-into-view-1.0.20.tgz#1768b5522d1172754f5d0c9b02de3af6be506a43" - integrity sha512-UCB0ioiyj8CRjtrvaceBLqqhZCVP+1B8+NWQhmdsm0VXOJtobBCf1dBQmebCCo34qZmUwZfIH2MZLqNHazrfjg== +compute-scroll-into-view@^3.0.2: + version "3.1.1" + resolved "https://registry.yarnpkg.com/compute-scroll-into-view/-/compute-scroll-into-view-3.1.1.tgz#02c3386ec531fb6a9881967388e53e8564f3e9aa" + integrity sha512-VRhuHOLoKYOy4UbilLbUzbYg93XLjv2PncJC50EuTWPA3gaja1UjBsUP/D/9/juV3vQFr6XBEzn9KCAHdUvOHw== concat-map@0.0.1: version "0.0.1" @@ -1562,7 +1682,7 @@ convert-source-map@^2.0.0: resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-2.0.0.tgz#4b560f649fc4e918dd0ab75cf4961e8bc882d82a" integrity sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg== -copy-to-clipboard@^3.2.0: +copy-to-clipboard@^3.3.3: version "3.3.3" resolved "https://registry.yarnpkg.com/copy-to-clipboard/-/copy-to-clipboard-3.3.3.tgz#55ac43a1db8ae639a4bd99511c148cdd1b83a1b0" integrity sha512-2KV8NhB5JqC3ky0r9PMCAZKbUHSwtEo4CwCs0KXgruG43gX5PMqDEBbVU4OUzw2MuAWUfsuFmWvEKG5QRfSnJA== @@ -1612,6 +1732,11 @@ csstype@^3.0.10, csstype@^3.0.2: resolved "https://registry.yarnpkg.com/csstype/-/csstype-3.1.3.tgz#d80ff294d114fb0e6ac500fbf85b60137d7eff81" integrity sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw== +csstype@^3.1.3: + version "3.2.3" + resolved "https://registry.yarnpkg.com/csstype/-/csstype-3.2.3.tgz#ec48c0f3e993e50648c86da559e2610995cf989a" + integrity sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ== + cypress@^13.7.3: version "13.12.0" resolved "https://registry.yarnpkg.com/cypress/-/cypress-13.12.0.tgz#1a4ea89b7fa6855e32bc02eaf5e25fc45b9e273f" @@ -1667,18 +1792,16 @@ dashdash@^1.12.0: dependencies: assert-plus "^1.0.0" -date-fns@2.x: - version "2.30.0" - resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-2.30.0.tgz#f367e644839ff57894ec6ac480de40cae4b0f4d0" - integrity sha512-fnULvOpxnC5/Vg3NCiWelDsLiUc9bRwAPs/+LfTLNvetFCtCTN+yQz15C/fs4AwX1R9K5GLtLfn8QW+dWisaAw== - dependencies: - "@babel/runtime" "^7.21.0" - -dayjs@1.x, dayjs@^1.10.4: +dayjs@^1.10.4: version "1.11.11" resolved "https://registry.yarnpkg.com/dayjs/-/dayjs-1.11.11.tgz#dfe0e9d54c5f8b68ccf8ca5f72ac603e7e5ed59e" integrity sha512-okzr3f11N6WuqYtZSvm+F776mB41wRZMhKP+hc34YdW+KmtYYK9iqvHSwo2k9FEH3fhGXvOPV6yz2IcSrfRUDg== +dayjs@^1.11.11: + version "1.11.19" + resolved "https://registry.yarnpkg.com/dayjs/-/dayjs-1.11.19.tgz#15dc98e854bb43917f12021806af897c58ae2938" + integrity sha512-t5EcLVS6QPBNqM2z8fakk/NKel+Xzshgt8FFKAn+qwlD1pzZWxh0nVCrvFK7ZDb6XucZeF9z8C7CBWTRIVApAw== + debug@^3.1.0: version "3.2.7" resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.7.tgz#72580b7e9145fb39b6676f9c5e5fb100b934179a" @@ -1774,11 +1897,6 @@ doctrine@^3.0.0: dependencies: esutils "^2.0.2" -dom-align@^1.7.0: - version "1.12.4" - resolved "https://registry.yarnpkg.com/dom-align/-/dom-align-1.12.4.tgz#3503992eb2a7cfcb2ed3b2a6d21e0b9c00d54511" - integrity sha512-R8LUSEay/68zE5c8/3BDxiTEvgb4xZTF0RKmAHfiEVN3klfIpXfi2/QCoiWPccVQ0J/ZGdz9OjzL4uJEP/MRAw== - dom-walk@^0.1.0: version "0.1.2" resolved "https://registry.yarnpkg.com/dom-walk/-/dom-walk-0.1.2.tgz#0c548bef048f4d1f2a97249002236060daa3fd84" @@ -3394,7 +3512,7 @@ minimist@^1.2.8: resolved "https://registry.yarnpkg.com/minipass/-/minipass-7.1.2.tgz#93a9626ce5e5e66bd4db86849e7515e92340a707" integrity sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw== -moment@^2.24.0, moment@^2.29.2: +moment@^2.24.0: version "2.30.1" resolved "https://registry.yarnpkg.com/moment/-/moment-2.30.1.tgz#f8c91c07b7a786e30c59926df530b4eac96974ae" integrity sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how== @@ -3776,53 +3894,40 @@ queue-microtask@^1.2.2: resolved "https://registry.yarnpkg.com/queue-microtask/-/queue-microtask-1.2.3.tgz#4929228bbc724dfac43e0efb058caf7b6cfb6243" integrity sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A== -rc-align@^4.0.0: - version "4.0.15" - resolved "https://registry.yarnpkg.com/rc-align/-/rc-align-4.0.15.tgz#2bbd665cf85dfd0b0244c5a752b07565e9098577" - integrity sha512-wqJtVH60pka/nOX7/IspElA8gjPNQKIx/ZqJ6heATCkXpe1Zg4cPVrMD2vC96wjsFFL8WsmhPbx9tdMo1qqlIA== - dependencies: - "@babel/runtime" "^7.10.1" - classnames "2.x" - dom-align "^1.7.0" - rc-util "^5.26.0" - resize-observer-polyfill "^1.5.1" - -rc-cascader@~3.7.0: - version "3.7.3" - resolved "https://registry.yarnpkg.com/rc-cascader/-/rc-cascader-3.7.3.tgz#1e2ad238b283f7226ce4c9f3a420a35cb63fcc82" - integrity sha512-KBpT+kzhxDW+hxPiNk4zaKa99+Lie2/8nnI11XF+FIOPl4Bj9VlFZi61GrnWzhLGA7VEN+dTxAkNOjkySDa0dA== +rc-cascader@~3.33.0: + version "3.33.1" + resolved "https://registry.yarnpkg.com/rc-cascader/-/rc-cascader-3.33.1.tgz#19e01462ef5ef51b723c1f562c7b9cde4691e7ee" + integrity sha512-Kyl4EJ7ZfCBuidmZVieegcbFw0RcU5bHHSbtEdmuLYd0fYHCAiYKZ6zon7fWAVyC6rWWOOib0XKdTSf7ElC9rg== dependencies: - "@babel/runtime" "^7.12.5" - array-tree-filter "^2.1.0" + "@babel/runtime" "^7.25.7" classnames "^2.3.1" - rc-select "~14.1.0" - rc-tree "~5.7.0" - rc-util "^5.6.1" + rc-select "~14.16.2" + rc-tree "~5.13.0" + rc-util "^5.43.0" -rc-checkbox@~3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/rc-checkbox/-/rc-checkbox-3.0.1.tgz#f978771329be339d479cd81465eb2e2f8c82bc87" - integrity sha512-k7nxDWxYF+jDI0ZcCvuvj71xONmWRVe5+1MKcERRR9MRyP3tZ69b+yUCSXXh+sik4/Hc9P5wHr2nnUoGS2zBjA== +rc-checkbox@~3.5.0: + version "3.5.0" + resolved "https://registry.yarnpkg.com/rc-checkbox/-/rc-checkbox-3.5.0.tgz#3ae2441e3a321774d390f76539e706864fcf5ff0" + integrity sha512-aOAQc3E98HteIIsSqm6Xk2FPKIER6+5vyEFMZfo73TqM+VVAIqOkHoPjgKLqSNtVLWScoaM7vY2ZrGEheI79yg== dependencies: "@babel/runtime" "^7.10.1" classnames "^2.3.2" rc-util "^5.25.2" -rc-collapse@~3.4.2: - version "3.4.2" - resolved "https://registry.yarnpkg.com/rc-collapse/-/rc-collapse-3.4.2.tgz#1310be7ad4cd0dcfc622c45f6c3b5ffdee403ad7" - integrity sha512-jpTwLgJzkhAgp2Wpi3xmbTbbYExg6fkptL67Uu5LCRVEj6wqmy0DHTjjeynsjOLsppHGHu41t1ELntZ0lEvS/Q== +rc-collapse@~3.9.0: + version "3.9.0" + resolved "https://registry.yarnpkg.com/rc-collapse/-/rc-collapse-3.9.0.tgz#972404ce7724e1c9d1d2476543e1175404a36806" + integrity sha512-swDdz4QZ4dFTo4RAUMLL50qP0EY62N2kvmk2We5xYdRwcRn8WcYtuetCJpwpaCbUfUt5+huLpVxhvmnK+PHrkA== dependencies: "@babel/runtime" "^7.10.1" classnames "2.x" rc-motion "^2.3.4" - rc-util "^5.2.1" - shallowequal "^1.1.0" + rc-util "^5.27.0" -rc-dialog@~9.0.0, rc-dialog@~9.0.2: - version "9.0.2" - resolved "https://registry.yarnpkg.com/rc-dialog/-/rc-dialog-9.0.2.tgz#aadfebdeba145f256c1fac9b9f509f893cdbb5b8" - integrity sha512-s3U+24xWUuB6Bn2Lk/Qt6rufy+uT+QvWkiFhNBcO9APLxcFFczWamaq7x9h8SCuhfc1nHcW4y8NbMsnAjNnWyg== +rc-dialog@~9.6.0: + version "9.6.0" + resolved "https://registry.yarnpkg.com/rc-dialog/-/rc-dialog-9.6.0.tgz#dc7a255c6ad1cb56021c3a61c7de86ee88c7c371" + integrity sha512-ApoVi9Z8PaCQg6FsUzS8yvBEQy0ZL2PkuvAgrmohPkN3okps5WZ5WQWPc1RNuiOKaAYv8B97ACdsFU5LizzCqg== dependencies: "@babel/runtime" "^7.10.1" "@rc-component/portal" "^1.0.0-8" @@ -3830,91 +3935,94 @@ rc-dialog@~9.0.0, rc-dialog@~9.0.2: rc-motion "^2.3.0" rc-util "^5.21.0" -rc-drawer@~6.1.0: - version "6.1.6" - resolved "https://registry.yarnpkg.com/rc-drawer/-/rc-drawer-6.1.6.tgz#263afcf11000b56438fe1c59649a8796dfbb2b44" - integrity sha512-EBRFM9o3lPU5kYh8sFoXYA9KxpdT765HDqj/AbZWicXkhwEYUH7MjUH0ctenPCiHBxXQUgIUvK14+6rPuURd6w== +rc-drawer@~7.2.0: + version "7.2.0" + resolved "https://registry.yarnpkg.com/rc-drawer/-/rc-drawer-7.2.0.tgz#8d7de2f1fd52f3ac5a25f54afbb8ac14c62e5663" + integrity sha512-9lOQ7kBekEJRdEpScHvtmEtXnAsy+NGDXiRWc2ZVC7QXAazNVbeT4EraQKYwCME8BJLa8Bxqxvs5swwyOepRwg== dependencies: - "@babel/runtime" "^7.10.1" - "@rc-component/portal" "^1.0.0-6" + "@babel/runtime" "^7.23.9" + "@rc-component/portal" "^1.1.1" classnames "^2.2.6" rc-motion "^2.6.1" - rc-util "^5.21.2" + rc-util "^5.38.1" -rc-dropdown@~4.0.0: - version "4.0.1" - resolved "https://registry.yarnpkg.com/rc-dropdown/-/rc-dropdown-4.0.1.tgz#f65d9d3d89750241057db59d5a75e43cd4576b68" - integrity sha512-OdpXuOcme1rm45cR0Jzgfl1otzmU4vuBVb+etXM8vcaULGokAKVpKlw8p6xzspG7jGd/XxShvq+N3VNEfk/l5g== +rc-dropdown@~4.2.0, rc-dropdown@~4.2.1: + version "4.2.1" + resolved "https://registry.yarnpkg.com/rc-dropdown/-/rc-dropdown-4.2.1.tgz#44729eb2a4272e0353d31ac060da21e606accb1c" + integrity sha512-YDAlXsPv3I1n42dv1JpdM7wJ+gSUBfeyPK59ZpBD9jQhK9jVuxpjj3NmWQHOBceA1zEPVX84T2wbdb2SD0UjmA== dependencies: "@babel/runtime" "^7.18.3" + "@rc-component/trigger" "^2.0.0" classnames "^2.2.6" - rc-trigger "^5.3.1" - rc-util "^5.17.0" + rc-util "^5.44.1" -rc-field-form@~1.27.0: - version "1.27.4" - resolved "https://registry.yarnpkg.com/rc-field-form/-/rc-field-form-1.27.4.tgz#53600714af5b28c226c70d34867a8c52ccd64d44" - integrity sha512-PQColQnZimGKArnOh8V2907+VzDCXcqtFvHgevDLtqWc/P7YASb/FqntSmdS8q3VND5SHX3Y1vgMIzY22/f/0Q== +rc-field-form@~2.7.0: + version "2.7.1" + resolved "https://registry.yarnpkg.com/rc-field-form/-/rc-field-form-2.7.1.tgz#8bb1d7c6bf40e2b99b494816972252c327d9b5a0" + integrity sha512-vKeSifSJ6HoLaAB+B8aq/Qgm8a3dyxROzCtKNCsBQgiverpc4kWDQihoUwzUj+zNWJOykwSY4dNX3QrGwtVb9A== dependencies: "@babel/runtime" "^7.18.0" - async-validator "^4.1.0" - rc-util "^5.8.0" + "@rc-component/async-validator" "^5.0.3" + rc-util "^5.32.2" -rc-image@~5.13.0: - version "5.13.0" - resolved "https://registry.yarnpkg.com/rc-image/-/rc-image-5.13.0.tgz#1ed9b852a40b5eff34786ba7d2f0e9d26eeab874" - integrity sha512-iZTOmw5eWo2+gcrJMMcnd7SsxVHl3w5xlyCgsULUdJhJbnuI8i/AL0tVOsE7aLn9VfOh1qgDT3mC2G75/c7mqg== +rc-image@~7.11.0: + version "7.11.1" + resolved "https://registry.yarnpkg.com/rc-image/-/rc-image-7.11.1.tgz#3ab290708dc053d3681de94186522e4e594f6772" + integrity sha512-XuoWx4KUXg7hNy5mRTy1i8c8p3K8boWg6UajbHpDXS5AlRVucNfTi5YxTtPBTBzegxAZpvuLfh3emXFt6ybUdA== dependencies: "@babel/runtime" "^7.11.2" "@rc-component/portal" "^1.0.2" classnames "^2.2.6" - rc-dialog "~9.0.0" + rc-dialog "~9.6.0" rc-motion "^2.6.2" - rc-util "^5.0.6" + rc-util "^5.34.1" -rc-input-number@~7.3.9: - version "7.3.11" - resolved "https://registry.yarnpkg.com/rc-input-number/-/rc-input-number-7.3.11.tgz#c7089705a220e1a59ba974fabf89693e00dd2442" - integrity sha512-aMWPEjFeles6PQnMqP5eWpxzsvHm9rh1jQOWXExUEIxhX62Fyl/ptifLHOn17+waDG1T/YUb6flfJbvwRhHrbA== +rc-input-number@~9.4.0: + version "9.4.0" + resolved "https://registry.yarnpkg.com/rc-input-number/-/rc-input-number-9.4.0.tgz#65caf04f1b6d05f47e141b1f5f484724c1f7fd5a" + integrity sha512-Tiy4DcXcFXAf9wDhN8aUAyMeCLHJUHA/VA/t7Hj8ZEx5ETvxG7MArDOSE6psbiSCo+vJPm4E3fGN710ITVn6GA== dependencies: "@babel/runtime" "^7.10.1" + "@rc-component/mini-decimal" "^1.0.1" classnames "^2.2.5" - rc-util "^5.23.0" + rc-input "~1.7.1" + rc-util "^5.40.1" -rc-input@~0.1.4: - version "0.1.4" - resolved "https://registry.yarnpkg.com/rc-input/-/rc-input-0.1.4.tgz#45cb4ba209ae6cc835a2acb8629d4f8f0cb347e0" - integrity sha512-FqDdNz+fV2dKNgfXzcSLKvC+jEs1709t7nD+WdfjrdSaOcefpgc7BUJYadc3usaING+b7ediMTfKxuJBsEFbXA== +rc-input@~1.7.1, rc-input@~1.7.2: + version "1.7.3" + resolved "https://registry.yarnpkg.com/rc-input/-/rc-input-1.7.3.tgz#cb334a17b93ce985bceb243b4c111a5ed641e0e3" + integrity sha512-A5w4egJq8+4JzlQ55FfQjDnPvOaAbzwC3VLOAdOytyek3TboSOP9qxN+Gifup+shVXfvecBLBbWBpWxmk02SWQ== dependencies: "@babel/runtime" "^7.11.1" classnames "^2.2.1" rc-util "^5.18.1" -rc-mentions@~1.13.1: - version "1.13.1" - resolved "https://registry.yarnpkg.com/rc-mentions/-/rc-mentions-1.13.1.tgz#c884b70e1505a197f1b32a7c6b39090db6992a72" - integrity sha512-FCkaWw6JQygtOz0+Vxz/M/NWqrWHB9LwqlY2RtcuFqWJNFK9njijOOzTSsBGANliGufVUzx/xuPHmZPBV0+Hgw== +rc-mentions@~2.19.1: + version "2.19.1" + resolved "https://registry.yarnpkg.com/rc-mentions/-/rc-mentions-2.19.1.tgz#3fd0dd0bf3dd63afdb6a21750cbae81f3824b9c4" + integrity sha512-KK3bAc/bPFI993J3necmaMXD2reZTzytZdlTvkeBbp50IGH1BDPDvxLdHDUrpQx2b2TGaVJsn+86BvYa03kGqA== dependencies: - "@babel/runtime" "^7.10.1" + "@babel/runtime" "^7.22.5" + "@rc-component/trigger" "^2.0.0" classnames "^2.2.6" - rc-menu "~9.8.0" - rc-textarea "^0.4.0" - rc-trigger "^5.0.4" - rc-util "^5.22.5" + rc-input "~1.7.1" + rc-menu "~9.16.0" + rc-textarea "~1.9.0" + rc-util "^5.34.1" -rc-menu@~9.8.0: - version "9.8.4" - resolved "https://registry.yarnpkg.com/rc-menu/-/rc-menu-9.8.4.tgz#58bf19d471e3c74ff4bcfdb0f02a3826ebe2553b" - integrity sha512-lmw2j8I2fhdIzHmC9ajfImfckt0WDb2KVJJBBRIsxPEw2kGkEfjLMUoB1NgiNT/Q5cC8PdjGOGQjHJIJMwyNMw== +rc-menu@~9.16.0: + version "9.16.1" + resolved "https://registry.yarnpkg.com/rc-menu/-/rc-menu-9.16.1.tgz#9df1168e41d87dc7164c582173e1a1d32011899f" + integrity sha512-ghHx6/6Dvp+fw8CJhDUHFHDJ84hJE3BXNCzSgLdmNiFErWSOaZNsihDAsKq9ByTALo/xkNIwtDFGIl6r+RPXBg== dependencies: "@babel/runtime" "^7.10.1" + "@rc-component/trigger" "^2.0.0" classnames "2.x" rc-motion "^2.4.3" - rc-overflow "^1.2.8" - rc-trigger "^5.1.2" + rc-overflow "^1.3.1" rc-util "^5.27.0" -rc-motion@^2.0.0, rc-motion@^2.0.1, rc-motion@^2.2.0, rc-motion@^2.3.0, rc-motion@^2.3.4, rc-motion@^2.4.3, rc-motion@^2.4.4, rc-motion@^2.6.1, rc-motion@^2.6.2: +rc-motion@^2.0.0, rc-motion@^2.0.1, rc-motion@^2.3.0, rc-motion@^2.3.4, rc-motion@^2.4.3, rc-motion@^2.4.4, rc-motion@^2.6.1, rc-motion@^2.6.2: version "2.9.2" resolved "https://registry.yarnpkg.com/rc-motion/-/rc-motion-2.9.2.tgz#f7c6d480250df8a512d0cfdce07ff3da906958cf" integrity sha512-fUAhHKLDdkAXIDLH0GYwof3raS58dtNUmzLF2MeiR8o6n4thNpSDQhOqQzWE4WfFZDCi9VEN8n7tiB7czREcyw== @@ -3923,67 +4031,75 @@ rc-motion@^2.0.0, rc-motion@^2.0.1, rc-motion@^2.2.0, rc-motion@^2.3.0, rc-motio classnames "^2.2.1" rc-util "^5.43.0" -rc-notification@~4.6.0: - version "4.6.1" - resolved "https://registry.yarnpkg.com/rc-notification/-/rc-notification-4.6.1.tgz#068e8674f4bd7926a447eca512915d4b41b15c91" - integrity sha512-NSmFYwrrdY3+un1GvDAJQw62Xi9LNMSsoQyo95tuaYrcad5Bn9gJUL8AREufRxSQAQnr64u3LtP3EUyLYT6bhw== +rc-motion@^2.9.0, rc-motion@^2.9.5: + version "2.9.5" + resolved "https://registry.yarnpkg.com/rc-motion/-/rc-motion-2.9.5.tgz#12c6ead4fd355f94f00de9bb4f15df576d677e0c" + integrity sha512-w+XTUrfh7ArbYEd2582uDrEhmBHwK1ZENJiSJVb7uRxdE7qJSYjbO2eksRXmndqyKqKoYPc9ClpPh5242mV1vA== + dependencies: + "@babel/runtime" "^7.11.1" + classnames "^2.2.1" + rc-util "^5.44.0" + +rc-notification@~5.6.2: + version "5.6.4" + resolved "https://registry.yarnpkg.com/rc-notification/-/rc-notification-5.6.4.tgz#ea89c39c13cd517fdfd97fe63f03376fabb78544" + integrity sha512-KcS4O6B4qzM3KH7lkwOB7ooLPZ4b6J+VMmQgT51VZCeEcmghdeR4IrMcFq0LG+RPdnbe/ArT086tGM8Snimgiw== dependencies: "@babel/runtime" "^7.10.1" classnames "2.x" - rc-motion "^2.2.0" + rc-motion "^2.9.0" rc-util "^5.20.1" -rc-overflow@^1.0.0, rc-overflow@^1.2.8: - version "1.3.2" - resolved "https://registry.yarnpkg.com/rc-overflow/-/rc-overflow-1.3.2.tgz#72ee49e85a1308d8d4e3bd53285dc1f3e0bcce2c" - integrity sha512-nsUm78jkYAoPygDAcGZeC2VwIg/IBGSodtOY3pMof4W3M9qRJgqaDYm03ZayHlde3I6ipliAxbN0RUcGf5KOzw== +rc-overflow@^1.3.1, rc-overflow@^1.3.2: + version "1.5.0" + resolved "https://registry.yarnpkg.com/rc-overflow/-/rc-overflow-1.5.0.tgz#02e58a15199e392adfcc87e0d6e9e7c8e57f2771" + integrity sha512-Lm/v9h0LymeUYJf0x39OveU52InkdRXqnn2aYXfWmo8WdOonIKB2kfau+GF0fWq6jPgtdO9yMqveGcK6aIhJmg== dependencies: "@babel/runtime" "^7.11.1" classnames "^2.2.1" rc-resize-observer "^1.0.0" rc-util "^5.37.0" -rc-pagination@~3.2.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/rc-pagination/-/rc-pagination-3.2.0.tgz#4f2fdba9fdac0f48e5c9fb1141973818138af7e1" - integrity sha512-5tIXjB670WwwcAJzAqp2J+cOBS9W3cH/WU1EiYwXljuZ4vtZXKlY2Idq8FZrnYBz8KhN3vwPo9CoV/SJS6SL1w== +rc-pagination@~5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/rc-pagination/-/rc-pagination-5.0.0.tgz#7633e1f0ff372ad78c03e86bcef78b660374d196" + integrity sha512-QjrPvbAQwps93iluvFM62AEYglGYhWW2q/nliQqmvkTi4PXP4HHoh00iC1Sa5LLVmtWQHmG73fBi2x6H6vFHRg== dependencies: "@babel/runtime" "^7.10.1" - classnames "^2.2.1" + classnames "^2.3.2" + rc-util "^5.38.0" -rc-picker@~2.7.0: - version "2.7.6" - resolved "https://registry.yarnpkg.com/rc-picker/-/rc-picker-2.7.6.tgz#03d855888d1878d8946bab77a3d24477fd3a0792" - integrity sha512-H9if/BUJUZBOhPfWcPeT15JUI3/ntrG9muzERrXDkSoWmDj4yzmBvumozpxYrHwjcKnjyDGAke68d+whWwvhHA== +rc-picker@~4.9.2: + version "4.9.2" + resolved "https://registry.yarnpkg.com/rc-picker/-/rc-picker-4.9.2.tgz#4dd8e23fcab107b44f0604d684c6ba12169ea35e" + integrity sha512-SLW4PRudODOomipKI0dvykxW4P8LOqtMr17MOaLU6NQJhkh9SZeh44a/8BMxwv5T6e3kiIeYc9k5jFg2Mv35Pg== dependencies: - "@babel/runtime" "^7.10.1" + "@babel/runtime" "^7.24.7" + "@rc-component/trigger" "^2.0.0" classnames "^2.2.1" - date-fns "2.x" - dayjs "1.x" - moment "^2.24.0" - rc-trigger "^5.0.4" - rc-util "^5.37.0" - shallowequal "^1.1.0" + rc-overflow "^1.3.2" + rc-resize-observer "^1.4.0" + rc-util "^5.43.0" -rc-progress@~3.4.1: - version "3.4.2" - resolved "https://registry.yarnpkg.com/rc-progress/-/rc-progress-3.4.2.tgz#f8df9ee95e790490171ab6b31bf07303cdc79980" - integrity sha512-iAGhwWU+tsayP+Jkl9T4+6rHeQTG9kDz8JAHZk4XtQOcYN5fj9H34NXNEdRdZx94VUDHMqCb1yOIvi8eJRh67w== +rc-progress@~4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/rc-progress/-/rc-progress-4.0.0.tgz#5382147d9add33d3a5fbd264001373df6440e126" + integrity sha512-oofVMMafOCokIUIBnZLNcOZFsABaUw8PPrf1/y0ZBvKZNpOiu5h4AO9vv11Sw0p4Hb3D0yGWuEattcQGtNJ/aw== dependencies: "@babel/runtime" "^7.10.1" classnames "^2.2.6" rc-util "^5.16.1" -rc-rate@~2.9.0: - version "2.9.3" - resolved "https://registry.yarnpkg.com/rc-rate/-/rc-rate-2.9.3.tgz#b30a8043ffcb327bab053cd78508e07015d8a483" - integrity sha512-2THssUSnRhtqIouQIIXqsZGzRczvp4WsH4WvGuhiwm+LG2fVpDUJliP9O1zeDOZvYfBE/Bup4SgHun/eCkbjgQ== +rc-rate@~2.13.0: + version "2.13.1" + resolved "https://registry.yarnpkg.com/rc-rate/-/rc-rate-2.13.1.tgz#29af7a3d4768362e9d4388f955a8b6389526b7fd" + integrity sha512-QUhQ9ivQ8Gy7mtMZPAjLbxBt5y9GRp65VcUyGUMF3N3fhiftivPHdpuDIaWIMOTEprAjZPC08bls1dQB+I1F2Q== dependencies: "@babel/runtime" "^7.10.1" classnames "^2.2.5" rc-util "^5.0.1" -rc-resize-observer@^1.0.0, rc-resize-observer@^1.1.0, rc-resize-observer@^1.2.0: +rc-resize-observer@^1.0.0, rc-resize-observer@^1.1.0: version "1.4.0" resolved "https://registry.yarnpkg.com/rc-resize-observer/-/rc-resize-observer-1.4.0.tgz#7bba61e6b3c604834980647cce6451914750d0cc" integrity sha512-PnMVyRid9JLxFavTjeDXEXo65HCRqbmLBw9xX9gfC4BZiSzbLXKzW3jPz+J0P71pLbD5tBMTT+mkstV5gD0c9Q== @@ -3993,116 +4109,126 @@ rc-resize-observer@^1.0.0, rc-resize-observer@^1.1.0, rc-resize-observer@^1.2.0: rc-util "^5.38.0" resize-observer-polyfill "^1.5.1" -rc-segmented@~2.1.0: - version "2.1.2" - resolved "https://registry.yarnpkg.com/rc-segmented/-/rc-segmented-2.1.2.tgz#14c9077a1dae9c2ccb2ef5fbc5662c1c48c7ce8e" - integrity sha512-qGo1bCr83ESXpXVOCXjFe1QJlCAQXyi9KCiy8eX3rIMYlTeJr/ftySIaTnYsitL18SvWf5ZEHsfqIWoX0EMfFQ== +rc-resize-observer@^1.3.1, rc-resize-observer@^1.4.0, rc-resize-observer@^1.4.3: + version "1.4.3" + resolved "https://registry.yarnpkg.com/rc-resize-observer/-/rc-resize-observer-1.4.3.tgz#4fd41fa561ba51362b5155a07c35d7c89a1ea569" + integrity sha512-YZLjUbyIWox8E9i9C3Tm7ia+W7euPItNWSPX5sCcQTYbnwDb5uNpnLHQCG1f22oZWUhLw4Mv2tFmeWe68CDQRQ== + dependencies: + "@babel/runtime" "^7.20.7" + classnames "^2.2.1" + rc-util "^5.44.1" + resize-observer-polyfill "^1.5.1" + +rc-segmented@~2.7.0: + version "2.7.1" + resolved "https://registry.yarnpkg.com/rc-segmented/-/rc-segmented-2.7.1.tgz#08a598b14e755117c5b37d238955c2d50eaa5d33" + integrity sha512-izj1Nw/Dw2Vb7EVr+D/E9lUTkBe+kKC+SAFSU9zqr7WV2W5Ktaa9Gc7cB2jTqgk8GROJayltaec+DBlYKc6d+g== dependencies: "@babel/runtime" "^7.11.1" classnames "^2.2.1" rc-motion "^2.4.4" rc-util "^5.17.0" -rc-select@~14.1.0, rc-select@~14.1.17: - version "14.1.18" - resolved "https://registry.yarnpkg.com/rc-select/-/rc-select-14.1.18.tgz#f1d95233132cda9c1485963254255b83e97a37a9" - integrity sha512-4JgY3oG2Yz68ECMUSCON7mtxuJvCSj+LJpHEg/AONaaVBxIIrmI/ZTuMJkyojall/X50YdBe5oMKqHHPNiPzEg== +rc-select@~14.16.2, rc-select@~14.16.6: + version "14.16.8" + resolved "https://registry.yarnpkg.com/rc-select/-/rc-select-14.16.8.tgz#78e6782f1ccc1f03d9003bc3effa4ed609d29a97" + integrity sha512-NOV5BZa1wZrsdkKaiK7LHRuo5ZjZYMDxPP6/1+09+FB4KoNi8jcG1ZqLE3AVCxEsYMBe65OBx71wFoHRTP3LRg== dependencies: "@babel/runtime" "^7.10.1" + "@rc-component/trigger" "^2.1.1" classnames "2.x" rc-motion "^2.0.1" - rc-overflow "^1.0.0" - rc-trigger "^5.0.4" + rc-overflow "^1.3.1" rc-util "^5.16.1" - rc-virtual-list "^3.2.0" + rc-virtual-list "^3.5.2" -rc-slider@~10.0.0: - version "10.0.1" - resolved "https://registry.yarnpkg.com/rc-slider/-/rc-slider-10.0.1.tgz#7058c68ff1e1aa4e7c3536e5e10128bdbccb87f9" - integrity sha512-igTKF3zBet7oS/3yNiIlmU8KnZ45npmrmHlUUio8PNbIhzMcsh+oE/r2UD42Y6YD2D/s+kzCQkzQrPD6RY435Q== +rc-slider@~11.1.8: + version "11.1.9" + resolved "https://registry.yarnpkg.com/rc-slider/-/rc-slider-11.1.9.tgz#d872130fbf4ec51f28543d62e90451091d6f5208" + integrity sha512-h8IknhzSh3FEM9u8ivkskh+Ef4Yo4JRIY2nj7MrH6GQmrwV6mcpJf5/4KgH5JaVI1H3E52yCdpOlVyGZIeph5A== dependencies: "@babel/runtime" "^7.10.1" classnames "^2.2.5" - rc-util "^5.18.1" - shallowequal "^1.1.0" + rc-util "^5.36.0" -rc-steps@~5.0.0-alpha.2: - version "5.0.0" - resolved "https://registry.yarnpkg.com/rc-steps/-/rc-steps-5.0.0.tgz#2e2403f2dd69eb3966d65f461f7e3a8ee1ef69fe" - integrity sha512-9TgRvnVYirdhbV0C3syJFj9EhCRqoJAsxt4i1rED5o8/ZcSv5TLIYyo4H8MCjLPvbe2R+oBAm/IYBEtC+OS1Rw== +rc-steps@~6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/rc-steps/-/rc-steps-6.0.1.tgz#c2136cd0087733f6d509209a84a5c80dc29a274d" + integrity sha512-lKHL+Sny0SeHkQKKDJlAjV5oZ8DwCdS2hFhAkIjuQt1/pB81M0cA0ErVFdHq9+jmPmFw1vJB2F5NBzFXLJxV+g== dependencies: "@babel/runtime" "^7.16.7" classnames "^2.2.3" rc-util "^5.16.1" -rc-switch@~3.2.0: - version "3.2.2" - resolved "https://registry.yarnpkg.com/rc-switch/-/rc-switch-3.2.2.tgz#d001f77f12664d52595b4f6fb425dd9e66fba8e8" - integrity sha512-+gUJClsZZzvAHGy1vZfnwySxj+MjLlGRyXKXScrtCTcmiYNPzxDFOxdQ/3pK1Kt/0POvwJ/6ALOR8gwdXGhs+A== +rc-switch@~4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/rc-switch/-/rc-switch-4.1.0.tgz#f37d81b4e0c5afd1274fd85367b17306bf25e7d7" + integrity sha512-TI8ufP2Az9oEbvyCeVE4+90PDSljGyuwix3fV58p7HV2o4wBnVToEyomJRVyTaZeqNPAp+vqeo4Wnj5u0ZZQBg== dependencies: - "@babel/runtime" "^7.10.1" + "@babel/runtime" "^7.21.0" classnames "^2.2.1" - rc-util "^5.0.1" + rc-util "^5.30.0" -rc-table@~7.26.0: - version "7.26.0" - resolved "https://registry.yarnpkg.com/rc-table/-/rc-table-7.26.0.tgz#9d517e7fa512e7571fdcc453eb1bf19edfac6fbc" - integrity sha512-0cD8e6S+DTGAt5nBZQIPFYEaIukn17sfa5uFL98faHlH/whZzD8ii3dbFL4wmUDEL4BLybhYop+QUfZJ4CPvNQ== +rc-table@~7.50.2: + version "7.50.5" + resolved "https://registry.yarnpkg.com/rc-table/-/rc-table-7.50.5.tgz#d0649d2fd902ca90dc20924c27a2e38523ce3625" + integrity sha512-FDZu8aolhSYd3v9KOc3lZOVAU77wmRRu44R0Wfb8Oj1dXRUsloFaXMSl6f7yuWZUxArJTli7k8TEOX2mvhDl4A== dependencies: "@babel/runtime" "^7.10.1" + "@rc-component/context" "^1.4.0" classnames "^2.2.5" rc-resize-observer "^1.1.0" - rc-util "^5.22.5" - shallowequal "^1.1.0" + rc-util "^5.44.3" + rc-virtual-list "^3.14.2" -rc-tabs@~12.5.6: - version "12.5.10" - resolved "https://registry.yarnpkg.com/rc-tabs/-/rc-tabs-12.5.10.tgz#0e41c723fac66c4f0bcad3271429fff6653b0721" - integrity sha512-Ay0l0jtd4eXepFH9vWBvinBjqOpqzcsJTerBGwJy435P2S90Uu38q8U/mvc1sxUEVOXX5ZCFbxcWPnfG3dH+tQ== +rc-tabs@~15.5.0: + version "15.5.2" + resolved "https://registry.yarnpkg.com/rc-tabs/-/rc-tabs-15.5.2.tgz#bca1d2f2ee1e609fa4d7527b3c1639319f035b0c" + integrity sha512-Hbqf2IV6k/jPgfMjPtIDmPV0D0C9c/fN4B/fYcoh9qqaUzUZQoK0PYzsV3UaV+3UsmyoYt48p74m/HkLhGTw+w== dependencies: "@babel/runtime" "^7.11.2" classnames "2.x" - rc-dropdown "~4.0.0" - rc-menu "~9.8.0" + rc-dropdown "~4.2.0" + rc-menu "~9.16.0" rc-motion "^2.6.2" rc-resize-observer "^1.0.0" - rc-util "^5.16.0" + rc-util "^5.34.1" -rc-textarea@^0.4.0, rc-textarea@~0.4.5: - version "0.4.7" - resolved "https://registry.yarnpkg.com/rc-textarea/-/rc-textarea-0.4.7.tgz#627f662d46f99e0059d1c1ebc8db40c65339fe90" - integrity sha512-IQPd1CDI3mnMlkFyzt2O4gQ2lxUsnBAeJEoZGJnkkXgORNqyM9qovdrCj9NzcRfpHgLdzaEbU3AmobNFGUznwQ== +rc-textarea@~1.9.0: + version "1.9.0" + resolved "https://registry.yarnpkg.com/rc-textarea/-/rc-textarea-1.9.0.tgz#d807194ebef90f25f0b9501cddf5e8f2968d598a" + integrity sha512-dQW/Bc/MriPBTugj2Kx9PMS5eXCCGn2cxoIaichjbNvOiARlaHdI99j4DTxLl/V8+PIfW06uFy7kjfUIDDKyxQ== dependencies: "@babel/runtime" "^7.10.1" classnames "^2.2.1" + rc-input "~1.7.1" rc-resize-observer "^1.0.0" - rc-util "^5.24.4" - shallowequal "^1.1.0" + rc-util "^5.27.0" -rc-tooltip@~5.2.0: - version "5.2.2" - resolved "https://registry.yarnpkg.com/rc-tooltip/-/rc-tooltip-5.2.2.tgz#e5cafa8ecebf78108936a0bcb93c150fa81ac93b" - integrity sha512-jtQzU/18S6EI3lhSGoDYhPqNpWajMtS5VV/ld1LwyfrDByQpYmw/LW6U7oFXXLukjfDHQ7Ju705A82PRNFWYhg== +rc-tooltip@~6.3.2: + version "6.3.2" + resolved "https://registry.yarnpkg.com/rc-tooltip/-/rc-tooltip-6.3.2.tgz#4fc0af77731b7e571f5ce15bd1ede759b0e64dd7" + integrity sha512-oA4HZIiZJbUQ5ojigM0y4XtWxaH/aQlJSzknjICRWNpqyemy1sL3X3iEQV2eSPBWEq+bqU3+aSs81z+28j9luA== dependencies: "@babel/runtime" "^7.11.2" + "@rc-component/trigger" "^2.0.0" classnames "^2.3.1" - rc-trigger "^5.0.0" -rc-tree-select@~5.5.0: - version "5.5.5" - resolved "https://registry.yarnpkg.com/rc-tree-select/-/rc-tree-select-5.5.5.tgz#d28b3b45da1e820cd21762ba0ee93c19429bb369" - integrity sha512-k2av7jF6tW9bIO4mQhaVdV4kJ1c54oxV3/hHVU+oD251Gb5JN+m1RbJFTMf1o0rAFqkvto33rxMdpafaGKQRJw== +rc-tree-select@~5.27.0: + version "5.27.0" + resolved "https://registry.yarnpkg.com/rc-tree-select/-/rc-tree-select-5.27.0.tgz#3daa62972ae80846dac96bf4776d1a9dc9c7c4c6" + integrity sha512-2qTBTzwIT7LRI1o7zLyrCzmo5tQanmyGbSaGTIf7sYimCklAToVVfpMC6OAldSKolcnjorBYPNSKQqJmN3TCww== dependencies: - "@babel/runtime" "^7.10.1" + "@babel/runtime" "^7.25.7" classnames "2.x" - rc-select "~14.1.0" - rc-tree "~5.7.0" - rc-util "^5.16.1" + rc-select "~14.16.2" + rc-tree "~5.13.0" + rc-util "^5.43.0" -rc-tree@~5.7.0: - version "5.7.12" - resolved "https://registry.yarnpkg.com/rc-tree/-/rc-tree-5.7.12.tgz#6910e551390963708936c2cbf925f9deff4a6d76" - integrity sha512-LXA5nY2hG5koIAlHW5sgXgLpOMz+bFRbnZZ+cCg0tQs4Wv1AmY7EDi1SK7iFXhslYockbqUerQan82jljoaItg== +rc-tree@~5.13.0: + version "5.13.1" + resolved "https://registry.yarnpkg.com/rc-tree/-/rc-tree-5.13.1.tgz#f36a33a94a1282f4b09685216c01487089748910" + integrity sha512-FNhIefhftobCdUJshO7M8uZTA9F4OPGVXqGfZkkD/5soDeOhwO06T/aKTrg0WD8gRg/pyfq+ql3aMymLHCTC4A== dependencies: "@babel/runtime" "^7.10.1" classnames "2.x" @@ -4110,27 +4236,16 @@ rc-tree@~5.7.0: rc-util "^5.16.1" rc-virtual-list "^3.5.1" -rc-trigger@^5.0.0, rc-trigger@^5.0.4, rc-trigger@^5.1.2, rc-trigger@^5.2.10, rc-trigger@^5.3.1: - version "5.3.4" - resolved "https://registry.yarnpkg.com/rc-trigger/-/rc-trigger-5.3.4.tgz#6b4b26e32825677c837d1eb4d7085035eecf9a61" - integrity sha512-mQv+vas0TwKcjAO2izNPkqR4j86OemLRmvL2nOzdP9OWNWA1ivoTt5hzFqYNW9zACwmTezRiN8bttrC7cZzYSw== - dependencies: - "@babel/runtime" "^7.18.3" - classnames "^2.2.6" - rc-align "^4.0.0" - rc-motion "^2.0.0" - rc-util "^5.19.2" - -rc-upload@~4.3.0: - version "4.3.6" - resolved "https://registry.yarnpkg.com/rc-upload/-/rc-upload-4.3.6.tgz#6a87397315cee065a04bee4103d6de9dbe2e377a" - integrity sha512-Bt7ESeG5tT3IY82fZcP+s0tQU2xmo1W6P3S8NboUUliquJLQYLkUcsaExi3IlBVr43GQMCjo30RA2o0i70+NjA== +rc-upload@~4.8.1: + version "4.8.1" + resolved "https://registry.yarnpkg.com/rc-upload/-/rc-upload-4.8.1.tgz#ac55f2bc101b95b52a6e47f3c18f0f55b54e16d2" + integrity sha512-toEAhwl4hjLAI1u8/CgKWt30BR06ulPa4iGQSMvSXoHzO88gPCslxqV/mnn4gJU7PDoltGIC9Eh+wkeudqgHyw== dependencies: "@babel/runtime" "^7.18.3" classnames "^2.2.5" rc-util "^5.2.0" -rc-util@^5.0.1, rc-util@^5.0.6, rc-util@^5.16.0, rc-util@^5.16.1, rc-util@^5.17.0, rc-util@^5.18.1, rc-util@^5.19.2, rc-util@^5.2.0, rc-util@^5.2.1, rc-util@^5.20.1, rc-util@^5.21.0, rc-util@^5.21.2, rc-util@^5.22.5, rc-util@^5.23.0, rc-util@^5.24.4, rc-util@^5.25.2, rc-util@^5.26.0, rc-util@^5.27.0, rc-util@^5.36.0, rc-util@^5.37.0, rc-util@^5.38.0, rc-util@^5.43.0, rc-util@^5.6.1, rc-util@^5.8.0, rc-util@^5.9.4: +rc-util@^5.0.1, rc-util@^5.16.1, rc-util@^5.17.0, rc-util@^5.18.1, rc-util@^5.2.0, rc-util@^5.20.1, rc-util@^5.21.0, rc-util@^5.24.4, rc-util@^5.25.2, rc-util@^5.27.0, rc-util@^5.36.0, rc-util@^5.37.0, rc-util@^5.38.0, rc-util@^5.43.0: version "5.43.0" resolved "https://registry.yarnpkg.com/rc-util/-/rc-util-5.43.0.tgz#bba91fbef2c3e30ea2c236893746f3e9b05ecc4c" integrity sha512-AzC7KKOXFqAdIBqdGWepL9Xn7cm3vnAmjlHqUnoQaTMZYhM4VlXGLkkHHxj/BZ7Td0+SOPKB4RGPboBVKT9htw== @@ -4138,7 +4253,25 @@ rc-util@^5.0.1, rc-util@^5.0.6, rc-util@^5.16.0, rc-util@^5.16.1, rc-util@^5.17. "@babel/runtime" "^7.18.3" react-is "^18.2.0" -rc-virtual-list@^3.2.0, rc-virtual-list@^3.5.1: +rc-util@^5.30.0, rc-util@^5.31.1, rc-util@^5.32.2, rc-util@^5.34.1, rc-util@^5.35.0, rc-util@^5.38.1, rc-util@^5.40.1, rc-util@^5.44.0, rc-util@^5.44.1, rc-util@^5.44.3: + version "5.44.4" + resolved "https://registry.yarnpkg.com/rc-util/-/rc-util-5.44.4.tgz#89ee9037683cca01cd60f1a6bbda761457dd6ba5" + integrity sha512-resueRJzmHG9Q6rI/DfK6Kdv9/Lfls05vzMs1Sk3M2P+3cJa+MakaZyWY8IPfehVuhPJFKrIY1IK4GqbiaiY5w== + dependencies: + "@babel/runtime" "^7.18.3" + react-is "^18.2.0" + +rc-virtual-list@^3.14.2, rc-virtual-list@^3.5.2: + version "3.19.2" + resolved "https://registry.yarnpkg.com/rc-virtual-list/-/rc-virtual-list-3.19.2.tgz#1dd2d782c9a3ccbe537bb873447d73f83af8de0f" + integrity sha512-Ys6NcjwGkuwkeaWBDqfI3xWuZ7rDiQXlH1o2zLfFzATfEgXcqpk8CkgMfbJD81McqjcJVez25a3kPxCR807evA== + dependencies: + "@babel/runtime" "^7.20.0" + classnames "^2.2.6" + rc-resize-observer "^1.0.0" + rc-util "^5.36.0" + +rc-virtual-list@^3.5.1: version "3.14.3" resolved "https://registry.yarnpkg.com/rc-virtual-list/-/rc-virtual-list-3.14.3.tgz#f437aa9fe753b5a6159de56d8a4cb617a910ee4c" integrity sha512-6+6wiEhdqakNBnbRJymgMlh+90qpkgqherTRo1l1cX7mK6F9hWsazPczmP0lA+64yhC9/t+M9Dh5pjvDWimn8A== @@ -4184,7 +4317,7 @@ react-codemirror2@^6.0.0: resolved "https://registry.yarnpkg.com/react-codemirror2/-/react-codemirror2-6.0.1.tgz#7daba40795eb2a52637926b6fe0b73a6e9090723" integrity sha512-rutEKVgvFhWcy/GeVA1hFbqrO89qLqgqdhUr7YhYgIzdyICdlRQv+ztuNvOFQMXrO0fLt0VkaYOdMdYdQgsSUA== -react-color@^2.19.3: +react-color@2.19.3: version "2.19.3" resolved "https://registry.yarnpkg.com/react-color/-/react-color-2.19.3.tgz#ec6c6b4568312a3c6a18420ab0472e146aa5683d" integrity sha512-LEeGE/ZzNLIsFWa1TMe8y5VYqr7bibneWmvJwm1pCn/eNmrabWDh659JSPn9BuaMpEfU83WTOJfnCcjDZwNQTA== @@ -4520,12 +4653,12 @@ scheduler@^0.23.2: dependencies: loose-envify "^1.1.0" -scroll-into-view-if-needed@^2.2.25: - version "2.2.31" - resolved "https://registry.yarnpkg.com/scroll-into-view-if-needed/-/scroll-into-view-if-needed-2.2.31.tgz#d3c482959dc483e37962d1521254e3295d0d1587" - integrity sha512-dGCXy99wZQivjmjIqihaBQNjryrz5rueJY7eHfTdyWEiR4ttYpsajb14rn9s5d4DY4EcY6+4+U/maARBXJedkA== +scroll-into-view-if-needed@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/scroll-into-view-if-needed/-/scroll-into-view-if-needed-3.1.0.tgz#fa9524518c799b45a2ef6bbffb92bcad0296d01f" + integrity sha512-49oNpRjWRvnU8NyGVmUaYG4jtTkNonFZI86MmGRDqBphEK2EXT9gdEUoQPZhuBM8yWHxCWbobltqYO5M4XrUvQ== dependencies: - compute-scroll-into-view "^1.0.20" + compute-scroll-into-view "^3.0.2" scroll-smooth@1.1.1: version "1.1.1" @@ -4680,7 +4813,16 @@ string-convert@^0.2.0: resolved "https://registry.yarnpkg.com/string-convert/-/string-convert-0.2.1.tgz#6982cc3049fbb4cd85f8b24568b9d9bf39eeff97" integrity sha512-u/1tdPl4yQnPBjnVrmdLo9gtuLvELKsAoRapekWggdiQNvvvum+jYF329d84NAa660KQw7pB2n36KrIKVoXa3A== -"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.1.0, string-width@^4.2.0: +"string-width-cjs@npm:string-width@^4.2.0": + version "4.2.3" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" + integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.1" + +string-width@^4.1.0, string-width@^4.2.0: version "4.2.3" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -4706,7 +4848,14 @@ stringify-entities@^4.0.0: character-entities-html4 "^2.0.0" character-entities-legacy "^3.0.0" -"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1: +"strip-ansi-cjs@npm:strip-ansi@^6.0.1": + version "6.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" + integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== + dependencies: + ansi-regex "^5.0.1" + +strip-ansi@^6.0.0, strip-ansi@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== @@ -4766,6 +4915,11 @@ stylis@^3.5.0: resolved "https://registry.yarnpkg.com/stylis/-/stylis-3.5.4.tgz#f665f25f5e299cf3d64654ab949a57c768b73fbe" integrity sha512-8/3pSmthWM7lsPBKv7NXkzn2Uc9W7NotcwGNpJaa3k7WMM1XDCA4MgT5k/8BIexd5ydZdboXtU90XH9Ec4Bv/Q== +stylis@^4.3.4: + version "4.3.6" + resolved "https://registry.yarnpkg.com/stylis/-/stylis-4.3.6.tgz#7c7b97191cb4f195f03ecab7d52f7902ed378320" + integrity sha512-yQ3rwFWRfwNUY7H5vpU0wfdkNSnvnJinhF9830Swlaxl03zsOjCfmX0ugac+3LtK0lYSgwL/KXc8oYL3mG4YFQ== + sucrase@^3.32.0: version "3.35.0" resolved "https://registry.yarnpkg.com/sucrase/-/sucrase-3.35.0.tgz#57f17a3d7e19b36d8995f06679d121be914ae263" @@ -4857,6 +5011,11 @@ thenify-all@^1.0.0: dependencies: any-promise "^1.0.0" +throttle-debounce@^5.0.0, throttle-debounce@^5.0.2: + version "5.0.2" + resolved "https://registry.yarnpkg.com/throttle-debounce/-/throttle-debounce-5.0.2.tgz#ec5549d84e053f043c9fd0f2a6dd892ff84456b1" + integrity sha512-B71/4oyj61iNH0KeCamLuE2rmKuTO5byTOSVwECM5FA7TiAiAW+UqTKZ9ERueC4qvgSttUhdmq1mXC3kJqGX7A== + throttleit@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/throttleit/-/throttleit-1.0.1.tgz#304ec51631c3b770c65c6c6f76938b384000f4d5" @@ -5116,6 +5275,11 @@ util-deprecate@^1.0.2: resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" integrity sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw== +uuid@^10.0.0: + version "10.0.0" + resolved "https://registry.yarnpkg.com/uuid/-/uuid-10.0.0.tgz#5a95aa454e6e002725c79055fd42aaba30ca6294" + integrity sha512-8XkAphELsDnEGrDxUOHB3RGvXz6TeuYSGEZBOjtTtPm2lwhGBjLgOzLHB63IUWfBpNucQjND6d3AOudO+H3RWQ== + uuid@^8.3.2: version "8.3.2" resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2" @@ -5170,7 +5334,7 @@ word-wrap@^1.2.5: resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.5.tgz#d2c45c6dd4fbce621a66f136cbe328afd0410b34" integrity sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA== -"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0: +"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0": version "7.0.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== @@ -5188,6 +5352,15 @@ wrap-ansi@^6.2.0: string-width "^4.1.0" strip-ansi "^6.0.0" +wrap-ansi@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" + integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== + dependencies: + ansi-styles "^4.0.0" + string-width "^4.1.0" + strip-ansi "^6.0.0" + wrap-ansi@^8.1.0: version "8.1.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214" diff --git a/package.json b/package.json index 466cfa4..0ce7923 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "predeploy": "cd example && yarn install && yarn run build", "deploy": "gh-pages -d example/build", "yalc:publish": "yalc publish --push --sig", - "docs:gen": "typedoc --excludePrivate --plugin typedoc-plugin-markdown --hideInPageTOC true --hideBreadcrumbs true --hidePageTitle true --out docs src/types/index.ts", + "docs:gen": "typedoc --excludePrivate --excludeInternal --plugin typedoc-plugin-markdown --hideInPageTOC true --hideBreadcrumbs true --hidePageTitle true --out docs src/types/index.ts", "docs:merge": "node scripts/readme-merge.js", "docs:toc": "doctoc --maxlevel 3 README.md --github", "docs:clean": "rimraf docs", diff --git a/scripts/readme-merge.js b/scripts/readme-merge.js index f662abf..ccf8aec 100644 --- a/scripts/readme-merge.js +++ b/scripts/readme-merge.js @@ -6,14 +6,176 @@ const END_COMMENT = '' const sourceFile = './docs/modules.md' const destinationFile = './README.md' +// ── Category definitions ────────────────────────────────────────────── +const HERO = ['FormbitObject'] + +const GROUPS = [ + { + heading: 'Core Types', + names: ['FormbitValues', 'Form', 'InitialValues', 'Errors', 'LiveValidation', 'FormState'], + }, + { + heading: 'Callback Types', + names: [ + 'SuccessCallback', + 'ErrorCallback', + 'CheckSuccessCallback', + 'CheckErrorCallback', + 'SubmitSuccessCallback', + ], + }, + { + heading: 'Method Types', + names: [ + 'Write', + 'WriteAll', + 'Remove', + 'RemoveAll', + 'Check', + 'Validate', + 'ValidateAll', + 'ValidateForm', + 'SubmitForm', + 'Initialize', + 'SetError', + 'SetSchema', + ], + }, + { + heading: 'Options Types', + names: ['WriteFnOptions', 'ValidateFnOptions', 'CheckFnOptions', 'WriteAllValue'], + }, + { + heading: 'Yup Re-Exports', + names: ['ValidationSchema', 'ValidateOptions', 'ValidationError'], + }, +] + +// ── Helpers ─────────────────────────────────────────────────────────── + +/** Split the typedoc modules.md into individual type blocks */ +function parseBlocks(raw) { + // Remove the leading "## Type Aliases" heading if present + const cleaned = raw.replace(/^## Type Aliases\s*\n/, '') + + // Split on the ___ separator that typedoc inserts between entries + const chunks = cleaned.split(/\n___\n/) + + const blocks = [] + for (const chunk of chunks) { + const trimmed = chunk.trim() + if (!trimmed) continue + + // Extract the type name from the first ### heading + const nameMatch = trimmed.match(/^### (.+)$/m) + if (!nameMatch) continue + + blocks.push({ name: nameMatch[1], content: trimmed }) + } + + return blocks +} + +/** Detect deprecated types by checking for **`Deprecated`** in content */ +function isDeprecated(content) { + return content.includes('**`Deprecated`**') +} + +/** Demote ### to #### (for types inside groups) */ +function demoteHeadings(content) { + return content.replace(/^### /gm, '#### ') +} + +/** Fix internal links: modules.md# -> # */ +function fixLinks(content) { + return content.replace(/modules\.md#/g, '#') +} + +/** Categorize blocks into groups */ +function categorize(blocks) { + const heroBlocks = [] + const groupBuckets = GROUPS.map(() => []) + const deprecatedBlocks = [] + const otherBlocks = [] + + // Build a lookup: type name -> group index + const nameToGroup = new Map() + GROUPS.forEach((group, idx) => { + for (const name of group.names) { + nameToGroup.set(name, idx) + } + }) + + for (const block of blocks) { + if (HERO.includes(block.name)) { + heroBlocks.push(block) + } else if (isDeprecated(block.content)) { + deprecatedBlocks.push(block) + } else if (nameToGroup.has(block.name)) { + groupBuckets[nameToGroup.get(block.name)].push(block) + } else { + otherBlocks.push(block) + } + } + + return { heroBlocks, groupBuckets, deprecatedBlocks, otherBlocks } +} + +/** Assemble the final API Reference markdown */ +function assemble(categorized) { + const { heroBlocks, groupBuckets, deprecatedBlocks, otherBlocks } = categorized + const sections = [] + + sections.push('## API Reference\n') + + // Hero: FormbitObject stays at ### level + for (const block of heroBlocks) { + sections.push(fixLinks(block.content)) + } + + // Named groups + GROUPS.forEach((group, idx) => { + const bucket = groupBuckets[idx] + if (bucket.length === 0) return + + sections.push(`### ${group.heading}\n`) + for (const block of bucket) { + sections.push(fixLinks(demoteHeadings(block.content))) + } + }) + + // Other (fallback for any uncategorized, future-proof) + if (otherBlocks.length > 0) { + sections.push('### Other Types\n') + for (const block of otherBlocks) { + sections.push(fixLinks(demoteHeadings(block.content))) + } + } + + // Deprecated: wrapped in
+ if (deprecatedBlocks.length > 0) { + sections.push('### Deprecated Types\n') + sections.push('
\nShow deprecated types\n') + for (const block of deprecatedBlocks) { + sections.push(fixLinks(demoteHeadings(block.content))) + } + sections.push('
') + } + + return sections.join('\n') +} + +// ── Main ────────────────────────────────────────────────────────────── + readFile(sourceFile, 'utf8', (err, data) => { if (err) { console.error(`Error reading source file: ${err}`) process.exit(1) } - // Internal links created by typedocs point to modules.md file, instead we want to point to the hash in the same file - const typesDocumentation = data.replace(/modules\.md#/g, '#') + const blocks = parseBlocks(data) + const categorized = categorize(blocks) + const typesDocumentation = assemble(categorized) readFile(destinationFile, 'utf8', (err, destinationData) => { if (err) { @@ -39,7 +201,7 @@ readFile(sourceFile, 'utf8', (err, data) => { console.error(`Error writing README.md file: ${err}`) process.exit(1) } - console.log('Types successfully copied into README.md') + console.log('Types successfully categorized and copied into README.md') }) }) }) diff --git a/src/index.ts b/src/index.ts index 9ee81ce..d6d4f11 100644 --- a/src/index.ts +++ b/src/index.ts @@ -3,3 +3,4 @@ import FormbitContextProvider, { useFormbitContext } from './formbit-context' export default useFormbit export { FormbitContextProvider, useFormbitContext } +export type { FormState, FormbitValues } from './types' diff --git a/src/types/index.ts b/src/types/index.ts index 037627c..124f28d 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -1,50 +1,69 @@ import { ObjectSchema, ValidationError as YupValidationError, ValidateOptions as YupValidateOptions } from 'yup' import { ACTIONS } from '../helpers/constants' +// ─── Internal / Utility Types ──────────────────────────────────────────────── + /** + * @internal * @private */ export type Action = keyof typeof ACTIONS /** - * Checks the given json against the form schema and returns and array of errors. - * It returns undefined if the json is valid. - * + * @internal + * Generic object with string keys. */ -export type Check = - (json: Form, options?: CheckFnOptions) => ValidationError[] | undefined +export type FormbitRecord = Record + +/** @deprecated Use {@link FormbitRecord} instead. Renamed to avoid shadowing the global `Object`. */ +export type Object = FormbitRecord /** - * Reset isDirty value to false + * @internal */ -export type ClearIsDirty = () => void +export type GenericCallback = SuccessCallback | ErrorCallback /** - * Invoked in case of errors raised by validation + * @internal */ -export type ErrorCallback = (writer: Writer, setError: SetError) => void +export type ValidationFormbitError = Pick /** - * Invoked in case of errors raised by validation of check method - * + * @internal + * @private */ -export type ErrorCheckCallback = - (json: Form, inner: ValidationError[], writer: Writer, setError: SetError) => void +export type WriteOrRemove = + (path: keyof Values | string, value: unknown, options?: WriteFnOptions, action?: Action) => void /** - * Returns the error message for the given path if any. - * It doesn't trigger any validation - * + * @internal + * @private + */ +export type PrivateValidateForm = ( + successCallback?: SuccessCallback, + errorCallback?: ErrorCallback>, + options?: { options?: ValidateOptions, isDirty?: boolean }) => void + +// ─── Core Value Types ──────────────────────────────────────────────────────── + +/** + * Base type for form values: a record of string keys with an optional `__metadata` field. */ -export type ErrorFn = (path: string) => string | undefined; +export type FormbitValues = { __metadata?: FormbitRecord } & FormbitRecord + +/** Object containing the updated form. */ +export type Form = FormbitValues + +/** InitialValues used to set up formbit; also used to reset the form to its original version. */ +export type InitialValues = FormbitValues /** - * Object including all the registered errors messages since the last validation. + * Object including all the registered error messages since the last validation. * Errors are stored using the same path of the corresponding form values. * * @example * If the form object has this structure: -* ```json + * ```json * { * "age": 1 * } @@ -55,57 +74,21 @@ export type ErrorFn = (path: string) => string | undefined; * "age": "Age must be greater then 18" * } * ``` - * */ export type Errors = Record -/** - * Object containing the updated form - */ -export type Form = { __metadata?: Object } & Object - -export type GenericCallback = SuccessCallback | ErrorCallback -/** - * Initialize the form with new initial values - */ -export type Initialize = (values: Partial) => void - -/** - * InitialValues used to setup formbit, used also to reset the form to the original version. - * - */ -export type InitialValues = { __metadata?: Object } & Object - -/** - * Returns true if the form is Dirty (user already interacted with the form), false otherwise. - * - */ -export type IsDirty = boolean - -/** - * Returns true if the form is NOT valid - * It doesn't perform any validation, it checks if any errors are present - */ -export type IsFormInvalid = () => boolean - -/** - * Returns true id the form is valid - * It doesn't perform any validation, it checks if any errors are present - */ -export type IsFormValid = () => boolean - /** * Object including all the values that are being live validated. - * Usually fields that fail validation (using one of the method that triggers validation) - * will automatically set to be live-validated. + * Usually fields that fail validation (using one of the methods that triggers validation) + * will automatically be set to live-validated. * * A value/path is live-validated when validated at every change of the form. * - * By default no field is live-validated + * By default no field is live-validated. * * @example * If the form object has this structure: -* ```json + * ```json * { * "age": 1 * } @@ -113,208 +96,186 @@ export type IsFormValid = () => boolean * and age is a field that is being live-validated, liveValidation object will look like this * ```json * { - * "age": "Age must be greater then 18" + * "age": true * } * ``` - * */ export type LiveValidation = Record -/** - * Returns true if live validation is active for the given path - * - */ -export type LiveValidationFn = (path: string) => true | undefined +// ─── FormState (formerly Writer) ───────────────────────────────────────────── /** - * Generic object with string as keys - * + * Internal form state storing all the data of the form (except the validation schema). */ -export type Object = Record +export type FormState = { + form: Values, + initialValues: Values + errors: Errors, + liveValidation: LiveValidation, + isDirty: boolean, +} -/** - * @private - */ -export type PrivateValidateForm = ( - successCallback?: SuccessCallback, - errorCallback?: ErrorCallback>, - options?: { options?: ValidateOptions, isDirty?: boolean }) => void +/** @deprecated Use {@link FormState} instead. */ +export type Writer = FormState -/** - * - * This method updates the form state deleting value and set isDirty to true. - * - * After writing, it validates all the paths contained into pathsToValidate (if any) - * and all the fields that have the live validation active. - * - * - */ -export type Remove = (path: string, options?: WriteFnOptions) => void +// ─── Yup Re-exports ───────────────────────────────────────────────────────── /** - * Reset form to the initial state. - * Errors and liveValidation are set back to empty objects. - * isDirty is set back to false + * Type imported from the yup library. + * It represents any validation schema created with the yup.object() method. * + * Link to the Yup documentation {@link https://github.com/jquense/yup} */ -export type ResetForm = () => void +export type ValidationSchema = ObjectSchema /** * Type imported from the yup library. - * It represents any validation schema created with the yup.object() method + * It represents the object with all the options that can be passed to the internal yup validation method. * * Link to the Yup documentation {@link https://github.com/jquense/yup} - * */ -export type ValidationSchema = ObjectSchema +export type ValidateOptions = YupValidateOptions /** - * Set a message(value) to the given error path. + * Type imported from the yup library. + * It represents the error object returned when a validation fails. * + * Link to the Yup documentation {@link https://github.com/jquense/yup} */ -export type SetError = (path: string, value: string) => void +export type ValidationError = YupValidationError + +// ─── Callback Types ────────────────────────────────────────────────────────── /** - * Override the current schema with the given one. - * + * Success callback invoked by some formbit methods when the operation is successful. */ -export type SetSchema = (newSchema: ValidationSchema) => void +export type SuccessCallback = (writer: FormState, setError: SetError) => void /** - * Perform a validation against the current form object, and execute the successCallback if the validation pass - * otherwise it executes the errorCallback - * + * Invoked in case of errors raised by validation. */ -export type SubmitForm = ( - successCallback: SuccessSubmitCallback, - errorCallback?: ErrorCallback>, - options?: ValidateOptions) => void +export type ErrorCallback = (writer: FormState, setError: SetError) => void /** - * Success callback invoked by some formbit methods when the operation is successful. - * + * Success callback invoked by the check method when the operation is successful. */ -export type SuccessCallback = (writer: Writer, setError: SetError) => void +export type CheckSuccessCallback = + (json: Form, writer: FormState, setError: SetError) => void + +/** @deprecated Use {@link CheckSuccessCallback} instead. */ +export type SuccessCheckCallback = CheckSuccessCallback /** - * Success callback invoked by the check method when the operation is successful. - * + * Invoked in case of errors raised by validation of check method. */ -export type SuccessCheckCallback = - (json: Form, writer: Writer, setError: SetError) => void +export type CheckErrorCallback = + (json: Form, inner: ValidationError[], writer: FormState, setError: SetError) => void + +/** @deprecated Use {@link CheckErrorCallback} instead. */ +export type ErrorCheckCallback = CheckErrorCallback /** * Success callback invoked by the submit method when the validation is successful. * Is the right place to send your data to the backend. - * */ -export type SuccessSubmitCallback = +export type SubmitSuccessCallback = ( - writer: Writer>, - setError: SetError, clearIsDirty: ClearIsDirty + writer: FormState>, + setError: SetError, clearIsDirty: () => void ) => void -/** - * - * This method only validate the specified path. Do not check for fields that have the - * live validation active. - */ +/** @deprecated Use {@link SubmitSuccessCallback} instead. */ +export type SuccessSubmitCallback = SubmitSuccessCallback + +// ─── Deprecated Single-Use Aliases (kept for backward compatibility) ───────── + +/** @deprecated Inlined into {@link FormbitObject}. */ +export type ErrorFn = (path: string) => string | undefined + +/** @deprecated Inlined into {@link FormbitObject}. */ +export type IsFormValid = () => boolean + +/** @deprecated Inlined into {@link FormbitObject}. */ +export type IsFormInvalid = () => boolean + +/** @deprecated Inlined into {@link FormbitObject}. */ +export type ClearIsDirty = () => void + +/** @deprecated Inlined into {@link FormbitObject}. */ +export type ResetForm = () => void + +/** @deprecated Inlined into {@link FormbitObject}. */ +export type LiveValidationFn = (path: string) => true | undefined + +/** @deprecated Inlined into {@link FormbitObject}. */ +export type IsDirty = boolean + +// ─── Method Types ──────────────────────────────────────────────────────────── + +/** See {@link FormbitObject.check}. */ +export type Check = + (json: Form, options?: CheckFnOptions) => ValidationError[] | undefined + +/** See {@link FormbitObject.initialize}. */ +export type Initialize = (values: Partial) => void + +/** See {@link FormbitObject.remove}. */ +export type Remove = (path: string, options?: WriteFnOptions) => void + +/** See {@link FormbitObject.setError}. */ +export type SetError = (path: string, value: string) => void + +/** See {@link FormbitObject.setSchema}. */ +export type SetSchema = (newSchema: ValidationSchema) => void + +/** See {@link FormbitObject.submitForm}. */ +export type SubmitForm = ( + successCallback: SubmitSuccessCallback, + errorCallback?: ErrorCallback>, + options?: ValidateOptions) => void + +/** See {@link FormbitObject.validate}. */ export type Validate = (path: string, options?: ValidateFnOptions) => void -/** - * - * This method only validate the specified paths. Do not check for fields that have the - * live validation active. - */ +/** See {@link FormbitObject.validateAll}. */ export type ValidateAll = (paths: string[], options?: ValidateFnOptions) => void -/** - * This method validates the entire form and set the corresponding errors if any. - * - */ +/** See {@link FormbitObject.validateForm}. */ export type ValidateForm = ( successCallback?: SuccessCallback, errorCallback?: ErrorCallback, options?: ValidateOptions) => void -export type ValidationFormbitError = Pick - -/** - * Type imported from the yup library. - * It represents the object with all the options that can be passed to the internal yup validation method, - * - * Link to the Yup documentation {@link https://github.com/jquense/yup} - * - */ -export type ValidateOptions = YupValidateOptions - -/** - * - * This method update the form state writing $value into the $path, setting isDirty to true. - * - * After writing, it validates all the paths contained into $pathsToValidate (if any) - * and all the fields that have the live validation active. - */ +/** See {@link FormbitObject.write}. */ export type Write = (path: keyof Values | string, value: unknown, options?: WriteFnOptions) => void -/** - * This method takes an array of [path, value] and update the form state writing - * all those values into the specified paths. - * - * It set isDirty to true. - * - * After writing, it validate all the paths contained into $pathToValidate and all - * the fields that have the live validation active. - * - */ +/** See {@link FormbitObject.writeAll}. */ export type WriteAll = (arr: WriteAllValue[], options?: WriteFnOptions) => void -/** -* -* This method updates the form state deleting multiple values, setting isDirty to true. -* -*/ + +/** See {@link FormbitObject.removeAll}. */ export type RemoveAll = (arr: string[], options?: WriteFnOptions) => void /** * Tuple of [key, value] pair. - * */ export type WriteAllValue = [keyof Values | string, unknown] -/** - * @private - */ -export type WriteOrRemove = - (path: keyof Values | string, value: unknown, options?: WriteFnOptions, action?: Action) => void +// ─── Options Types ─────────────────────────────────────────────────────────── /** - * Internal form state storing all the data of the form (except the validation schema) - * - */ -export type Writer = { - form: Values, - initialValues: Values - errors: Errors, - liveValidation: LiveValidation, - isDirty: IsDirty, -} - -/** - * Options object to change the behavior of the check method - * + * Options object to change the behavior of the check method. */ export type CheckFnOptions = { - successCallback?: SuccessCheckCallback, - errorCallback?: ErrorCheckCallback, + successCallback?: CheckSuccessCallback, + errorCallback?: CheckErrorCallback, options?: ValidateOptions } /** - * Options object to change the behavior of the validate methods - * + * Options object to change the behavior of the validate methods. */ export type ValidateFnOptions = { successCallback?: SuccessCallback>, @@ -323,180 +284,159 @@ export type ValidateFnOptions = { } /** - * Type imported from the yup library. - * It represents the error object returned when a validation fails - * - * Link to the Yup documentation {@link https://github.com/jquense/yup} - * - */ -export type ValidationError = YupValidationError - -/** - * Options object to change the behavior of the write methods - * + * Options object to change the behavior of the write methods. */ export type WriteFnOptions = { noLiveValidation?: boolean, pathsToValidate?: string[] } & ValidateFnOptions +// ─── FormbitObject ─────────────────────────────────────────────────────────── + /** - * Object returned by useFormbit() and useFormbitContextHook() + * Object returned by useFormbit() and useFormbitContextHook(). * It contains all the data and methods needed to handle the form. - * */ export type FormbitObject = { - /** - * Checks the given json against the form schema and returns and array of errors. - * It returns undefined if the json is valid. - * - */ - check: Check>, + // --- State --- /** - * Returns the error message for the given path if any. - * It doesn't trigger any validation - * + * Object containing the updated form. */ - error: ErrorFn, + form: Partial, /** - * Object including all the registered errors messages since the last validation. + * Object including all the registered error messages since the last validation. * Errors are stored using the same path of the corresponding form values. * * @example * If the form object has this structure: - * ```json - * { - * "age": 1 - * } - * ``` - * and age is a non valid field, errors object will look like this - * ```json - * { - * "age": "Age must be greater then 18" - * } - * ``` - * - */ + * ```json + * { + * "age": 1 + * } + * ``` + * and age is a non valid field, errors object will look like this + * ```json + * { + * "age": "Age must be greater then 18" + * } + * ``` + */ errors: Errors, /** - * Object containing the updated form + * Returns true if the form is Dirty (user already interacted with the form), false otherwise. */ - form: Partial, + isDirty: boolean, + + // --- Queries --- /** - * Initialize the form with new initial values + * Returns the error message for the given path if any. + * It doesn't trigger any validation. */ - initialize: Initialize, + error: (path: string) => string | undefined, /** - * Returns true if the form is Dirty (user already interacted with the form), false otherwise. - * + * Returns true if the form is valid. + * It doesn't perform any validation, it checks if any errors are present. */ - isDirty: boolean, + isFormValid: () => boolean, /** - * Returns true if the form is NOT valid - * It doesn't perform any validation, it checks if any errors are present + * Returns true if the form is NOT valid. + * It doesn't perform any validation, it checks if any errors are present. */ - isFormInvalid: IsFormInvalid, + isFormInvalid: () => boolean, /** - * Returns true id the form is valid - * It doesn't perform any validation, it checks if any errors are present + * Returns true if live validation is active for the given path. */ - isFormValid: IsFormValid, + liveValidation: (path: string) => true | undefined, + + // --- Mutations --- /** - * Returns true if live validation is active for the given path + * This method updates the form state writing $value into the $path, setting isDirty to true. + * + * After writing, it validates all the paths contained into $pathsToValidate (if any) + * and all the fields that have the live validation active. */ - liveValidation: LiveValidationFn, + write: Write, /** + * This method takes an array of [path, value] and updates the form state writing + * all those values into the specified paths. * + * It sets isDirty to true. + * + * After writing, it validates all the paths contained into $pathToValidate and all + * the fields that have the live validation active. + */ + writeAll: WriteAll, + + /** * This method updates the form state deleting value, setting isDirty to true. * * After writing, it validates all the paths contained into pathsToValidate (if any) * and all the fields that have the live validation active. - * - * */ remove: Remove, + /** + * This method updates the form state deleting multiple values, setting isDirty to true. + */ + removeAll: RemoveAll, + + /** + * Initialize the form with new initial values. + */ + initialize: Initialize, + /** * Reset form to the initial state. * Errors and liveValidation are set back to empty objects. - * isDirty is set back to false - * + * isDirty is set back to false. */ - resetForm: ResetForm, + resetForm: () => void, /** - * Set a message(value) to the given error path. - * + * Set a message (value) to the given error path. */ setError: SetError, /** * Override the current schema with the given one. - * */ setSchema: SetSchema, /** - * Perform a validation against the current form object, and execute the successCallback if the validation pass - * otherwise it executes the errorCallback - * - */ - submitForm: SubmitForm, - - /** - * - * This method only validate the specified path. Do not check for fields that have the + * This method only validates the specified path. Does not check for fields that have the * live validation active. */ validate: Validate, /** - * - * This method only validate the specified paths. Do not check for fields that have the + * This method only validates the specified paths. Does not check for fields that have the * live validation active. */ validateAll: ValidateAll, /** - * This method validates the entire form and set the corresponding errors if any. - * + * This method validates the entire form and sets the corresponding errors if any. */ validateForm: ValidateForm>, /** - * - * This method update the form state writing $value into the $path, setting isDirty to true. - * - * After writing, it validates all the paths contained into $pathsToValidate (if any) - * and all the fields that have the live validation active. + * Perform a validation against the current form object, and execute the successCallback if the validation passes, + * otherwise it executes the errorCallback. */ - write: Write, + submitForm: SubmitForm, /** - * - * - * This method takes an array of [path, value] and update the form state writing - * all those values into the specified paths. - * - * It set isDirty to true. - * - * After writing, it validate all the paths contained into $pathToValidate and all - * the fields that have the live validation active. - */ - writeAll: WriteAll, - /** - * - * This method updates the form state deleting multiple values, setting isDirty to true. - * + * Checks the given json against the form schema and returns an array of errors. + * It returns undefined if the json is valid. */ - removeAll: RemoveAll + check: Check>, } diff --git a/src/use-execute-callbacks.ts b/src/use-execute-callbacks.ts index 766a6fa..8358e6a 100644 --- a/src/use-execute-callbacks.ts +++ b/src/use-execute-callbacks.ts @@ -1,5 +1,5 @@ import { useCallback, useEffect, useRef } from 'react' -import { GenericCallback, InitialValues, SetError, Writer } from './types' +import { FormState, GenericCallback, InitialValues, SetError } from './types' import { isEmpty } from 'lodash' /** @@ -10,8 +10,8 @@ import { isEmpty } from 'lodash' * * */ -export default (writer: Writer, setError: SetError) => { - const callbacksStore = useRef({}) +export default (writer: FormState, setError: SetError) => { + const callbacksStore = useRef> | undefined>>({}) useEffect(() => { if (isEmpty(callbacksStore.current)) { diff --git a/src/use-formbit.ts b/src/use-formbit.ts index e5c018e..250b410 100644 --- a/src/use-formbit.ts +++ b/src/use-formbit.ts @@ -5,13 +5,10 @@ import { import { ACTIONS } from './helpers/constants' import { Check, - ErrorFn, FormbitObject, + FormState, InitialValues, - IsFormInvalid, - IsFormValid, LiveValidation, - LiveValidationFn, PrivateValidateForm, Remove, RemoveAll, @@ -24,8 +21,7 @@ import { ValidationSchema, Write, WriteAll, - WriteOrRemove, - Writer + WriteOrRemove } from './types' import { isValidationError } from './types/helpers' import { validateSyncAll } from './validate-sync-all' @@ -44,7 +40,7 @@ export default ({ }: UseFormbitParams): FormbitObject => { const schemaRef = useRef>(schema) - const [writer, setWriter] = useState>>({ + const [writer, setWriter] = useState>>({ form: initialValues, initialValues, errors: {}, @@ -129,7 +125,7 @@ export default ({ } }()) - const newWriter: Writer> = { ...w, form, isDirty: true } + const newWriter: FormState> = { ...w, form, isDirty: true } if (paths.length === 0) { newUUID && executeCb(newUUID, successCallback) @@ -500,8 +496,8 @@ export default ({ const fn = () => setWriter((w) => ({ ...w, isDirty: false })) const successCallbackAndClearIsDirty: SuccessCallback> = (a, b) => { - // Success callback is called only if the form is valid so we can safely cast a as Writer - const writer = a as Writer + // Success callback is called only if the form is valid so we can safely cast a as FormState + const writer = a as FormState // __metadata is a field used to store metadata about the form and should not be submitted const { __metadata: _, ...form } = writer.form @@ -526,43 +522,48 @@ export default ({ })) }, []) - const isFormValid: IsFormValid = useCallback(() => { + const isFormValid = useCallback(() => { const { silent: _, ...e } = writer.errors return objLeaves(e).every((leaf) => !get(e, leaf)) }, [writer.errors]) - const isFormInvalid: IsFormInvalid = useCallback(() => { + const isFormInvalid = useCallback(() => { const { silent: _, ...e } = writer.errors return objLeaves(e).some((leaf) => get(e, leaf)) }, [writer.errors]) - const error: ErrorFn = useCallback((path: string) => get(writer.errors, path, undefined), [writer.errors]) + const error = useCallback((path: string): string | undefined => get(writer.errors, path, undefined), [writer.errors]) - const liveValidation: LiveValidationFn = useCallback( - (path: string) => get(writer.liveValidation, path, undefined), + const liveValidation = useCallback( + (path: string): true | undefined => get(writer.liveValidation, path, undefined), [writer.liveValidation] ) return { - check, - error, - errors: writer.errors, + // State form: writer.form, - initialize, + errors: writer.errors, isDirty: writer.isDirty, - isFormInvalid, + + // Queries + error, isFormValid, + isFormInvalid, liveValidation, + + // Mutations + write, + writeAll, remove, removeAll, + initialize, resetForm, setError, setSchema, - submitForm, validate, validateAll, validateForm, - write, - writeAll + submitForm, + check } }