@homefile/components-v2 1.0.6 → 1.0.8

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.
@@ -1,2 +1,2 @@
1
1
  import { InputI } from '../../interfaces';
2
- export declare const PasswordInput: ({ errorMessage, id, handleChange, hasError, placeholder, value, }: InputI) => import("react/jsx-runtime").JSX.Element;
2
+ export declare const PasswordInput: ({ errorMessage, id, handleChange, hasError, placeholder, value, ...props }: InputI) => import("react/jsx-runtime").JSX.Element;
@@ -1,12 +1,24 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
1
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
13
  import { useState } from 'react';
3
14
  import { InputGroup, Input, InputRightElement, IconButton, FormControl, Text, } from '@chakra-ui/react';
4
15
  import { Eye, EyeOff } from '..';
5
- export const PasswordInput = ({ errorMessage, id, handleChange, hasError, placeholder, value = '', }) => {
16
+ export const PasswordInput = (_a) => {
17
+ var { errorMessage, id, handleChange, hasError, placeholder, value = '' } = _a, props = __rest(_a, ["errorMessage", "id", "handleChange", "hasError", "placeholder", "value"]);
6
18
  const [show, setShow] = useState(false);
7
19
  const handleClick = () => setShow(!show);
8
20
  const ViewIcon = show ? _jsx(Eye, { size: 20 }) : _jsx(EyeOff, { size: 20 });
9
- return (_jsxs(FormControl, { isInvalid: hasError, children: [_jsxs(InputGroup, { children: [_jsx(Input, { autoCapitalize: "none", autoCorrect: "off", id: id, placeholder: placeholder, type: show ? 'text' : 'password', value: value, onChange: handleChange }), _jsx(InputRightElement, { width: "3rem", children: _jsx(IconButton, { variant: "icon", "aria-label": "Enter password", icon: ViewIcon, onClick: handleClick, _hover: {
21
+ return (_jsxs(FormControl, { isInvalid: hasError, children: [_jsxs(InputGroup, { children: [_jsx(Input, Object.assign({ autoCapitalize: "none", autoCorrect: "off", id: id, placeholder: placeholder, type: show ? 'text' : 'password', value: value, onChange: handleChange }, props)), _jsx(InputRightElement, { width: "3rem", children: _jsx(IconButton, { variant: "icon", "aria-label": "Enter password", icon: ViewIcon, onClick: handleClick, _hover: {
10
22
  svg: {
11
23
  fill: 'blue.3',
12
24
  },
@@ -15,17 +15,17 @@ import { isEmptyField } from '../../../utils';
15
15
  import { useSignIn } from '../../../hooks';
16
16
  export const SignIn = ({ isLoading, handleForgotPassword, handleSignIn, handleSignUp, loginError, values = { email: '', password: '' }, }) => {
17
17
  const { inputs, handleInputChange, isValidated, setIsValidated } = useSignIn(values);
18
- return (_jsxs(Box, { w: "container.full", mt: "onboarding.top", zIndex: "2", position: "relative", 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: [_jsx(Stack, { spacing: "input.sm", children: _jsxs("form", { children: [_jsx(TextInput, { autoCapitalize: "none", autoCorrect: "off", errorMessage: loginError
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) => {
21
- values.email = event.target.value;
22
- handleInputChange(event);
23
- } }), _jsx(PasswordInput, { errorMessage: loginError
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) => {
26
- values.password = event.target.value;
27
- handleInputChange(event);
28
- } })] }) }), _jsxs(Stack, { spacing: 4, children: [_jsx(Button, { isLoading: isLoading, spinner: _jsx(ButtonLoader, {}), onClick: () => __awaiter(void 0, void 0, void 0, function* () {
18
+ return (_jsxs(Box, { w: "container.full", mt: "onboarding.top", zIndex: "2", position: "relative", 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: loginError
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) => {
21
+ values.email = event.target.value;
22
+ handleInputChange(event);
23
+ } }), _jsx(PasswordInput, { autoComplete: "current-password", errorMessage: loginError
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) => {
26
+ values.password = event.target.value;
27
+ handleInputChange(event);
28
+ } })] }), _jsxs(Stack, { spacing: 4, children: [_jsx(Button, { isLoading: isLoading, spinner: _jsx(ButtonLoader, {}), onClick: () => __awaiter(void 0, void 0, void 0, function* () {
29
29
  setIsValidated(true);
30
30
  if (!isEmptyField(inputs.email) &&
31
31
  !isEmptyField(inputs.password)) {
@@ -17,10 +17,10 @@ export const SignUp = ({ isLoading, handleCreateAccount, handleSignIn, showPromo
17
17
  handleCreateAccount,
18
18
  values,
19
19
  });
20
- return (_jsxs(Box, { w: "container.full", mt: "onboarding.top", zIndex: "2", position: "relative", children: [_jsxs(Container, { size: "onboarding", boxShadow: "lg", children: [_jsx(Logo, {}), _jsx(PageTitle, { title: t('signup.title') }), _jsx(Box, { px: ['container.sm', 'container.md', 'container.lg'], mb: 6, children: _jsxs(Stack, { spacing: "input.sm", children: [_jsx(TextInput, { errorMessage: t('forms.firstName') + ' ' + t('forms.required'), hasError: isValidated && isEmptyField(inputs.firstName), id: "firstName", placeholder: t('forms.firstName'), value: inputs.firstName, handleChange: handleInputChange }), _jsx(TextInput, { errorMessage: t('forms.lastName') + ' ' + t('forms.required'), hasError: isValidated && isEmptyField(inputs.lastName), id: "lastName", placeholder: t('forms.lastName'), value: inputs.lastName, handleChange: handleInputChange }), _jsx(TextInput, { autoCapitalize: "none", autoCorrect: "off", errorMessage: t('forms.email') + ' ' + t('forms.required'), hasError: isValidated &&
21
- (isEmptyField(inputs.email) || !isValidEmail(inputs.email)), id: "email", placeholder: t('forms.email'), value: inputs.email, handleChange: handleInputChange }), showPromoCode && (_jsx(TextInput, { autoCapitalize: "none", autoCorrect: "off", id: "promoCode", placeholder: t('forms.promoCode'), value: (_a = inputs.promoCode) !== null && _a !== void 0 ? _a : '', handleChange: handleInputChange })), _jsx(Text, { textAlign: "center", variant: "caption", children: t('signup.subtitle') }), _jsx(PasswordInput, { errorMessage: passwordErrorMessage(values.password), hasError: isValidated &&
20
+ return (_jsxs(Box, { w: "container.full", mt: "onboarding.top", zIndex: "2", position: "relative", children: [_jsxs(Container, { size: "onboarding", boxShadow: "lg", children: [_jsx(Logo, {}), _jsx(PageTitle, { title: t('signup.title') }), _jsx(Box, { px: ['container.sm', 'container.md', 'container.lg'], mb: 6, children: _jsxs(Stack, { spacing: "base", as: "form", children: [_jsx(TextInput, { errorMessage: t('forms.firstName') + ' ' + t('forms.required'), hasError: isValidated && isEmptyField(inputs.firstName), id: "firstName", placeholder: t('forms.firstName'), value: inputs.firstName, handleChange: handleInputChange, autoComplete: 'given-name' }), _jsx(TextInput, { errorMessage: t('forms.lastName') + ' ' + t('forms.required'), hasError: isValidated && isEmptyField(inputs.lastName), id: "lastName", placeholder: t('forms.lastName'), value: inputs.lastName, handleChange: handleInputChange, autoComplete: 'family-name' }), _jsx(TextInput, { autoCapitalize: "none", autoCorrect: "off", errorMessage: t('forms.email') + ' ' + t('forms.required'), hasError: isValidated &&
21
+ (isEmptyField(inputs.email) || !isValidEmail(inputs.email)), id: "email", placeholder: t('forms.email'), value: inputs.email, handleChange: handleInputChange, autoComplete: 'email' }), showPromoCode && (_jsx(TextInput, { autoCapitalize: "none", autoCorrect: "off", id: "promoCode", placeholder: t('forms.promoCode'), value: (_a = inputs.promoCode) !== null && _a !== void 0 ? _a : '', handleChange: handleInputChange, autoComplete: 'off' })), _jsx(Text, { textAlign: "center", variant: "caption", children: t('signup.subtitle') }), _jsx(PasswordInput, { errorMessage: passwordErrorMessage(values.password), hasError: isValidated &&
22
22
  (!isValidPassword(inputs.password) ||
23
- !passwordMatch(inputs.password, inputs.confirmPassword)), id: "password", placeholder: t('forms.password'), value: (_b = inputs.password) !== null && _b !== void 0 ? _b : '', handleChange: (event) => handleInputChange(event) }), _jsx(PasswordInput, { errorMessage: passwordErrorMessage(inputs.confirmPassword), hasError: isValidated &&
23
+ !passwordMatch(inputs.password, inputs.confirmPassword)), id: "password", placeholder: t('forms.password'), value: (_b = inputs.password) !== null && _b !== void 0 ? _b : '', handleChange: (event) => handleInputChange(event), autoComplete: 'new-password' }), _jsx(PasswordInput, { errorMessage: passwordErrorMessage(inputs.confirmPassword), hasError: isValidated &&
24
24
  (!isValidPassword(inputs.confirmPassword) ||
25
- !passwordMatch(inputs.password, inputs.confirmPassword)), id: "confirmPassword", placeholder: t('forms.passwordConfirm'), value: (_c = inputs.confirmPassword) !== null && _c !== void 0 ? _c : '', handleChange: (event) => handleInputChange(event) }), _jsx(Center, { px: ['container.sm', 'container.md', 'container.lg'], h: "4rem", children: _jsxs(Text, { textAlign: "center", variant: "info", w: "100%", children: [t('signup.terms'), _jsx("a", { target: "_blank", href: t('footer.termsUrl'), children: t('footer.termsLink') })] }) }), _jsx(Button, { isLoading: isLoading, spinner: _jsx(ButtonLoader, {}), onClick: handleSubmit, children: t('signup.signupBt') })] }) }), _jsx(CardFooter, { title: t('signup.signin'), buttonLabel: t('signup.signinBt'), handleButtonClick: handleSignIn })] }), _jsx(Footer, {})] }));
25
+ !passwordMatch(inputs.password, inputs.confirmPassword)), id: "confirmPassword", placeholder: t('forms.passwordConfirm'), value: (_c = inputs.confirmPassword) !== null && _c !== void 0 ? _c : '', handleChange: (event) => handleInputChange(event), autoComplete: 'new-password' }), _jsx(Center, { px: ['container.sm', 'container.md', 'container.lg'], h: "4rem", children: _jsxs(Text, { textAlign: "center", variant: "info", w: "100%", children: [t('signup.terms'), _jsx("a", { target: "_blank", href: t('footer.termsUrl'), children: t('footer.termsLink') })] }) }), _jsx(Button, { isLoading: isLoading, spinner: _jsx(ButtonLoader, {}), onClick: handleSubmit, children: t('signup.signupBt') })] }) }), _jsx(CardFooter, { title: t('signup.signin'), buttonLabel: t('signup.signinBt'), handleButtonClick: handleSignIn })] }), _jsx(Footer, {})] }));
26
26
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@homefile/components-v2",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
4
4
  "author": "Homefile",
5
5
  "license": "UNLICENSED",
6
6
  "typings": "dist/index.d.ts",
@@ -17,6 +17,7 @@ export const PasswordInput = ({
17
17
  hasError,
18
18
  placeholder,
19
19
  value = '',
20
+ ...props
20
21
  }: InputI) => {
21
22
  const [show, setShow] = useState(false)
22
23
  const handleClick = () => setShow(!show)
@@ -32,6 +33,7 @@ export const PasswordInput = ({
32
33
  type={show ? 'text' : 'password'}
33
34
  value={value}
34
35
  onChange={handleChange}
36
+ {...props}
35
37
  />
36
38
  <InputRightElement width="3rem">
37
39
  <IconButton
@@ -31,11 +31,12 @@ export const SignIn = ({
31
31
  <PageTitle title={t('signin.title')} />
32
32
  <Box px={['container.sm', 'container.md', 'container.lg']} mb={6}>
33
33
  <Stack spacing={8}>
34
- <Stack spacing="input.sm">
35
- <form>
34
+ <Stack spacing="base" as="form">
35
+
36
36
  <TextInput
37
37
  autoCapitalize="none"
38
38
  autoCorrect="off"
39
+ autoComplete="username"
39
40
  errorMessage={
40
41
  loginError
41
42
  ? t('forms.errorLogin')
@@ -53,6 +54,7 @@ export const SignIn = ({
53
54
  }}
54
55
  />
55
56
  <PasswordInput
57
+ autoComplete="current-password"
56
58
  errorMessage={
57
59
  loginError
58
60
  ? t('forms.errorLogin')
@@ -69,7 +71,7 @@ export const SignIn = ({
69
71
  handleInputChange(event)
70
72
  }}
71
73
  />
72
- </form>
74
+
73
75
  </Stack>
74
76
  <Stack spacing={4}>
75
77
  <Button
@@ -50,7 +50,7 @@ export const SignUp = ({
50
50
  <Logo />
51
51
  <PageTitle title={t('signup.title')} />
52
52
  <Box px={['container.sm', 'container.md', 'container.lg']} mb={6}>
53
- <Stack spacing="input.sm">
53
+ <Stack spacing="base" as="form">
54
54
  <TextInput
55
55
  errorMessage={t('forms.firstName') + ' ' + t('forms.required')}
56
56
  hasError={isValidated && isEmptyField(inputs.firstName)}
@@ -58,6 +58,7 @@ export const SignUp = ({
58
58
  placeholder={t('forms.firstName')}
59
59
  value={inputs.firstName}
60
60
  handleChange={handleInputChange}
61
+ autoComplete='given-name'
61
62
  />
62
63
  <TextInput
63
64
  errorMessage={t('forms.lastName') + ' ' + t('forms.required')}
@@ -66,6 +67,7 @@ export const SignUp = ({
66
67
  placeholder={t('forms.lastName')}
67
68
  value={inputs.lastName}
68
69
  handleChange={handleInputChange}
70
+ autoComplete='family-name'
69
71
  />
70
72
  <TextInput
71
73
  autoCapitalize="none"
@@ -79,6 +81,7 @@ export const SignUp = ({
79
81
  placeholder={t('forms.email')}
80
82
  value={inputs.email}
81
83
  handleChange={handleInputChange}
84
+ autoComplete='email'
82
85
  />
83
86
  {showPromoCode && (
84
87
  <TextInput
@@ -88,6 +91,7 @@ export const SignUp = ({
88
91
  placeholder={t('forms.promoCode')}
89
92
  value={inputs.promoCode ?? ''}
90
93
  handleChange={handleInputChange}
94
+ autoComplete='off'
91
95
  />
92
96
  )}
93
97
  <Text textAlign="center" variant="caption">
@@ -104,6 +108,7 @@ export const SignUp = ({
104
108
  placeholder={t('forms.password')}
105
109
  value={inputs.password ?? ''}
106
110
  handleChange={(event) => handleInputChange(event)}
111
+ autoComplete='new-password'
107
112
  />
108
113
  <PasswordInput
109
114
  errorMessage={passwordErrorMessage(inputs.confirmPassword)}
@@ -116,6 +121,7 @@ export const SignUp = ({
116
121
  placeholder={t('forms.passwordConfirm')}
117
122
  value={inputs.confirmPassword ?? ''}
118
123
  handleChange={(event) => handleInputChange(event)}
124
+ autoComplete='new-password'
119
125
  />
120
126
  <Center
121
127
  px={['container.sm', 'container.md', 'container.lg']}