Skip to content
Merged

V6 #252

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
219 commits
Select commit Hold shift + click to select a range
965981f
set up v5 fundation
bluebill1049 May 3, 2020
fbb6e53
fix the build
bluebill1049 May 3, 2020
2d1470a
get both v5 and v6 running
bluebill1049 May 3, 2020
23fb8a5
clean up v5/v6 docs
bluebill1049 May 3, 2020
d1f7e56
update on v6 on api page
bluebill1049 May 3, 2020
f4e6321
more v6 clean up
bluebill1049 May 3, 2020
05e6742
more page update
bluebill1049 May 3, 2020
402d0e3
update valdiation resolver
bluebill1049 May 3, 2020
e9a976f
update react-hook-form-devtools
bluebill1049 May 3, 2020
4b15ff3
fix ts page
bluebill1049 May 3, 2020
bdaa686
fix path
bluebill1049 May 3, 2020
bc67b5d
fix path
bluebill1049 May 3, 2020
e1578c5
fix path
bluebill1049 May 3, 2020
c48d01e
Insert 'clearError' method (#253)
eatdesignlove May 3, 2020
bfc94a4
Update setError.ts
bluebill1049 May 3, 2020
f14cc53
more update on V6
bluebill1049 May 9, 2020
d8544cd
update
bluebill1049 May 9, 2020
e388b08
update on formContext
bluebill1049 May 9, 2020
3b3fb63
fix link
bluebill1049 May 9, 2020
053fea6
remove extra line
bluebill1049 May 9, 2020
8fcaf78
Merge branch 'master' into V6
bluebill1049 May 9, 2020
648afb7
update yarn.lock
bluebill1049 May 9, 2020
4325bba
update useform content
bluebill1049 May 9, 2020
05b97df
include useWatch
bluebill1049 May 9, 2020
f25af7d
useWatch other lang
bluebill1049 May 9, 2020
2e00ba4
update docs around resolver
bluebill1049 May 9, 2020
b13d7bf
pretiter
bluebill1049 May 9, 2020
392c08b
update package version
bluebill1049 May 9, 2020
90a0649
animation on side nav bar
bluebill1049 May 10, 2020
f9c8a85
include migration guide page
bluebill1049 May 10, 2020
98639b1
fix lang selection
bluebill1049 May 10, 2020
3eab837
update nav url
bluebill1049 May 10, 2020
21efc3e
working on the TS page
bluebill1049 May 10, 2020
d03c134
try to fix css module with ts
bluebill1049 May 10, 2020
d67f28b
update all the page with location
bluebill1049 May 10, 2020
3cc8448
Merge branch 'master' into V6
bluebill1049 May 10, 2020
2a0637b
Merge branch 'master' into V6
bluebill1049 May 17, 2020
30988e2
update doc for formstate
bluebill1049 May 17, 2020
69027e0
Merge branch 'master' into V6
bluebill1049 May 17, 2020
04d724a
move schema validation to get started page
bluebill1049 May 18, 2020
ed8ecc2
update resolver doc on get started
bluebill1049 May 18, 2020
e6a0551
update migration guide with dirty/dirtyFields
bluebill1049 May 18, 2020
a37dbef
update resolver supports
bluebill1049 May 18, 2020
93532ae
Merge branch 'master' into V6
bluebill1049 May 18, 2020
4127457
update resolver docs
bluebill1049 May 18, 2020
58f18f6
update resource with animation
bluebill1049 May 18, 2020
19be336
update CSB for get started page
bluebill1049 May 20, 2020
1eff3f4
update resolver example
bluebill1049 May 20, 2020
c26fc48
update codesandboxs
bluebill1049 May 20, 2020
7017648
fix apiPage all codesandbox
bluebill1049 May 20, 2020
fdf5634
include exported TS type
bluebill1049 May 20, 2020
14ed53b
update package location
bluebill1049 May 20, 2020
726aa7f
Update DevTools.tsx
bluebill1049 May 20, 2020
1aaa031
update sub title
bluebill1049 May 21, 2020
db741ef
translating migration v5 to v6 page to pt (#267)
vitorboccio May 22, 2020
48cdbe6
update spansih migration guide
bluebill1049 May 22, 2020
6de7886
get migration guide ready
bluebill1049 May 22, 2020
55103eb
Merge branch 'master' into V6
bluebill1049 May 22, 2020
d4516f9
update packages
bluebill1049 May 23, 2020
8aafb23
watching input change section
bluebill1049 May 23, 2020
67ff33d
content update
bluebill1049 May 23, 2020
db89d1a
fix style
bluebill1049 May 23, 2020
71efefa
indicate lib package size
bluebill1049 May 23, 2020
eb497f9
update doc on useFieldArray
bluebill1049 May 24, 2020
bb96008
include another video from japanese
bluebill1049 May 25, 2020
6430d63
working animmation
bluebill1049 May 25, 2020
b4e6e9d
working animation
bluebill1049 May 25, 2020
6316799
refine animation
bluebill1049 May 25, 2020
88840d3
sort out animation order
bluebill1049 May 25, 2020
18edce6
improve animation code
bluebill1049 May 25, 2020
0d64d5b
fix animation sequence
bluebill1049 May 25, 2020
6343701
include shouldFocus prop
bluebill1049 May 25, 2020
c28fdaa
Merge branch 'master' into V6
bluebill1049 May 25, 2020
6570f30
Merge branch 'master' into V6
bluebill1049 May 26, 2020
a04ac86
error messaage component
bluebill1049 May 26, 2020
0ab76b3
update on TS page
bluebill1049 May 26, 2020
d91aaf0
include description for all types
bluebill1049 May 26, 2020
0da164a
include animation for migrate guide
bluebill1049 May 26, 2020
7734b7e
fix home page animation
bluebill1049 May 26, 2020
98e3bcf
rename OnSubmit to SubmitHandler
kotarella1110 May 27, 2020
fe478cd
complete watch section at home page
bluebill1049 May 27, 2020
40b83c5
Improved ApiPage bundle size (#278)
keiya01 May 31, 2020
5fcbb8f
Fixed path (#279)
keiya01 May 31, 2020
beec30f
Fixed ApiPageV5 (#280)
keiya01 May 31, 2020
73ebe7e
Improved FaqPage perf (#281)
keiya01 Jun 1, 2020
fd51364
Split the bundle on each page (#282)
keiya01 Jun 1, 2020
b34a7c6
Improved performance DevTool page (#283)
keiya01 Jun 1, 2020
79ae38c
fix bugs (#285)
kotarella1110 Jun 1, 2020
b00d6b1
fix error message type and update for v6 (#284)
kotarella1110 Jun 1, 2020
59b9006
fix build
bluebill1049 Jun 2, 2020
11fd0ab
Merge branch 'master' into V6
bluebill1049 Jun 2, 2020
39663da
close #1749 around controller rules update
bluebill1049 Jun 2, 2020
44590de
fix build
bluebill1049 Jun 2, 2020
3dfcb70
prepare ts pages ready for other langs
bluebill1049 Jun 4, 2020
b95d2c3
Correct V5 & V6 Docs + added ts-codesandbox (#289)
pmaier983 Jun 6, 2020
f020195
Feature/ts codesandbox (#290)
pmaier983 Jun 7, 2020
dace1d7
translate content for ts page
bluebill1049 Jun 5, 2020
58b0102
include controller api update
bluebill1049 Jun 5, 2020
2876603
update more examples
bluebill1049 Jun 5, 2020
ae3108c
update example for codesandbox
bluebill1049 Jun 5, 2020
e55859a
update conditional input
bluebill1049 Jun 5, 2020
016054e
update order
bluebill1049 Jun 5, 2020
a328f85
fix home page contrast with light mode
bluebill1049 Jun 5, 2020
6a870b4
close #286 issue around dirty file
bluebill1049 Jun 5, 2020
a5d3ca7
close #250 around inital render with defaultValues
bluebill1049 Jun 5, 2020
27e01fa
include example for modal
bluebill1049 Jun 7, 2020
c4ac6a1
translate other lang
bluebill1049 Jun 7, 2020
9890935
Feature/ts codesandbox (#291)
pmaier983 Jun 7, 2020
138306c
Merge branch 'master' into V6
bluebill1049 Jun 8, 2020
67fe198
update to submitFocusError
bluebill1049 Jun 10, 2020
c6b1a36
fix sentence for resolver
bluebill1049 Jun 11, 2020
d29a4c8
include shouldUnregister
bluebill1049 Jun 11, 2020
32d351e
fix translation with unregister and fix some russian translation
bluebill1049 Jun 12, 2020
2a0d1f2
update with error message with @hookform
bluebill1049 Jun 12, 2020
034b18c
update home page panel
bluebill1049 Jun 12, 2020
edccef6
update packages
bluebill1049 Jun 12, 2020
8efcde5
update doc for controller
bluebill1049 Jun 12, 2020
875bdf1
update on get started page
bluebill1049 Jun 12, 2020
ee91f9b
fix get started page
bluebill1049 Jun 12, 2020
443b651
imporve getValues doc
bluebill1049 Jun 12, 2020
024092d
update getvalues for all and get translated tmr
bluebill1049 Jun 12, 2020
c8a3ab5
include videos links for section
bluebill1049 Jun 13, 2020
4b2f07f
fix style
bluebill1049 Jun 13, 2020
1c7c8bc
translate getValues api
bluebill1049 Jun 13, 2020
79879a8
update doc
bluebill1049 Jun 13, 2020
8418fe6
update doc
bluebill1049 Jun 13, 2020
218eeda
Feature/get started example update (#296)
pmaier983 Jun 13, 2020
4bdfba7
remove extra install
bluebill1049 Jun 13, 2020
90619e4
more doc update
bluebill1049 Jun 13, 2020
4747d9a
revert a CSB
bluebill1049 Jun 13, 2020
566e0bd
more doc update
bluebill1049 Jun 13, 2020
c6e9e76
update on resource page
bluebill1049 Jun 13, 2020
018d5b1
update get started page
bluebill1049 Jun 13, 2020
eba99d5
include migration guide for error message
bluebill1049 Jun 14, 2020
bd41680
Merge branch 'master' into V6
bluebill1049 Jun 14, 2020
1068080
clean up advance page
bluebill1049 Jun 14, 2020
e8d3be5
change all alert to console
bluebill1049 Jun 14, 2020
20384cc
update resource page style
bluebill1049 Jun 14, 2020
d9d9655
fix api and footer
bluebill1049 Jun 14, 2020
d0ca4d3
fix link nav
bluebill1049 Jun 14, 2020
1d25e09
include info about react native testing
bluebill1049 Jun 15, 2020
552302f
close #1868 useFieldArray doesn't support conditional render
bluebill1049 Jun 15, 2020
6b4026d
update error message size
bluebill1049 Jun 16, 2020
fa7b415
update with videos
bluebill1049 Jun 16, 2020
c359db9
Feature/get-started-example-update (#298)
pmaier983 Jun 16, 2020
67875be
update video section and more resource
bluebill1049 Jun 17, 2020
9a2c462
update useWatch and useFieldArray doc
bluebill1049 Jun 17, 2020
9bf9603
finish translate all content
bluebill1049 Jun 17, 2020
73e00ad
clean up the object type
bluebill1049 Jun 17, 2020
b7a61f6
Add all to useForm mode (#297)
pmaier983 Jun 17, 2020
7de01b2
Update Important Code Sandbox + Add TS examples (#299)
pmaier983 Jun 17, 2020
aaf2dd8
Translate spanish (#300)
chestergalindo Jun 18, 2020
ba86bcd
update setValue api
bluebill1049 Jun 18, 2020
4500b1d
fix button focus effect
bluebill1049 Jun 18, 2020
af87689
Feature/get started example update (#302)
pmaier983 Jun 18, 2020
44dd1c6
update migration guide
bluebill1049 Jun 19, 2020
960ccf6
Translate spanish (#301)
chestergalindo Jun 19, 2020
f66c142
fix all the code gap
bluebill1049 Jun 19, 2020
16a2c6f
update codesandbox
bluebill1049 Jun 19, 2020
e89b5a1
Fix type signature for handleSubmit in docs (#303)
bpartridge Jun 19, 2020
0c69b7d
Misc. Fix's and add SubmitHandler clarification (#304)
pmaier983 Jun 20, 2020
5da7eb9
rename to clearErrors
bluebill1049 Jun 20, 2020
b510684
Merge branch 'master' into V6
bluebill1049 Jun 20, 2020
7ed43c4
fix doc on setValue
bluebill1049 Jun 20, 2020
b78419e
Support i18n in Subscribe Input Change section in Home (#305)
keiya01 Jun 21, 2020
bbefd52
Translated to jp in FAQs page (#306)
keiya01 Jun 21, 2020
f60dc17
fix link with api version toggle
bluebill1049 Jun 21, 2020
8d9d19b
fix doc about clearErrors
bluebill1049 Jun 21, 2020
0ed8352
fix clear errors link
bluebill1049 Jun 22, 2020
d91bbe3
Small Bug Fix and CodeSandbox v5/v6 seperation (#307)
pmaier983 Jun 23, 2020
4de9ba9
fix examples with email regex to support all TLD's (#308)
sandcastle Jun 23, 2020
c7d6db4
[updated] review advanced page (#310)
chestergalindo Jun 23, 2020
e384c28
v6 and v5 seperation for ApiErrors + i18n work (#309)
pmaier983 Jun 23, 2020
368364b
Update watch Code Examples and CodeSandbox's (#311)
pmaier983 Jun 24, 2020
3778716
Feature/api doc work (#312)
pmaier983 Jun 25, 2020
0e2fd55
clean up the copy button
bluebill1049 Jun 25, 2020
b5511c9
only show JS icon if TS code is present
bluebill1049 Jun 25, 2020
4f6f732
include new video
bluebill1049 Jun 25, 2020
f6c935e
remove lodash from codeArea & enhance logic (#313)
pmaier983 Jun 25, 2020
d24aa17
Adds eslint and fixes all resulting errors (#314)
pmaier983 Jun 26, 2020
04c54be
Update watch CodeExample + TS Code (#315)
pmaier983 Jun 26, 2020
555bb3a
update doc with v6 banner
bluebill1049 Jun 26, 2020
39993ce
finalise the banner
bluebill1049 Jun 26, 2020
c670327
add is live
bluebill1049 Jun 26, 2020
2f2ac1c
update title
bluebill1049 Jun 26, 2020
f84227c
fix padding and font size
bluebill1049 Jun 26, 2020
6b7e6f3
Added Reset Example and CodeSandbox (#316)
pmaier983 Jun 27, 2020
ee9047d
Expand/improve setError Docs (#318)
pmaier983 Jun 27, 2020
fb3b193
update banner with CTA
bluebill1049 Jun 27, 2020
5ecc339
Added test tutorial (#317)
keiya01 Jun 28, 2020
59ed232
reduce couple lines with test example code
bluebill1049 Jun 28, 2020
8ae8505
add back id
bluebill1049 Jun 28, 2020
937327a
remmove spectrum icon
bluebill1049 Jun 28, 2020
9607f81
refine testing description
bluebill1049 Jun 28, 2020
bdd2bf8
fix bugs (#319)
keiya01 Jun 28, 2020
364f8c2
translate contents
bluebill1049 Jun 28, 2020
9ecef7f
revise korean translation - Home (#266)
adhrinae Jun 28, 2020
8587188
use `currentLanguage` data to 'TS Support' page
adhrinae Jun 28, 2020
de12ebb
revise korean translation - TS Support (#266)
adhrinae Jun 28, 2020
5c90cc2
translate to jp (#321)
keiya01 Jun 28, 2020
634edcb
revise korean translation - Advanced'(#266)
adhrinae Jun 28, 2020
3f9372e
revise korean translation - FAQs (#266)
adhrinae Jun 28, 2020
e7618da
revise korean translations - Misc (#266)
adhrinae Jun 28, 2020
a9886cb
fixed sentence (#322)
keiya01 Jun 28, 2020
2724f05
Enhance clearError docs + fix bug (#323)
pmaier983 Jun 28, 2020
7cf0391
Improve English in formState (#326)
dandv Jun 29, 2020
ddb2a1a
fix the typo on multiple error
bluebill1049 Jun 29, 2020
e094e3f
include extra resource
bluebill1049 Jun 29, 2020
4e0dfd7
update dot points
bluebill1049 Jun 29, 2020
ab271e5
fix missing `isDirty` connection on API page
adhrinae Jun 29, 2020
5b0865d
revise korean translation - V6 API docs (#266)
adhrinae Jun 29, 2020
164fb9d
Merge branch 'master' into V6
bluebill1049 Jun 29, 2020
f0ceebf
Enhance setValue Docs (#327)
pmaier983 Jun 30, 2020
680372c
V6 (#328)
chestergalindo Jun 30, 2020
53101cd
update doc on should unregister
bluebill1049 Jun 30, 2020
420a40f
Enhance getValue Docs (#329)
pmaier983 Jul 1, 2020
d248960
add more video resource
bluebill1049 Jul 1, 2020
4f7a6d3
update table title and design
bluebill1049 Jul 1, 2020
d768d15
fixed code example
keiya01 Jul 1, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
37 changes: 37 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
const OFF = 0
const WARN = 1
const ERROR = 2

module.exports = {
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaVersion: 2020,
sourceType: "module",
ecmaFeatures: {
jsx: true,
},
},
extends: [
"plugin:react/recommended",
"plugin:@typescript-eslint/recommended",
// "plugin:jsx-a11y/recommended", // TODO
"prettier/@typescript-eslint",
"plugin:prettier/recommended",
],
settings: {
react: {
version: "detect",
},
},
rules: {
// typescript
"@typescript-eslint/explicit-function-return-type": OFF,
"@typescript-eslint/interface-name-prefix": OFF,
"@typescript-eslint/explicit-module-boundary-types": OFF,
// react
"react/display-name": OFF,
"react/prop-types": OFF,
"react/jsx-no-target-blank": WARN,
"react/no-unescaped-entities": WARN,
},
}
1 change: 1 addition & 0 deletions gatsby-config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// eslint-disable-next-line @typescript-eslint/no-var-requires
const languages = require("./src/data/languages")

module.exports = {
Expand Down
50 changes: 29 additions & 21 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,43 +1,51 @@
{
"name": "react-hook-form-website",
"description": "React hooks for form validation without the hassle.",
"version": "3.1.0",
"version": "6.0.0",
"author": "beier luo",
"engines": {
"node": "12.x"
},
"dependencies": {
"gatsby": "2.21.21",
"gatsby-image": "2.4.3",
"gatsby-plugin-google-analytics": "2.3.1",
"@hookform/devtools": "2.0.0-beta.1",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any reason hookform/devtools is not in devDependencies. (Also we should bump to 1.2.1). Will create PR in the near future.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its a specail build, because normally devtool export null in prod.

"gatsby": "2.23.3",
"gatsby-image": "2.4.7",
"gatsby-plugin-google-analytics": "2.3.4",
"gatsby-plugin-gtag": "1.0.13",
"gatsby-plugin-i18n": "^1.0.1",
"gatsby-plugin-manifest": "2.4.2",
"gatsby-plugin-nprogress": "^2.3.1",
"gatsby-plugin-react-helmet": "3.3.1",
"gatsby-plugin-sharp": "2.6.2",
"gatsby-plugin-sitemap": "2.4.2",
"gatsby-plugin-typescript": "2.4.2",
"gatsby-source-filesystem": "2.3.1",
"gatsby-transformer-sharp": "2.5.2",
"little-state-machine": "^3.0.0",
"gatsby-plugin-manifest": "2.4.11",
"gatsby-plugin-nprogress": "^2.3.4",
"gatsby-plugin-react-helmet": "3.3.4",
"gatsby-plugin-sharp": "2.6.11",
"gatsby-plugin-sitemap": "2.4.5",
"gatsby-plugin-typescript": "2.4.6",
"gatsby-source-filesystem": "2.3.11",
"gatsby-transformer-sharp": "2.5.5",
"gatsby-transformer-typescript-css-modules": "^1.0.14",
"little-state-machine": "^3.0.2",
"prismjs": "^1.20.0",
"ptz-i18n": "^1.0.0",
"react": "16.13.1",
"react-dom": "16.13.1",
"react-github-btn": "1.2.0",
"react-helmet": "5.2.1",
"react-hook-form": "4.9.3",
"react-hook-form-devtools": "1.0.2-beta.2",
"react-simple-animate": "^3.3.4",
"react-hook-form": "6.0.0-rc.1",
"react-simple-animate": "^3.3.9",
"react-simple-img": "2.3.7",
"react-sortablejs": "1.5.1",
"sortablejs": "1.10.2"
},
"devDependencies": {
"gatsby-plugin-offline": "^3.2.1",
"@typescript-eslint/eslint-plugin": "^3.4.0",
"@typescript-eslint/parser": "^3.4.0",
"eslint": "^7.3.1",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-jsx-a11y": "^6.3.1",
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-react": "^7.20.0",
"gatsby-plugin-offline": "^3.2.9",
"husky": "^4.2.5",
"lint-staged": "^10.2.2",
"lint-staged": "^10.2.9",
"prettier": "2.0.5"
},
"keywords": [
Expand All @@ -52,7 +60,8 @@
"start": "npm run develop",
"serve": "gatsby serve",
"now-build": "npm run build",
"prettier": "prettier --write './src/**/*.ts' './src/**/*.tsx' --config ./.prettierrc"
"prettier": "prettier --write './src/**/*.ts' './src/**/*.tsx' --config ./.prettierrc",
"lint": "eslint . --ext .js,.jsx,.ts,.tsx --fix"
},
"repository": {
"type": "git",
Expand All @@ -68,8 +77,7 @@
},
"lint-staged": {
"*.{ts,tsx}": [
"npm run format",
"npm run prettier"
"npm run format"
]
}
}
90 changes: 44 additions & 46 deletions src/components/AdvancedPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,55 +4,55 @@ import SideMenu from "./SideMenu"
import Footer from "./Footer"
import fieldArray from "./codeExamples/fieldArray"
import unregisterControlledComponent from "./codeExamples/unregisterControlledComponent"
import copyClipBoard from "./utils/copyClipBoard"
import schemaValidation from "./codeExamples/schemaValidation"
import conditionalComponent from "./codeExamples/conditionalComponent"
import connectForm from "./codeExamples/connectForm"
import formContextPerformance from "./codeExamples/formContextPerformance"
import StarRepo from "./StarRepo"
import generic from "../data/generic"
import { useStateMachine } from "little-state-machine"
import advancedContent from "../data/advanced"
import advancedEn from "../data/en/advanced"
import controlledMixedUncontrolled from "./codeExamples/controlledMixedUncontrolled"
import TabGroup from "./TabGroup"
import unregisterWrapControlledComponent from "./codeExamples/unregisterWrapControlledComponent"
import controlledMixedUncontrolledInput from "./codeExamples/controlledMixedUncontrolledInput"
import useFieldArray from "./codeExamples/useFieldArray"
import typographyStyles from "../styles/typography.module.css"
import codeAreaStyles from "./CodeArea.module.css"
import containerStyles from "../styles/container.module.css"
import getStartedStyles from "./GetStarted.module.css"

const { useRef } = React
const advancedEn = advancedContent["en"]
const enLinks = [
advancedEn.accessibility,
advancedEn.wizard,
advancedEn.smartForm,
advancedEn.fieldArrays,
advancedEn.schema,
advancedEn.errorMessage,
advancedEn.connectForm,
advancedEn.formContext,
advancedEn.conditionalControlledComponent,
advancedEn.controlledMixedWithUnControlled,
advancedEn.customHookWithValidationResolver,
advancedEn.workingWithVirtualizedList,
advancedEn.testingForm,
]

function Advanced({ defaultLang }: { defaultLang: string }) {
interface Props {
defaultLang: string
advanced: any
}

function Advanced({ defaultLang, advanced }: Props) {
const pageContentRef = useRef({
AccessibilityA11y: null,
WizardFormFunnel: null,
SmartFormComponent: null,
FieldArrays: null,
SchemaValidation: null,
ConnectForm: null,
FormContextPerformance: null,
ErrorMessages: null,
ConditionalControlledComponent: null,
ControlledmixedwithUncontrolledComponents: null,
CustomHookwithValidationResolver: null,
Workingwithvirtualizedlists: null,
TestingForm: null,
})

const {
Expand All @@ -62,21 +62,20 @@ function Advanced({ defaultLang }: { defaultLang: string }) {
language && language.currentLanguage
? language
: { currentLanguage: defaultLang }
const advanced = advancedContent[currentLanguage]

const links = [
advanced.accessibility,
advanced.wizard,
advanced.smartForm,
advanced.fieldArrays,
advanced.schema,
advanced.errorMessage,
advanced.connectForm,
advanced.formContext,
advanced.conditionalControlledComponent,
advanced.controlledMixedWithUnControlled,
advanced.customHookWithValidationResolver,
advanced.workingWithVirtualizedList,
advanced.testingForm,
]

const goToSection = (name) => {
Expand Down Expand Up @@ -189,39 +188,6 @@ function Advanced({ defaultLang }: { defaultLang: string }) {

<hr />

<h2
className={typographyStyles.questionTitle}
ref={(ref) => (pageContentRef.current.SchemaValidation = ref)}
>
{advanced.schema.title}
</h2>

{advanced.schema.description}

{advanced.schema.step1}

<span className={getStartedStyles.installCode}>
npm install yup
<button
className={getStartedStyles.copyButton}
onClick={() => {
copyClipBoard("npm install yup")
alert("Code copied into your clipboard.")
}}
>
{generic.copy[currentLanguage]}
</button>
</span>

{advanced.schema.step2}

<CodeArea
rawData={schemaValidation}
url="https://codesandbox.io/s/928po918qr"
/>

<hr />

<h2
className={typographyStyles.questionTitle}
ref={(ref) => (pageContentRef.current.ErrorMessages = ref)}
Expand Down Expand Up @@ -298,7 +264,11 @@ function Advanced({ defaultLang }: { defaultLang: string }) {

{advanced.conditionalControlledComponent.description}

<TabGroup buttonLabels={["Controller", "Custom Register"]}>
<TabGroup buttonLabels={["Normal", "Controller", "Custom Register"]}>
<CodeArea
rawData={conditionalComponent}
url="https://codesandbox.io/s/react-hook-form-conditional-inputs-c7n0r"
/>
<CodeArea rawData={unregisterWrapControlledComponent} />
<CodeArea
rawData={unregisterControlledComponent}
Expand Down Expand Up @@ -353,6 +323,34 @@ function Advanced({ defaultLang }: { defaultLang: string }) {

{advanced.workingWithVirtualizedList.description}

<hr />

<h2
className={typographyStyles.questionTitle}
ref={(ref) => (pageContentRef.current.TestingForm = ref)}
>
{advanced.testingForm.title}
</h2>

{/* TODO: record a video */}

{/* <p>
In this video tutorial, I have demonstrated how to test with React
Hook Form.
</p> */}

{/* <iframe
width="100%"
height="528"
title="The way of testing with React Hook Form - video tutorial"
src="https://www.youtube.com/embed/CeAkxVwsyMU"
frameBorder="0"
allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture"
allowFullScreen
/> */}

{advanced.testingForm.description}

<StarRepo currentLanguage={currentLanguage} />

<Footer currentLanguage={currentLanguage} />
Expand Down
26 changes: 21 additions & 5 deletions src/components/ApiErrors.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,24 @@ import * as React from "react"
import CodeArea from "./CodeArea"
import errorCode from "./codeExamples/errorCode"
import errorCodeTs from "./codeExamples/errorCodeTs"
import errorCodeTypes from "./codeExamples/ErrorCodeTypes"
import generic from "../data/generic"
import multipleErrorCode from "./codeExamples/multipleErrorCode"
import multipleErrorCodeTs from "./codeExamples/multipleErrorCodeTs"
import TabGroup from "./TabGroup"
import typographyStyles from "../styles/typography.module.css"
import tableStyles from "../styles/table.module.css"

export default React.memo(
({ api, currentLanguage }: { api: any; currentLanguage: string }) => {
({
api,
currentLanguage,
goToSection,
}: {
api: any
currentLanguage: string
goToSection: (name: any, animate?: boolean) => void
}) => {
return (
<>
<code className={typographyStyles.codeHeading}>
Expand Down Expand Up @@ -65,7 +75,9 @@ export default React.memo(
<code>message</code>
</td>
<td>
<span className={typographyStyles.typeText}>string</span>
<span className={typographyStyles.typeText}>
string | React.ReactElement
</span>
</td>
<td>{api.errors.message}</td>
</tr>
Expand All @@ -82,18 +94,22 @@ export default React.memo(
</tr>
</tbody>
</table>
{api.errors.note(goToSection)}
</div>

<TabGroup buttonLabels={["First error detected", "Display all errors"]}>
<CodeArea
rawData={errorCode}
tsRawData={errorCodeTs}
url="https://codesandbox.io/s/nrr4n9p8n4"
tsUrl="https://codesandbox.io/s/xenodochial-albattani-tcx0n?file=/src/App.tsx"
rawTypes={errorCodeTypes}
url="https://codesandbox.io/s/react-hook-form-error-v6-rcpm8"
tsUrl="https://codesandbox.io/s/react-hook-form-error-ts-v6-500eo"
/>
<CodeArea
rawData={multipleErrorCode}
url="https://codesandbox.io/s/react-hook-form-errors-validatecriteriamode-all-qbskc"
tsRawData={multipleErrorCodeTs}
url="https://codesandbox.io/s/react-hook-form-validatecriteriamode-v6-tixtl"
tsUrl="https://codesandbox.io/s/react-hook-form-validatecriteriamode-v6-ts-r51li"
/>
</TabGroup>

Expand Down
Loading