diff --git a/public/robots.txt b/public/robots.txt new file mode 100644 index 000000000..d0fa53159 --- /dev/null +++ b/public/robots.txt @@ -0,0 +1,4 @@ +User-agent: * +Allow: / + +Sitemap: https://react-hook-form.com/sitemap.xml diff --git a/src/components/Menu/MenuLinks.ts b/src/components/Menu/MenuLinks.ts index e7391d385..3d725ce6b 100644 --- a/src/components/Menu/MenuLinks.ts +++ b/src/components/Menu/MenuLinks.ts @@ -114,6 +114,7 @@ export const apiLinks: Pages = [ { pathname: "/docs/useform/seterror", name: "setError" }, { pathname: "/docs/useform/clearerrors", name: "clearErrors" }, { pathname: "/docs/useform/setvalue", name: "setValue" }, + { pathname: "/docs/useform/setvalues", name: "setValues" }, { pathname: "/docs/useform/setfocus", name: "setFocus" }, { pathname: "/docs/useform/getvalues", name: "getValues" }, { pathname: "/docs/useform/getfieldstate", name: "getFieldState" }, diff --git a/src/components/UseController.tsx b/src/components/UseController.tsx deleted file mode 100644 index 2b7b8d162..000000000 --- a/src/components/UseController.tsx +++ /dev/null @@ -1,33 +0,0 @@ -import typographyStyles from "../styles/typography.module.css" -import Footer from "./Footer" -import containerStyles from "../styles/container.module.css" -import UseControllerContent from "./UseControllerContent" -import StarRepo from "./StarRepo" -import { Menu, apiLinks } from "./Menu" - -export default function UseController() { - return ( -
-

- useController -

-

- React hooks for controlled component -

- -
- - -
-
- - - -
- -
-
-
- ) -} diff --git a/src/components/UseControllerContent.tsx b/src/components/UseControllerContent.tsx deleted file mode 100644 index 251275046..000000000 --- a/src/components/UseControllerContent.tsx +++ /dev/null @@ -1,76 +0,0 @@ -import api from "../data/api" -import generic from "../data/generic" -import CodeArea from "./CodeArea" -import useController from "./codeExamples/useController" -import useControllerTs from "./codeExamples/useControllerTs" -import tableStyles from "../styles/table.module.css" -import typographyStyles from "../styles/typography.module.css" -import UseControllerMethods from "./UseControllerMethods" -import TabGroup from "./TabGroup" -import useControllerCheckboxes from "./codeExamples/useControllerCheckboxes" -import { SelectNav } from "./selectNav" - -export default function UseControllerContent() { - return ( - <> - - -

- useController: -
- {`(props?: UseControllerProps) => { field: object, fieldState: object, formState: object }`} -

-
- {api.useController.description} -

Props

-

- The following table contains information about the arguments for{" "} - useController. -

-
- - - - - - - - - - {api.useController.table} -
{generic.name}{generic.type}{generic.required}{generic.description}
-
- - - -

- Examples -

- - - - - - - - {api.useController.tips} - - ) -} diff --git a/src/components/UseControllerMethods.tsx b/src/components/UseControllerMethods.tsx deleted file mode 100644 index 35efa6ad1..000000000 --- a/src/components/UseControllerMethods.tsx +++ /dev/null @@ -1,214 +0,0 @@ -import generic from "../data/generic" -import tableStyles from "../styles/table.module.css" -import typographyStyles from "../styles/typography.module.css" -import Link from "next/link" -import { FormStateApi } from "./FormStateApi" - -const UseControllerMethods = ({ - isController = false, -}: { - isController: boolean -}) => { - return ( - <> -

Return

-

- The following table contains information about properties which{" "} - {isController ? "Controller" : "useController"} produces. -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Object Name{generic.name}{generic.type}{generic.description}
- field - - onChange - - - {"(value: any) => void"} - - -

A function which sends the input's value to the library.

-
    -
  • - It should be assigned to the onChange prop of the - input and value should{" "} - - not be undefined - - . -
  • -
  • -

    - This prop update{" "} - - formState - {" "} - and you should avoid manually invoke{" "} - - setValue - {" "} - or other API related to field update. -

    -
  • -
-
- field - - onBlur - - {"() => void"} - -

- A function which sends the input's onBlur event to the library. - It should be assigned to the input's onBlur prop. -

-
- field - - value - - unknown - -

The current value of the controlled component.

-
- field - - disabled - - boolean - -

The disabled state of the input.

-
- field - - name - - string - -

Input's name being registered.

-
- field - - ref - - React.Ref - -

- A ref used to connect hook form to the input. Assign{" "} - ref to component's input ref to allow hook form to - focus the error input. -

-
- fieldState - - invalid - - boolean - -

Invalid state for current input.

-
- fieldState - - isTouched - - boolean - -

Touched state for current controlled input.

-
- fieldState - - isDirty - - boolean - -

Dirty state for current controlled input.

-
- fieldState - - error - - object - -

error for this specific input.

-
- - ) -} - -export default UseControllerMethods diff --git a/src/components/UseFieldArray.tsx b/src/components/UseFieldArray.tsx deleted file mode 100644 index 23bc17140..000000000 --- a/src/components/UseFieldArray.tsx +++ /dev/null @@ -1,31 +0,0 @@ -import typographyStyles from "../styles/typography.module.css" -import Footer from "./Footer" -import containerStyles from "../styles/container.module.css" -import UseFieldArrayContent from "./UseFieldArrayContent" -import StarRepo from "./StarRepo" -import { Menu, apiLinks } from "./Menu" - -export default function UseFieldArray() { - return ( -
-

- useFieldArray -

-

React hooks for Field Array

- -
- - -
-
- - - -
- -
-
-
-
- ) -} diff --git a/src/components/UseFieldArrayContent.tsx b/src/components/UseFieldArrayContent.tsx deleted file mode 100644 index 3271b3a5c..000000000 --- a/src/components/UseFieldArrayContent.tsx +++ /dev/null @@ -1,297 +0,0 @@ -import generic from "../data/generic" -import api from "../data/api" -import CodeArea from "./CodeArea" -import useFieldArray from "./codeExamples/useFieldArray" -import typographyStyles from "../styles/typography.module.css" -import tableStyles from "../styles/table.module.css" -import TabGroup from "./TabGroup" -import useFieldArrayConditional from "./codeExamples/useFieldArrayConditional" -import useFieldArrayTS from "./codeExamples/useFieldArrayTS" -import useFieldArrayFocus from "./codeExamples/useFieldArrayFocus" -import Link from "next/link" -import useFieldArrayPreview from "./codeExamples/useFieldArrayPreview" - -export default function UseFieldArrayContent() { - return ( - <> - -

- useFieldArray:{" "} - - - UseFieldArrayProps - - -

-
- - {api.useFieldArray.description} - -

Return

- -
- - - - - - - - {api.useFieldArray.table} - -
{generic.name}{generic.type}{generic.description}
-
- -

- Rules -

- - - -

TypeScript

- - - -

- Examples -

- - - - - - - - -

Video

-

- The following video explains the basic usage of{" "} - useFieldArray. -

- -