@homefile/components-v2 1.4.0 → 1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/onboarding/pages/SignIn.d.ts +1 -1
- package/dist/components/onboarding/pages/SignIn.js +5 -9
- package/dist/interfaces/pages/SignIn.interface.d.ts +1 -1
- package/package.json +1 -1
- package/src/components/onboarding/pages/SignIn.tsx +9 -18
- package/src/interfaces/pages/SignIn.interface.ts +2 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { SignInI } from '../../../interfaces';
|
|
2
|
-
export declare const SignIn: ({ isLoading, handleForgotPassword, handleSignIn, handleSignUp,
|
|
2
|
+
export declare const SignIn: ({ isLoading, handleForgotPassword, handleSignIn, handleSignUp, loginErrorMessage, values, }: SignInI) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -9,23 +9,19 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
11
|
import { t } from 'i18next';
|
|
12
|
-
import { Box, Button, Center, Container, Stack } from '@chakra-ui/react';
|
|
12
|
+
import { Box, Button, Center, Container, Stack, Text } from '@chakra-ui/react';
|
|
13
13
|
import { Logo, Footer, PageTitle, CardFooter, PasswordInput, TextInput, ButtonLoader, BasePageWrapper, } from '../..';
|
|
14
14
|
import { isEmptyField } from '../../../utils';
|
|
15
15
|
import { useSignIn } from '../../../hooks';
|
|
16
|
-
export const SignIn = ({ isLoading, handleForgotPassword, handleSignIn, handleSignUp,
|
|
16
|
+
export const SignIn = ({ isLoading, handleForgotPassword, handleSignIn, handleSignUp, loginErrorMessage, values = { email: '', password: '' }, }) => {
|
|
17
17
|
const { inputs, handleInputChange, isValidated, setIsValidated } = useSignIn(values);
|
|
18
|
-
return (_jsxs(BasePageWrapper, { children: [_jsxs(Container, { size: "onboarding", boxShadow: "lg", children: [_jsx(Logo, {}), _jsx(PageTitle, { title: t('signin.title') }), _jsx(Box, { px: ['container.sm', 'container.md', 'container.lg'], mb: 6, children: _jsxs(Stack, { spacing: 8, children: [_jsxs(Stack, { spacing: "base", as: "form", children: [_jsx(TextInput, { autoCapitalize: "none", autoCorrect: "off", autoComplete: "username", errorMessage:
|
|
19
|
-
? t('forms.errorLogin')
|
|
20
|
-
: t('forms.email') + ' ' + t('forms.required'), hasError: isValidated && (loginError || isEmptyField(inputs.email)), id: "email", placeholder: t('forms.email'), value: values.email || inputs.email, handleChange: (event) => {
|
|
18
|
+
return (_jsxs(BasePageWrapper, { children: [_jsxs(Container, { size: "onboarding", boxShadow: "lg", children: [_jsx(Logo, {}), _jsx(PageTitle, { title: t('signin.title') }), _jsx(Box, { px: ['container.sm', 'container.md', 'container.lg'], mb: 6, children: _jsxs(Stack, { spacing: 8, children: [_jsxs(Stack, { spacing: "base", as: "form", children: [_jsx(TextInput, { autoCapitalize: "none", autoCorrect: "off", autoComplete: "username", errorMessage: t('forms.email') + ' ' + t('forms.required'), hasError: isValidated && isEmptyField(inputs.email), id: "email", placeholder: t('forms.email'), value: values.email || inputs.email, handleChange: (event) => {
|
|
21
19
|
values.email = event.target.value;
|
|
22
20
|
handleInputChange(event);
|
|
23
|
-
} }), _jsx(PasswordInput, { autoComplete: "current-password", errorMessage:
|
|
24
|
-
? t('forms.errorLogin')
|
|
25
|
-
: t('forms.password') + ' ' + t('forms.required'), hasError: isValidated && (loginError || isEmptyField(inputs.password)), id: "password", placeholder: t('forms.password'), value: values.password || inputs.password, handleChange: (event) => {
|
|
21
|
+
} }), _jsx(PasswordInput, { autoComplete: "current-password", errorMessage: t('forms.password') + ' ' + t('forms.required'), hasError: isValidated && isEmptyField(inputs.password), id: "password", placeholder: t('forms.password'), value: values.password || inputs.password, handleChange: (event) => {
|
|
26
22
|
values.password = event.target.value;
|
|
27
23
|
handleInputChange(event);
|
|
28
|
-
} })] }), _jsxs(Stack, { spacing: 4, children: [_jsx(Button, { isLoading: isLoading, spinner: _jsx(ButtonLoader, {}), onClick: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
24
|
+
} }), Boolean(loginErrorMessage) && (_jsx(Text, { variant: "error", children: loginErrorMessage }))] }), _jsxs(Stack, { spacing: 4, children: [_jsx(Button, { isLoading: isLoading, spinner: _jsx(ButtonLoader, {}), onClick: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
29
25
|
setIsValidated(true);
|
|
30
26
|
if (!isEmptyField(inputs.email) &&
|
|
31
27
|
!isEmptyField(inputs.password)) {
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t } from 'i18next'
|
|
2
|
-
import { Box, Button, Center, Container, Stack } from '@chakra-ui/react'
|
|
2
|
+
import { Box, Button, Center, Container, Stack, Text } from '@chakra-ui/react'
|
|
3
3
|
import {
|
|
4
4
|
Logo,
|
|
5
5
|
Footer,
|
|
@@ -19,7 +19,7 @@ export const SignIn = ({
|
|
|
19
19
|
handleForgotPassword,
|
|
20
20
|
handleSignIn,
|
|
21
21
|
handleSignUp,
|
|
22
|
-
|
|
22
|
+
loginErrorMessage,
|
|
23
23
|
values = { email: '', password: '' },
|
|
24
24
|
}: SignInI) => {
|
|
25
25
|
const { inputs, handleInputChange, isValidated, setIsValidated } =
|
|
@@ -37,14 +37,8 @@ export const SignIn = ({
|
|
|
37
37
|
autoCapitalize="none"
|
|
38
38
|
autoCorrect="off"
|
|
39
39
|
autoComplete="username"
|
|
40
|
-
errorMessage={
|
|
41
|
-
|
|
42
|
-
? t('forms.errorLogin')
|
|
43
|
-
: t('forms.email') + ' ' + t('forms.required')
|
|
44
|
-
}
|
|
45
|
-
hasError={
|
|
46
|
-
isValidated && (loginError || isEmptyField(inputs.email))
|
|
47
|
-
}
|
|
40
|
+
errorMessage={t('forms.email') + ' ' + t('forms.required')}
|
|
41
|
+
hasError={isValidated && isEmptyField(inputs.email)}
|
|
48
42
|
id="email"
|
|
49
43
|
placeholder={t('forms.email')}
|
|
50
44
|
value={values.email || inputs.email}
|
|
@@ -55,14 +49,8 @@ export const SignIn = ({
|
|
|
55
49
|
/>
|
|
56
50
|
<PasswordInput
|
|
57
51
|
autoComplete="current-password"
|
|
58
|
-
errorMessage={
|
|
59
|
-
|
|
60
|
-
? t('forms.errorLogin')
|
|
61
|
-
: t('forms.password') + ' ' + t('forms.required')
|
|
62
|
-
}
|
|
63
|
-
hasError={
|
|
64
|
-
isValidated && (loginError || isEmptyField(inputs.password))
|
|
65
|
-
}
|
|
52
|
+
errorMessage={t('forms.password') + ' ' + t('forms.required')}
|
|
53
|
+
hasError={isValidated && isEmptyField(inputs.password)}
|
|
66
54
|
id="password"
|
|
67
55
|
placeholder={t('forms.password')}
|
|
68
56
|
value={values.password || inputs.password}
|
|
@@ -71,6 +59,9 @@ export const SignIn = ({
|
|
|
71
59
|
handleInputChange(event)
|
|
72
60
|
}}
|
|
73
61
|
/>
|
|
62
|
+
{Boolean(loginErrorMessage) && (
|
|
63
|
+
<Text variant="error">{loginErrorMessage}</Text>
|
|
64
|
+
)}
|
|
74
65
|
</Stack>
|
|
75
66
|
<Stack spacing={4}>
|
|
76
67
|
<Button
|