diff --git a/client/package-lock.json b/client/package-lock.json index 4aec4b2..16e7264 100644 --- a/client/package-lock.json +++ b/client/package-lock.json @@ -18,6 +18,7 @@ "react": "^19.1.0", "react-dom": "^19.1.0", "react-grid-layout": "^1.5.2", + "react-hook-form": "^7.62.0", "react-icons": "^5.5.0", "react-leaflet": "^5.0.0", "react-resizable": "^3.0.5", @@ -4301,6 +4302,22 @@ "react-dom": ">= 16.3.0" } }, + "node_modules/react-hook-form": { + "version": "7.62.0", + "resolved": "https://registry.npmjs.org/react-hook-form/-/react-hook-form-7.62.0.tgz", + "integrity": "sha512-7KWFejc98xqG/F4bAxpL41NB3o1nnvQO1RWZT3TqRZYL8RryQETGfEdVnJN2fy1crCiBLLjkRBVK05j24FxJGA==", + "license": "MIT", + "engines": { + "node": ">=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/react-hook-form" + }, + "peerDependencies": { + "react": "^16.8.0 || ^17 || ^18 || ^19" + } + }, "node_modules/react-icons": { "version": "5.5.0", "resolved": "https://registry.npmjs.org/react-icons/-/react-icons-5.5.0.tgz", diff --git a/client/package.json b/client/package.json index c14d34c..e3e4718 100644 --- a/client/package.json +++ b/client/package.json @@ -20,6 +20,7 @@ "react": "^19.1.0", "react-dom": "^19.1.0", "react-grid-layout": "^1.5.2", + "react-hook-form": "^7.62.0", "react-icons": "^5.5.0", "react-leaflet": "^5.0.0", "react-resizable": "^3.0.5", diff --git a/client/src/components/layout/Canvas/views/AccountCanvas.jsx b/client/src/components/layout/Canvas/views/AccountCanvas.jsx index 57643df..ef1465d 100644 --- a/client/src/components/layout/Canvas/views/AccountCanvas.jsx +++ b/client/src/components/layout/Canvas/views/AccountCanvas.jsx @@ -1,13 +1,26 @@ -import { Box, Flex, Field, Input, Stack, Switch, Text, Heading } from "@chakra-ui/react" +import { Box, Flex, Field, Input, Stack, Heading, Button } from "@chakra-ui/react" +import { useForm } from 'react-hook-form'; export default function AccountCanvas() { + const { + register, + handleSubmit, + watch, + formState: { errors }, + } = useForm(); + + const onSubmit = (data) => { + console.log("Form submitted:", data); + } + + console.log(watch("example")); // watch input value by passing the name of it + return ( Account User Name - + First Name - + Last Name - + Email - + - {/* - Hide email - - - - - */} + +