@homefile/components-v2 2.56.0 → 2.57.0
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/assets/locales/en/index.json +1 -0
- package/dist/components/inputs/PasswordInput.js +1 -1
- package/dist/components/inputs/TextInput.js +1 -1
- package/dist/components/onboarding/CardFooter.js +4 -1
- package/dist/components/onboarding/pages/BasePageWrapper.d.ts +5 -1
- package/dist/components/onboarding/pages/BasePageWrapper.js +6 -2
- package/dist/components/onboarding/pages/SignIn.d.ts +1 -1
- package/dist/components/onboarding/pages/SignIn.js +9 -5
- package/dist/components/onboarding/pages/SignUp.js +2 -2
- package/dist/components/onboarding/pages/TwoFactor.js +1 -1
- package/dist/interfaces/pages/SignIn.interface.d.ts +2 -0
- package/package.json +1 -1
|
@@ -19,7 +19,7 @@ export const PasswordInput = (_a) => {
|
|
|
19
19
|
const handleClick = () => setShow(!show);
|
|
20
20
|
const ViewIcon = show ? _jsx(Eye, { size: 20 }) : _jsx(EyeOff, { size: 20 });
|
|
21
21
|
const isFilled = String(value).trim().length > 0 && showLabel;
|
|
22
|
-
return (_jsxs(FormControl, { isInvalid: hasError, children: [_jsx(LabeledField, { label: placeholder, isFilled: isFilled, 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: {
|
|
22
|
+
return (_jsxs(FormControl, { isInvalid: hasError, children: [_jsx(LabeledField, { label: showLabel ? placeholder : undefined, isFilled: isFilled, 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: {
|
|
23
23
|
svg: {
|
|
24
24
|
fill: 'blue.3',
|
|
25
25
|
},
|
|
@@ -18,5 +18,5 @@ export const TextInput = (_a) => {
|
|
|
18
18
|
const error = hasError && !isDisabled;
|
|
19
19
|
const isFilled = String(value).trim().length > 0 && showLabel;
|
|
20
20
|
const placeholderToUse = isFilled ? '' : ((_b = placeholder !== null && placeholder !== void 0 ? placeholder : label) !== null && _b !== void 0 ? _b : '');
|
|
21
|
-
return (_jsxs(FormControl, { isInvalid: error, children: [_jsx(LabeledField, { label: label !== null && label !== void 0 ? label : placeholder, isFilled: isFilled, children: _jsx(Input, Object.assign({}, props, { autoCapitalize: autoCapitalize, autoCorrect: autoCorrect, id: id, placeholder: placeholderToUse, value: value, type: type, onChange: handleChange, isInvalid: error, isDisabled: isDisabled })) }), error && (_jsx(Text, { variant: "error", my: "1", children: errorMessage })), hint && !error && (_jsx(Text, { variant: "hint", my: "1", children: hint }))] }));
|
|
21
|
+
return (_jsxs(FormControl, { isInvalid: error, children: [_jsx(LabeledField, { label: showLabel ? (label !== null && label !== void 0 ? label : placeholder) : undefined, isFilled: isFilled, children: _jsx(Input, Object.assign({}, props, { autoCapitalize: autoCapitalize, autoCorrect: autoCorrect, id: id, placeholder: placeholderToUse, value: value, type: type, onChange: handleChange, isInvalid: error, isDisabled: isDisabled })) }), error && (_jsx(Text, { variant: "error", my: "1", children: errorMessage })), hint && !error && (_jsx(Text, { variant: "hint", my: "1", children: hint }))] }));
|
|
22
22
|
};
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Box, Container, Text } from '@chakra-ui/react';
|
|
3
3
|
export const CardFooter = ({ title = '', buttonLabel, handleButtonClick, children, }) => {
|
|
4
|
-
return (_jsx(Container, { variant: "secondary", centerContent: true,
|
|
4
|
+
return (_jsx(Container, { variant: "secondary", centerContent: true, w: "full", flex: { base: 1, md: 'initial' }, children: _jsxs(Box, { w: "full", px: ['container.sm', 'container.md', 'container.lg'],
|
|
5
|
+
// Mobile: keep the footer text pinned at the top of the (grown) green
|
|
6
|
+
// area instead of vertically centering it. Desktop: centered as before.
|
|
7
|
+
my: { base: 0, md: 'auto' }, py: "2rem", children: [_jsxs(Text, { textAlign: "center", variant: "body", children: [title, ' ', _jsx(Box, { as: "button", type: "button", display: "inline", color: "link.default", fontWeight: "medium", onClick: handleButtonClick, _hover: { textDecoration: 'underline' }, _focusVisible: {
|
|
5
8
|
textDecoration: 'underline',
|
|
6
9
|
outline: '2px solid',
|
|
7
10
|
outlineColor: 'border.focus',
|
|
@@ -1,2 +1,6 @@
|
|
|
1
1
|
import { PropsWithChildren } from 'react';
|
|
2
|
-
|
|
2
|
+
interface BasePageWrapperProps {
|
|
3
|
+
flushMobile?: boolean;
|
|
4
|
+
}
|
|
5
|
+
export declare const BasePageWrapper: ({ children, flushMobile, }: PropsWithChildren<BasePageWrapperProps>) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export {};
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Box } from '@chakra-ui/react';
|
|
3
|
-
export const BasePageWrapper = ({ children }) => {
|
|
4
|
-
return (_jsx(Box, { w: "container.full", zIndex: "2", position: "relative", mt:
|
|
3
|
+
export const BasePageWrapper = ({ children, flushMobile, }) => {
|
|
4
|
+
return (_jsx(Box, { w: "container.full", zIndex: "2", position: "relative", mt: flushMobile ? { base: '0', md: 'onboarding.top' } : 'onboarding.top',
|
|
5
|
+
// Mobile full-screen: this wrapper is the full-height flex column holding
|
|
6
|
+
// the card + the copyright footer, so the card can flex to fill the space
|
|
7
|
+
// above the copyright (which stays pinned at the bottom) with NO overflow.
|
|
8
|
+
minH: flushMobile ? { base: '100vh', md: 'auto' } : undefined, display: flushMobile ? { base: 'flex', md: 'block' } : undefined, flexDirection: flushMobile ? 'column' : undefined, children: children }));
|
|
5
9
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { SignInI } from '../../../interfaces';
|
|
2
|
-
export declare const SignIn: ({ isPartner, isLoading, handleForgotPassword, handleSignIn, handleSignUp, loginErrorMessage, values, }: SignInI) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare const SignIn: ({ isPartner, isLoading, handleForgotPassword, handleSignIn, handleSignUp, handleGoogleSignIn, handleAppleSignIn, loginErrorMessage, values, }: SignInI) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -9,16 +9,20 @@ 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, Text } from '@chakra-ui/react';
|
|
13
|
-
import { Footer, PageTitle, CardFooter, PasswordInput, TextInput, ButtonLoader, BasePageWrapper, AuthHeader, } from '../../../components';
|
|
12
|
+
import { Box, Button, Center, Container, Divider, Flex, Stack, Text, } from '@chakra-ui/react';
|
|
13
|
+
import { Footer, PageTitle, CardFooter, PasswordInput, TextInput, ButtonLoader, BasePageWrapper, AuthHeader, GoogleIcon, AppleIcon, } from '../../../components';
|
|
14
14
|
import { isEmptyField } from '../../../utils';
|
|
15
15
|
import { useSignIn } from '../../../hooks';
|
|
16
|
-
export const SignIn = ({ isPartner, isLoading, handleForgotPassword, handleSignIn, handleSignUp, loginErrorMessage, values = { email: '', password: '' }, }) => {
|
|
16
|
+
export const SignIn = ({ isPartner, isLoading, handleForgotPassword, handleSignIn, handleSignUp, handleGoogleSignIn, handleAppleSignIn, loginErrorMessage, values = { email: '', password: '' }, }) => {
|
|
17
17
|
const { inputs, handleInputChange, isValidated, setIsValidated } = useSignIn(values);
|
|
18
|
-
|
|
18
|
+
// Social sign-in renders only when a handler is provided (dark otherwise).
|
|
19
|
+
const showGoogle = Boolean(handleGoogleSignIn);
|
|
20
|
+
const showApple = Boolean(handleAppleSignIn);
|
|
21
|
+
const showSocial = showGoogle || showApple;
|
|
22
|
+
return (_jsxs(BasePageWrapper, { flushMobile: true, children: [_jsxs(Container, { size: "onboarding", bg: "neutral.white", boxShadow: { base: 'none', md: 'lg' }, borderRadius: { base: 0, md: 'sm' }, maxW: { base: '100%', md: 'container.md' }, flex: { base: 1, md: 'initial' }, display: { base: 'flex', md: 'block' }, flexDirection: "column", children: [_jsx(AuthHeader, { isPartner: isPartner }), _jsx(PageTitle, { title: showSocial ? t('signin.titleSocial') : t('signin.title') }), _jsx(Box, { px: ['container.sm', 'container.md', 'container.lg'], mb: 6, children: _jsxs(Stack, { spacing: "base", children: [showSocial && (_jsxs(Stack, { spacing: "base", children: [showGoogle && (_jsx(Button, { variant: "secondary", leftIcon: _jsx(GoogleIcon, { size: 20 }), onClick: handleGoogleSignIn, children: t('signup.continueGoogle') })), showApple && (_jsx(Button, { variant: "secondary", leftIcon: _jsx(AppleIcon, { size: 20 }), onClick: handleAppleSignIn, children: t('signup.continueApple') })), _jsxs(Flex, { align: "center", gap: "3", py: "0", children: [_jsx(Divider, { flex: "1", borderColor: "border.default" }), _jsx(Text, { variant: "caption", children: t('signup.or') }), _jsx(Divider, { flex: "1", borderColor: "border.default" })] })] })), _jsxs(Stack, { spacing: "base", as: "form", children: [Boolean(loginErrorMessage) && (_jsx(Text, { variant: "error", children: loginErrorMessage })), _jsx(TextInput, { showLabel: false, 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) => {
|
|
19
23
|
values.email = event.target.value;
|
|
20
24
|
handleInputChange(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) => {
|
|
25
|
+
} }), _jsx(PasswordInput, { showLabel: false, 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) => {
|
|
22
26
|
values.password = event.target.value;
|
|
23
27
|
handleInputChange(event);
|
|
24
28
|
} })] }), _jsxs(Stack, { spacing: 4, children: [_jsx(Button, { isLoading: isLoading, spinner: _jsx(ButtonLoader, {}), onClick: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -25,6 +25,6 @@ export const SignUp = ({ isLoading, isPartner, handleCreateAccount, handleSignIn
|
|
|
25
25
|
const showGoogle = Boolean(handleGoogleSignIn);
|
|
26
26
|
const showApple = Boolean(handleAppleSignIn);
|
|
27
27
|
const showSocial = showGoogle || showApple;
|
|
28
|
-
return (_jsxs(BasePageWrapper, { children: [_jsxs(Container, { size: "onboarding", boxShadow:
|
|
29
|
-
(isEmptyField(inputs.email) || !isValidEmail(inputs.email)), id: "email", placeholder: t('forms.email'), value: inputs.email, handleChange: handleInputChange, autoComplete: "email" }), _jsxs(Box, { children: [_jsx(PasswordInput, { errorMessage: passwordErrorMessage(values.password), hasError: isValidated && !isValidPassword(inputs.password), id: "password", placeholder: t('forms.password'), value: (_b = inputs.password) !== null && _b !== void 0 ? _b : '', handleChange: (event) => handleInputChange(event), autoComplete: "new-password" }), _jsx(PasswordStrengthMeter, { password: (_c = inputs.password) !== null && _c !== void 0 ? _c : '' })] }), _jsx(Center, { children: _jsx(Button, { variant: "text", leftIcon: _jsx(Text, { as: "span", fontSize: "md", lineHeight: "1", children: "+" }), onClick: () => setShowPartnerCode((prev) => !prev), children: t('signup.partnerCodePrompt') }) }), showPartnerCode && (_jsx(TextInput, { autoCapitalize: "none", autoCorrect: "off", id: "partnerCode", placeholder: t('forms.promoCode'), value: (_d = inputs.partnerCode) !== null && _d !== void 0 ? _d : '', handleChange: handleInputChange, autoComplete: "off" })), _jsx(Button, { isLoading: isLoading, spinner: _jsx(ButtonLoader, {}), onClick: handleSubmit, children: t('signup.signupBt') }), showSocial && (_jsxs(_Fragment, { children: [_jsxs(Flex, { align: "center", gap: "3", py: "1", children: [_jsx(Divider, { flex: "1", borderColor: "border.default" }), _jsx(Text, { variant: "caption", children: t('signup.or') }), _jsx(Divider, { flex: "1", borderColor: "border.default" })] }), showGoogle && (_jsx(Button, { variant: "secondary", leftIcon: _jsx(GoogleIcon, { size: 20 }), onClick: handleGoogleSignIn, children: t('signup.continueGoogle') })), showApple && (_jsx(Button, { variant: "secondary", leftIcon: _jsx(AppleIcon, { size: 20 }), onClick: handleAppleSignIn, children: t('signup.continueApple') }))] }))] }) }), _jsx(CardFooter, { title: isPartner ? t('signup.signinPartner') : t('signup.signin'), buttonLabel: t('signup.signinBt'), handleButtonClick: handleSignIn, children: _jsxs(Text, { textAlign: "center", variant: "info", w: "100%", children: [t('signup.terms'), ' ', _jsxs(Text, { as: "span", whiteSpace: "nowrap", children: ["Homefile", ' ', _jsx("a", { target: "_blank", href: t('footer.termsUrl'), children: t('footer.termsLink') }), "."] })] }) })] }), _jsx(Footer, {})] }));
|
|
28
|
+
return (_jsxs(BasePageWrapper, { flushMobile: true, children: [_jsxs(Container, { size: "onboarding", bg: "neutral.white", boxShadow: { base: 'none', md: 'lg' }, borderRadius: { base: 0, md: 'sm' }, maxW: { base: '100%', md: 'container.md' }, flex: { base: 1, md: 'initial' }, display: { base: 'flex', md: 'block' }, flexDirection: "column", children: [_jsx(AuthHeader, { isPartner: isPartner }), _jsx(PageTitle, { title: isPartner ? t('signup.titlePartner') : t('signup.title') }), _jsx(Box, { px: ['container.sm', 'container.md', 'container.lg'], mb: 6, children: _jsxs(Stack, { spacing: "base", as: "form", children: [Boolean(signupErrorMessage) && (_jsx(Text, { variant: "error", children: signupErrorMessage })), _jsx(TextInput, { showLabel: false, errorMessage: t('forms.fullName') + ' ' + t('forms.required'), hasError: isValidated && isEmptyField(inputs.name), id: "name", placeholder: t('forms.fullName'), value: (_a = inputs.name) !== null && _a !== void 0 ? _a : '', handleChange: handleInputChange, autoComplete: "name" }), _jsx(TextInput, { showLabel: false, autoCapitalize: "none", autoCorrect: "off", errorMessage: t('forms.email') + ' ' + t('forms.required'), hasError: isValidated &&
|
|
29
|
+
(isEmptyField(inputs.email) || !isValidEmail(inputs.email)), id: "email", placeholder: t('forms.email'), value: inputs.email, handleChange: handleInputChange, autoComplete: "email" }), _jsxs(Box, { children: [_jsx(PasswordInput, { showLabel: false, errorMessage: passwordErrorMessage(values.password), hasError: isValidated && !isValidPassword(inputs.password), id: "password", placeholder: t('forms.password'), value: (_b = inputs.password) !== null && _b !== void 0 ? _b : '', handleChange: (event) => handleInputChange(event), autoComplete: "new-password" }), _jsx(PasswordStrengthMeter, { password: (_c = inputs.password) !== null && _c !== void 0 ? _c : '' })] }), _jsx(Center, { children: _jsx(Button, { variant: "text", leftIcon: _jsx(Text, { as: "span", fontSize: "md", lineHeight: "1", children: "+" }), onClick: () => setShowPartnerCode((prev) => !prev), children: t('signup.partnerCodePrompt') }) }), showPartnerCode && (_jsx(TextInput, { showLabel: false, autoCapitalize: "none", autoCorrect: "off", id: "partnerCode", placeholder: t('forms.promoCode'), value: (_d = inputs.partnerCode) !== null && _d !== void 0 ? _d : '', handleChange: handleInputChange, autoComplete: "off" })), _jsx(Button, { isLoading: isLoading, spinner: _jsx(ButtonLoader, {}), onClick: handleSubmit, children: t('signup.signupBt') }), showSocial && (_jsxs(_Fragment, { children: [_jsxs(Flex, { align: "center", gap: "3", py: "1", children: [_jsx(Divider, { flex: "1", borderColor: "border.default" }), _jsx(Text, { variant: "caption", children: t('signup.or') }), _jsx(Divider, { flex: "1", borderColor: "border.default" })] }), showGoogle && (_jsx(Button, { variant: "secondary", leftIcon: _jsx(GoogleIcon, { size: 20 }), onClick: handleGoogleSignIn, children: t('signup.continueGoogle') })), showApple && (_jsx(Button, { variant: "secondary", leftIcon: _jsx(AppleIcon, { size: 20 }), onClick: handleAppleSignIn, children: t('signup.continueApple') }))] }))] }) }), _jsx(CardFooter, { title: isPartner ? t('signup.signinPartner') : t('signup.signin'), buttonLabel: t('signup.signinBt'), handleButtonClick: handleSignIn, children: _jsxs(Text, { textAlign: "center", variant: "info", w: "100%", children: [t('signup.terms'), ' ', _jsxs(Text, { as: "span", whiteSpace: "nowrap", children: ["Homefile", ' ', _jsx("a", { target: "_blank", href: t('footer.termsUrl'), children: t('footer.termsLink') }), "."] })] }) })] }), _jsx(Footer, {})] }));
|
|
30
30
|
};
|
|
@@ -6,5 +6,5 @@ import { isEmptyField } from '../../../utils';
|
|
|
6
6
|
import { useTwoFactor } from '../../../hooks';
|
|
7
7
|
export const TwoFactor = ({ onReset, onResend, isDialog, isLoading, isPartner, twoFactorMethod, }) => {
|
|
8
8
|
const { code, handleInputChange, handleSubmit, isValidated } = useTwoFactor(onReset);
|
|
9
|
-
return (_jsxs(BasePageWrapper, { children: [_jsxs(Container, { size: "onboarding", boxShadow:
|
|
9
|
+
return (_jsxs(BasePageWrapper, { flushMobile: !isDialog, children: [_jsxs(Container, { size: "onboarding", bg: "neutral.white", boxShadow: isDialog ? 'none' : { base: 'none', md: 'lg' }, borderRadius: isDialog ? 'sm' : { base: 0, md: 'sm' }, maxW: isDialog ? 'container.md' : { base: '100%', md: 'container.md' }, flex: isDialog ? 'initial' : { base: 1, md: 'initial' }, display: isDialog ? 'block' : { base: 'flex', md: 'block' }, flexDirection: "column", children: [_jsx(AuthHeader, { isPartner: isPartner }), _jsxs(Stack, { my: "6", children: [_jsx(Text, { variant: "title", textAlign: "center", px: "10", children: t('reset.2FA.title') }), _jsxs(Text, { fontFamily: "secondary", textAlign: "center", px: ['10', '20'], children: [twoFactorMethod === 'email' && t('reset.2FA.subtitleEmail'), twoFactorMethod === 'sms' && t('reset.2FA.subtitleSms')] })] }), _jsx(Box, { px: ['container.sm', 'container.md', 'container.lg'], pb: "container.md", mb: "6", children: _jsxs(Stack, { spacing: "4", children: [_jsx(TextInput, { errorMessage: t('forms.code') + ' ' + t('forms.required'), hasError: isValidated && isEmptyField(code), id: "code", placeholder: t('reset.2FA.placeholder'), value: code, handleChange: handleInputChange }), _jsx(Button, { isLoading: isLoading, spinner: _jsx(ButtonLoader, {}), onClick: handleSubmit, children: t('forms.submit') }), onResend && (_jsx(Center, { children: _jsx(Button, { onClick: onResend, variant: "text", children: t('reset.2FA.resend') }) }))] }) })] }), !isDialog && _jsx(Footer, {})] }));
|
|
10
10
|
};
|
|
@@ -8,6 +8,8 @@ export interface SignInI {
|
|
|
8
8
|
handleForgotPassword: () => void;
|
|
9
9
|
handleSignIn: (form: SignInFormI) => void;
|
|
10
10
|
handleSignUp: () => void;
|
|
11
|
+
handleGoogleSignIn?: () => void;
|
|
12
|
+
handleAppleSignIn?: () => void;
|
|
11
13
|
loginErrorMessage?: string;
|
|
12
14
|
values?: SignInFormI;
|
|
13
15
|
}
|