@licklist/design 0.78.43 → 0.78.45
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/.yarnrc.yml +5 -0
- package/dist/custom-fields/constants.d.ts +9 -8
- package/dist/custom-fields/constants.d.ts.map +1 -1
- package/dist/events/event-venue-map/utils/index.d.ts +1 -1
- package/dist/events/event-venue-map/utils/index.d.ts.map +1 -1
- package/dist/iframe/event/event-venue-map/IframeEventVenueMap.d.ts +3 -3
- package/dist/iframe/order-process/components/BookingSummary/utils/index.d.ts +1 -1
- package/dist/iframe/order-process/components/BookingSummary/utils/index.d.ts.map +1 -1
- package/dist/iframe/payment/order-items-table/hooks/useTableData.d.ts +5 -15
- package/dist/iframe/payment/order-items-table/hooks/useTableData.d.ts.map +1 -1
- package/dist/iframe/payment/order-items-table/utils/index.d.ts +4 -4
- package/dist/iframe/payment/order-items-table/utils/index.d.ts.map +1 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/product-set/form/SelectCategoryModal.d.ts +5 -5
- package/dist/product-set/utils/index.d.ts +12 -12
- package/dist/sales/coupon/utils/index.d.ts +2 -2
- package/dist/static/date-range-input/DateRangeInput.d.ts.map +1 -1
- package/dist/v2/components/InputCheckbox/InputCheckbox.scss.js +1 -1
- package/dist/v2/components/Tooltip/Tooltip.d.ts +0 -1
- package/dist/v2/components/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/v2/components/ZoneCard/ZoneCard.scss.js +1 -1
- package/dist/v2/components/index.d.ts +1 -1
- package/dist/v2/components/index.d.ts.map +1 -1
- package/dist/v2/dashboard-analytics/blog-posts/index.d.ts +1 -1
- package/dist/v2/dashboard-analytics/blog-posts/index.d.ts.map +1 -1
- package/dist/v2/dashboard-analytics/chart/Chart.d.ts.map +1 -1
- package/dist/v2/dashboard-analytics/chart/Chart.js +3 -2
- package/dist/v2/icons/index.d.ts +14 -0
- package/dist/v2/icons/index.d.ts.map +1 -1
- package/dist/v2/icons/index.js +47 -1
- package/dist/v2/index.d.ts +2 -0
- package/dist/v2/index.d.ts.map +1 -1
- package/dist/v2/navigation/DashboardLayout/DashboardLayout.js +1 -1
- package/dist/v2/navigation/DashboardLayout/TopNavigation.d.ts.map +1 -1
- package/dist/v2/navigation/FigmasSideBar/FigmasSideBar.d.ts.map +1 -1
- package/dist/v2/navigation/config.d.ts.map +1 -1
- package/dist/v2/pages/SettingsSubPage/SettingsSubPage.d.ts +12 -0
- package/dist/v2/pages/SettingsSubPage/SettingsSubPage.d.ts.map +1 -0
- package/dist/v2/pages/SettingsSubPage/index.d.ts +3 -0
- package/dist/v2/pages/SettingsSubPage/index.d.ts.map +1 -0
- package/dist/v2/pages/auth/AuthLayout/AuthLayout.d.ts +14 -0
- package/dist/v2/pages/auth/AuthLayout/AuthLayout.d.ts.map +1 -0
- package/dist/v2/pages/auth/AuthLayout/index.d.ts +3 -0
- package/dist/v2/pages/auth/AuthLayout/index.d.ts.map +1 -0
- package/dist/v2/pages/auth/CreatePassword/CreatePasswordPage.d.ts +10 -0
- package/dist/v2/pages/auth/CreatePassword/CreatePasswordPage.d.ts.map +1 -0
- package/dist/v2/pages/auth/CreatePassword/index.d.ts +3 -0
- package/dist/v2/pages/auth/CreatePassword/index.d.ts.map +1 -0
- package/dist/v2/pages/auth/Login/LoginPage.d.ts +11 -0
- package/dist/v2/pages/auth/Login/LoginPage.d.ts.map +1 -0
- package/dist/v2/pages/auth/Login/index.d.ts +3 -0
- package/dist/v2/pages/auth/Login/index.d.ts.map +1 -0
- package/dist/v2/pages/auth/ResetPassword/ResetPasswordPage.d.ts +12 -0
- package/dist/v2/pages/auth/ResetPassword/ResetPasswordPage.d.ts.map +1 -0
- package/dist/v2/pages/auth/ResetPassword/index.d.ts +3 -0
- package/dist/v2/pages/auth/ResetPassword/index.d.ts.map +1 -0
- package/dist/v2/pages/auth/VerifyEmail/VerifyEmailPage.d.ts +9 -0
- package/dist/v2/pages/auth/VerifyEmail/VerifyEmailPage.d.ts.map +1 -0
- package/dist/v2/pages/auth/VerifyEmail/index.d.ts +3 -0
- package/dist/v2/pages/auth/VerifyEmail/index.d.ts.map +1 -0
- package/dist/v2/pages/auth/index.d.ts +11 -0
- package/dist/v2/pages/auth/index.d.ts.map +1 -0
- package/dist/v2/styles/common.scss +7 -0
- package/dist/v2/styles/components/Button.scss +199 -0
- package/dist/v2/styles/form/Layout.scss +15 -0
- package/dist/v2/styles/form/NewInput.scss +271 -0
- package/dist/v2/styles/form/NewInput.scss.js +1 -1
- package/dist/v2/styles/index.scss +6 -0
- package/dist/v2/styles/navigation/Navigation.scss +17 -0
- package/dist/v2/styles/navigation/NavigationItem.scss +86 -0
- package/dist/v2/styles/navigation/NavigationSection.scss +26 -0
- package/dist/v2/styles/navigation/_index.scss +9 -0
- package/dist/v2/styles/tokens/_colors.scss +562 -0
- package/dist/v2/styles/tokens/_sizes.scss +125 -0
- package/dist/v2/styles/tokens/_status.scss +108 -0
- package/dist/v2/styles/tokens/_typography.scss +146 -0
- package/dist/v2/types/navigation.d.ts +2 -0
- package/dist/v2/types/navigation.d.ts.map +1 -1
- package/dist/virtualized/components/VirtualizedGrid.d.ts.map +1 -1
- package/dist/virtualized/components/VirtualizedWindowScroller.d.ts.map +1 -1
- package/dist/virtualized/components/VirtualizedWindowScroller.js +3 -2
- package/package.json +4 -4
- package/rollup.config.js +7 -0
- package/src/auth/Authorizer.tsx +1 -1
- package/src/index.ts +1 -2
- package/src/static/date-range-input/DateRangeInput.tsx +1 -0
- package/src/v2/components/InputCheckbox/InputCheckbox.scss +3 -3
- package/src/v2/components/NPSScore/NPSScore.tsx +2 -2
- package/src/v2/components/Tooltip/Tooltip.tsx +1 -2
- package/src/v2/components/ZoneCard/ZoneCard.scss +78 -0
- package/src/v2/components/index.ts +1 -0
- package/src/v2/dashboard-analytics/blog-posts/index.ts +1 -1
- package/src/v2/dashboard-analytics/chart/Chart.tsx +36 -31
- package/src/v2/dashboard-analytics/dashboard/Dashboard.tsx +1 -1
- package/src/v2/icons/Icons.stories.tsx +253 -0
- package/src/v2/icons/index.tsx +24 -0
- package/src/v2/index.ts +4 -0
- package/src/v2/navigation/DashboardLayout/DashboardLayout.tsx +1 -1
- package/src/v2/navigation/DashboardLayout/TopNavigation.tsx +9 -6
- package/src/v2/navigation/FigmasAdminSideBar/FigmasAdminSideBar.tsx +1 -1
- package/src/v2/navigation/FigmasSideBar/FigmasSideBar.tsx +6 -4
- package/src/v2/navigation/config.tsx +0 -1
- package/src/v2/pages/SettingsSubPage/SettingsSubPage.scss +43 -0
- package/src/v2/pages/SettingsSubPage/SettingsSubPage.tsx +49 -0
- package/src/v2/pages/SettingsSubPage/index.ts +2 -0
- package/src/v2/pages/auth/AuthLayout/AuthLayout.scss +140 -0
- package/src/v2/pages/auth/AuthLayout/AuthLayout.tsx +61 -0
- package/src/v2/pages/auth/AuthLayout/index.ts +2 -0
- package/src/v2/pages/auth/CreatePassword/CreatePasswordPage.scss +149 -0
- package/src/v2/pages/auth/CreatePassword/CreatePasswordPage.stories.tsx +45 -0
- package/src/v2/pages/auth/CreatePassword/CreatePasswordPage.tsx +179 -0
- package/src/v2/pages/auth/CreatePassword/index.ts +2 -0
- package/src/v2/pages/auth/Login/LoginPage.scss +49 -0
- package/src/v2/pages/auth/Login/LoginPage.stories.tsx +45 -0
- package/src/v2/pages/auth/Login/LoginPage.tsx +98 -0
- package/src/v2/pages/auth/Login/index.ts +2 -0
- package/src/v2/pages/auth/ResetPassword/ResetPasswordPage.scss +84 -0
- package/src/v2/pages/auth/ResetPassword/ResetPasswordPage.stories.tsx +53 -0
- package/src/v2/pages/auth/ResetPassword/ResetPasswordPage.tsx +109 -0
- package/src/v2/pages/auth/ResetPassword/index.ts +2 -0
- package/src/v2/pages/auth/VerifyEmail/VerifyEmailPage.scss +72 -0
- package/src/v2/pages/auth/VerifyEmail/VerifyEmailPage.stories.tsx +41 -0
- package/src/v2/pages/auth/VerifyEmail/VerifyEmailPage.tsx +110 -0
- package/src/v2/pages/auth/VerifyEmail/index.ts +2 -0
- package/src/v2/pages/auth/index.ts +14 -0
- package/src/v2/styles/form/NewInput.scss +12 -0
- package/src/v2/types/navigation.ts +3 -0
- package/src/virtualized/components/VirtualizedGrid.tsx +1 -0
- package/src/virtualized/components/VirtualizedWindowScroller.tsx +1 -0
- package/tsconfig.build.tsbuildinfo +1 -0
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
.auth-reset {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
gap: 0;
|
|
5
|
+
|
|
6
|
+
&__description {
|
|
7
|
+
font-family: var(--font-family-sans, 'Geist', sans-serif);
|
|
8
|
+
font-size: 15px;
|
|
9
|
+
font-weight: 400;
|
|
10
|
+
line-height: 1.4;
|
|
11
|
+
color: var(--label-primary);
|
|
12
|
+
margin: 0 0 24px;
|
|
13
|
+
padding: 0;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
&__field {
|
|
17
|
+
margin-bottom: 24px;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
&__actions {
|
|
21
|
+
margin-bottom: 16px;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
&__footer {
|
|
25
|
+
display: flex;
|
|
26
|
+
flex-direction: column;
|
|
27
|
+
gap: 8px;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
&__footer-text {
|
|
31
|
+
font-family: var(--font-family-sans, 'Geist', sans-serif);
|
|
32
|
+
font-size: 15px;
|
|
33
|
+
font-weight: 400;
|
|
34
|
+
color: var(--label-primary);
|
|
35
|
+
margin: 0;
|
|
36
|
+
padding: 0;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
&__link {
|
|
40
|
+
color: var(--label-action);
|
|
41
|
+
text-decoration: underline;
|
|
42
|
+
background: none;
|
|
43
|
+
border: none;
|
|
44
|
+
padding: 0;
|
|
45
|
+
cursor: pointer;
|
|
46
|
+
font-family: inherit;
|
|
47
|
+
font-size: inherit;
|
|
48
|
+
font-weight: inherit;
|
|
49
|
+
|
|
50
|
+
&:hover {
|
|
51
|
+
color: var(--label-action);
|
|
52
|
+
text-decoration: underline;
|
|
53
|
+
opacity: 0.8;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
&__error {
|
|
58
|
+
display: flex;
|
|
59
|
+
align-items: center;
|
|
60
|
+
gap: 8px;
|
|
61
|
+
padding: 10px 12px;
|
|
62
|
+
border-radius: 8px;
|
|
63
|
+
background-color: var(--surface-status-error);
|
|
64
|
+
border: 1px solid var(--border-status-error);
|
|
65
|
+
font-family: var(--font-family-sans, 'Geist', sans-serif);
|
|
66
|
+
font-size: 13px;
|
|
67
|
+
color: var(--label-status-error);
|
|
68
|
+
margin-bottom: 16px;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
&__success {
|
|
72
|
+
display: flex;
|
|
73
|
+
align-items: center;
|
|
74
|
+
gap: 8px;
|
|
75
|
+
padding: 10px 12px;
|
|
76
|
+
border-radius: 8px;
|
|
77
|
+
background-color: var(--surface-status-success);
|
|
78
|
+
border: 1px solid var(--border-status-success);
|
|
79
|
+
font-family: var(--font-family-sans, 'Geist', sans-serif);
|
|
80
|
+
font-size: 13px;
|
|
81
|
+
color: var(--label-status-success);
|
|
82
|
+
margin-bottom: 16px;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
3
|
+
import { ResetPasswordPage } from './ResetPasswordPage'
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof ResetPasswordPage> = {
|
|
6
|
+
title: 'v2/Pages/Auth/Reset Password',
|
|
7
|
+
component: ResetPasswordPage,
|
|
8
|
+
parameters: {
|
|
9
|
+
layout: 'fullscreen',
|
|
10
|
+
},
|
|
11
|
+
argTypes: {
|
|
12
|
+
onSubmit: { action: 'submitted' },
|
|
13
|
+
onBackToLogin: { action: 'back-to-login' },
|
|
14
|
+
isLoading: { control: 'boolean' },
|
|
15
|
+
error: { control: 'text' },
|
|
16
|
+
successMessage: { control: 'text' },
|
|
17
|
+
},
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export default meta
|
|
21
|
+
type Story = StoryObj<typeof ResetPasswordPage>
|
|
22
|
+
|
|
23
|
+
export const Default: Story = {
|
|
24
|
+
args: {
|
|
25
|
+
onSubmit: async (email) => {
|
|
26
|
+
console.log('Reset password for:', email)
|
|
27
|
+
},
|
|
28
|
+
onBackToLogin: () => {
|
|
29
|
+
console.log('Back to login clicked')
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export const Loading: Story = {
|
|
35
|
+
args: {
|
|
36
|
+
...Default.args,
|
|
37
|
+
isLoading: true,
|
|
38
|
+
},
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export const WithError: Story = {
|
|
42
|
+
args: {
|
|
43
|
+
...Default.args,
|
|
44
|
+
error: 'Failed to send reset email. Please try again.',
|
|
45
|
+
},
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export const WithSuccess: Story = {
|
|
49
|
+
args: {
|
|
50
|
+
...Default.args,
|
|
51
|
+
successMessage: 'Password reset email sent! Check your inbox.',
|
|
52
|
+
},
|
|
53
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { useForm } from 'react-hook-form'
|
|
3
|
+
import { useTranslation } from 'react-i18next'
|
|
4
|
+
import { AuthLayout } from '../AuthLayout'
|
|
5
|
+
import { FormField } from '../../../components/FormField'
|
|
6
|
+
import { Button } from '../../../components/Button'
|
|
7
|
+
import { RefreshIcon } from '../../../icons'
|
|
8
|
+
import emailRule from '@licklist/plugins/dist/validation/Rules/emailRule'
|
|
9
|
+
import './ResetPasswordPage.scss'
|
|
10
|
+
|
|
11
|
+
type FormValues = {
|
|
12
|
+
email: string
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface ResetPasswordPageProps {
|
|
16
|
+
onSubmit: (email: string) => Promise<void> | void
|
|
17
|
+
onBackToLogin?: () => void
|
|
18
|
+
isLoading?: boolean
|
|
19
|
+
error?: string
|
|
20
|
+
successMessage?: string
|
|
21
|
+
version?: string
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export const ResetPasswordPage: React.FC<ResetPasswordPageProps> = ({
|
|
25
|
+
onSubmit,
|
|
26
|
+
onBackToLogin,
|
|
27
|
+
isLoading = false,
|
|
28
|
+
error,
|
|
29
|
+
successMessage,
|
|
30
|
+
version,
|
|
31
|
+
}) => {
|
|
32
|
+
const { t } = useTranslation(['Validation', 'User'])
|
|
33
|
+
const { register, handleSubmit, formState: { errors } } = useForm<FormValues>({ mode: 'onChange' })
|
|
34
|
+
|
|
35
|
+
const onFormSubmit = async (data: FormValues) => {
|
|
36
|
+
await onSubmit(data.email)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<AuthLayout
|
|
41
|
+
badgeLabel={t('User:resetPasswordTitle')}
|
|
42
|
+
icon={<RefreshIcon />}
|
|
43
|
+
title={t('User:resetPasswordTitle')}
|
|
44
|
+
subtitle={t('User:resetPasswordSubtitle')}
|
|
45
|
+
version={version}
|
|
46
|
+
error={error}
|
|
47
|
+
successMessage={successMessage}
|
|
48
|
+
>
|
|
49
|
+
<form className="auth-reset" onSubmit={handleSubmit(onFormSubmit)} noValidate>
|
|
50
|
+
<p className="auth-reset__description">
|
|
51
|
+
{t('User:resetPasswordDescription')}
|
|
52
|
+
</p>
|
|
53
|
+
|
|
54
|
+
<FormField
|
|
55
|
+
className="auth-reset__field"
|
|
56
|
+
label={t('User:emailAddress')}
|
|
57
|
+
type="email"
|
|
58
|
+
disabled={isLoading}
|
|
59
|
+
error={errors.email?.message}
|
|
60
|
+
{...register('email', {
|
|
61
|
+
required: t('Validation:fieldRequired', { attribute: t('User:email') }) as string,
|
|
62
|
+
pattern: {
|
|
63
|
+
value: emailRule,
|
|
64
|
+
message: t('Validation:fieldValidEmail', { attribute: t('User:email') }) as string,
|
|
65
|
+
},
|
|
66
|
+
})}
|
|
67
|
+
/>
|
|
68
|
+
|
|
69
|
+
<div className="auth-reset__actions">
|
|
70
|
+
<Button
|
|
71
|
+
type="submit"
|
|
72
|
+
variant="primary"
|
|
73
|
+
isLoading={isLoading}
|
|
74
|
+
disabled={isLoading}
|
|
75
|
+
>
|
|
76
|
+
{t('User:resetPasswordTitle')}
|
|
77
|
+
</Button>
|
|
78
|
+
</div>
|
|
79
|
+
|
|
80
|
+
<div className="auth-reset__footer">
|
|
81
|
+
{onBackToLogin && (
|
|
82
|
+
<p className="auth-reset__footer-text">
|
|
83
|
+
{t('User:resetPasswordAlreadyAccount')}{' '}
|
|
84
|
+
<button
|
|
85
|
+
type="button"
|
|
86
|
+
className="auth-reset__link"
|
|
87
|
+
onClick={onBackToLogin}
|
|
88
|
+
disabled={isLoading}
|
|
89
|
+
>
|
|
90
|
+
{t('User:login')}
|
|
91
|
+
</button>
|
|
92
|
+
.
|
|
93
|
+
</p>
|
|
94
|
+
)}
|
|
95
|
+
<p className="auth-reset__footer-text">
|
|
96
|
+
{t('User:forFurtherSupport')}{' '}
|
|
97
|
+
<a
|
|
98
|
+
href="mailto:support@booked.it"
|
|
99
|
+
className="auth-reset__link"
|
|
100
|
+
>
|
|
101
|
+
{t('User:contactUs')}
|
|
102
|
+
</a>
|
|
103
|
+
.
|
|
104
|
+
</p>
|
|
105
|
+
</div>
|
|
106
|
+
</form>
|
|
107
|
+
</AuthLayout>
|
|
108
|
+
)
|
|
109
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
.auth-verify-email {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
gap: 0;
|
|
5
|
+
|
|
6
|
+
&__label {
|
|
7
|
+
font-family: var(--font-family-sans, 'Geist', sans-serif);
|
|
8
|
+
font-size: 15px;
|
|
9
|
+
font-weight: 600;
|
|
10
|
+
line-height: 20px;
|
|
11
|
+
color: var(--label-primary);
|
|
12
|
+
display: block;
|
|
13
|
+
margin-bottom: 8px;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
&__description {
|
|
17
|
+
font-family: var(--font-family-sans, 'Geist', sans-serif);
|
|
18
|
+
font-size: 14px;
|
|
19
|
+
font-weight: 400;
|
|
20
|
+
color: var(--label-secondary);
|
|
21
|
+
margin: 0 0 16px;
|
|
22
|
+
padding: 0;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
&__otp-group {
|
|
26
|
+
display: flex;
|
|
27
|
+
gap: 8px;
|
|
28
|
+
margin-bottom: 24px;
|
|
29
|
+
height: 62px;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
&__otp-input {
|
|
33
|
+
flex: 1;
|
|
34
|
+
background-color: var(--surface-secondary);
|
|
35
|
+
border: 2px solid var(--border-primary);
|
|
36
|
+
border-radius: 8px;
|
|
37
|
+
text-align: center;
|
|
38
|
+
font-family: var(--font-family-sans, 'Geist', sans-serif);
|
|
39
|
+
font-size: 20px;
|
|
40
|
+
font-weight: 600;
|
|
41
|
+
color: var(--label-primary);
|
|
42
|
+
transition: border-color 0.2s ease;
|
|
43
|
+
min-width: 0;
|
|
44
|
+
|
|
45
|
+
&:focus {
|
|
46
|
+
outline: none;
|
|
47
|
+
border-color: var(--border-selected, #6200EE);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
&::placeholder {
|
|
51
|
+
color: var(--label-secondary);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
&__actions {
|
|
56
|
+
margin-bottom: 0;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
&__error {
|
|
60
|
+
display: flex;
|
|
61
|
+
align-items: center;
|
|
62
|
+
gap: 8px;
|
|
63
|
+
padding: 10px 12px;
|
|
64
|
+
border-radius: 8px;
|
|
65
|
+
background-color: var(--surface-status-error);
|
|
66
|
+
border: 1px solid var(--border-status-error);
|
|
67
|
+
font-family: var(--font-family-sans, 'Geist', sans-serif);
|
|
68
|
+
font-size: 13px;
|
|
69
|
+
color: var(--label-status-error);
|
|
70
|
+
margin-bottom: 16px;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
3
|
+
import { VerifyEmailPage } from './VerifyEmailPage'
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof VerifyEmailPage> = {
|
|
6
|
+
title: 'v2/Pages/Auth/Verify Email',
|
|
7
|
+
component: VerifyEmailPage,
|
|
8
|
+
parameters: {
|
|
9
|
+
layout: 'fullscreen',
|
|
10
|
+
},
|
|
11
|
+
argTypes: {
|
|
12
|
+
onSubmit: { action: 'submitted' },
|
|
13
|
+
isLoading: { control: 'boolean' },
|
|
14
|
+
error: { control: 'text' },
|
|
15
|
+
},
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export default meta
|
|
19
|
+
type Story = StoryObj<typeof VerifyEmailPage>
|
|
20
|
+
|
|
21
|
+
export const Default: Story = {
|
|
22
|
+
args: {
|
|
23
|
+
onSubmit: async (code) => {
|
|
24
|
+
console.log('Verify code:', code)
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export const Loading: Story = {
|
|
30
|
+
args: {
|
|
31
|
+
...Default.args,
|
|
32
|
+
isLoading: true,
|
|
33
|
+
},
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export const WithError: Story = {
|
|
37
|
+
args: {
|
|
38
|
+
...Default.args,
|
|
39
|
+
error: 'Invalid verification code. Please try again.',
|
|
40
|
+
},
|
|
41
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import React, { useState, useRef } from 'react'
|
|
2
|
+
import { useTranslation } from 'react-i18next'
|
|
3
|
+
import { AuthLayout } from '../AuthLayout'
|
|
4
|
+
import { VerifyEmailIcon } from '../../../icons'
|
|
5
|
+
import { Button } from '../../../components/Button'
|
|
6
|
+
import './VerifyEmailPage.scss'
|
|
7
|
+
|
|
8
|
+
const CODE_LENGTH = 6
|
|
9
|
+
|
|
10
|
+
export interface VerifyEmailPageProps {
|
|
11
|
+
onSubmit: (code: string) => Promise<void> | void
|
|
12
|
+
isLoading?: boolean
|
|
13
|
+
error?: string
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const VerifyEmailPage: React.FC<VerifyEmailPageProps> = ({
|
|
17
|
+
onSubmit,
|
|
18
|
+
isLoading = false,
|
|
19
|
+
error,
|
|
20
|
+
}) => {
|
|
21
|
+
const { t } = useTranslation(['User'])
|
|
22
|
+
const [digits, setDigits] = useState<string[]>(Array(CODE_LENGTH).fill(''))
|
|
23
|
+
const inputRefs = useRef<(HTMLInputElement | null)[]>([])
|
|
24
|
+
|
|
25
|
+
const handleChange = (index: number, value: string) => {
|
|
26
|
+
const digit = value.replace(/\D/g, '').slice(-1)
|
|
27
|
+
const newDigits = [...digits]
|
|
28
|
+
newDigits[index] = digit
|
|
29
|
+
setDigits(newDigits)
|
|
30
|
+
|
|
31
|
+
if (digit && index < CODE_LENGTH - 1) {
|
|
32
|
+
inputRefs.current[index + 1]?.focus()
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const handleKeyDown = (index: number, e: React.KeyboardEvent<HTMLInputElement>) => {
|
|
37
|
+
if (e.key === 'Backspace' && !digits[index] && index > 0) {
|
|
38
|
+
inputRefs.current[index - 1]?.focus()
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const handlePaste = (e: React.ClipboardEvent) => {
|
|
43
|
+
e.preventDefault()
|
|
44
|
+
const pasted = e.clipboardData.getData('text').replace(/\D/g, '').slice(0, CODE_LENGTH)
|
|
45
|
+
if (!pasted) return
|
|
46
|
+
const newDigits = [...digits]
|
|
47
|
+
pasted.split('').forEach((char, i) => {
|
|
48
|
+
newDigits[i] = char
|
|
49
|
+
})
|
|
50
|
+
setDigits(newDigits)
|
|
51
|
+
const nextEmpty = pasted.length < CODE_LENGTH ? pasted.length : CODE_LENGTH - 1
|
|
52
|
+
inputRefs.current[nextEmpty]?.focus()
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const code = digits.join('')
|
|
56
|
+
|
|
57
|
+
const handleSubmit = async (e: React.FormEvent) => {
|
|
58
|
+
e.preventDefault()
|
|
59
|
+
if (code.length !== CODE_LENGTH) return
|
|
60
|
+
await onSubmit(code)
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return (
|
|
64
|
+
<AuthLayout
|
|
65
|
+
badgeLabel={t('User:verifyEmail')}
|
|
66
|
+
icon={<VerifyEmailIcon />}
|
|
67
|
+
title={t('User:verifyEmail')}
|
|
68
|
+
subtitle={t('User:verifyEmailSubtitle')}
|
|
69
|
+
error={error}
|
|
70
|
+
>
|
|
71
|
+
<form className="auth-verify-email" onSubmit={handleSubmit} noValidate>
|
|
72
|
+
<label className="auth-verify-email__label">
|
|
73
|
+
{t('User:verifyEmailCode')}
|
|
74
|
+
</label>
|
|
75
|
+
<p className="auth-verify-email__description">
|
|
76
|
+
{t('User:verifyEmailDescription')}
|
|
77
|
+
</p>
|
|
78
|
+
|
|
79
|
+
<div className="auth-verify-email__otp-group" onPaste={handlePaste}>
|
|
80
|
+
{digits.map((digit, index) => (
|
|
81
|
+
<input
|
|
82
|
+
key={index}
|
|
83
|
+
ref={(el) => { inputRefs.current[index] = el }}
|
|
84
|
+
type="text"
|
|
85
|
+
inputMode="numeric"
|
|
86
|
+
maxLength={1}
|
|
87
|
+
value={digit}
|
|
88
|
+
onChange={(e) => handleChange(index, e.target.value)}
|
|
89
|
+
onKeyDown={(e) => handleKeyDown(index, e)}
|
|
90
|
+
className="auth-verify-email__otp-input"
|
|
91
|
+
disabled={isLoading}
|
|
92
|
+
aria-label={`Digit ${index + 1}`}
|
|
93
|
+
/>
|
|
94
|
+
))}
|
|
95
|
+
</div>
|
|
96
|
+
|
|
97
|
+
<div className="auth-verify-email__actions">
|
|
98
|
+
<Button
|
|
99
|
+
type="submit"
|
|
100
|
+
variant="primary"
|
|
101
|
+
isLoading={isLoading}
|
|
102
|
+
disabled={isLoading}
|
|
103
|
+
>
|
|
104
|
+
{t('User:verifyCode')}
|
|
105
|
+
</Button>
|
|
106
|
+
</div>
|
|
107
|
+
</form>
|
|
108
|
+
</AuthLayout>
|
|
109
|
+
)
|
|
110
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export { AuthLayout } from './AuthLayout'
|
|
2
|
+
export type { AuthLayoutProps } from './AuthLayout'
|
|
3
|
+
|
|
4
|
+
export { LoginPage } from './Login'
|
|
5
|
+
export type { LoginPageProps } from './Login'
|
|
6
|
+
|
|
7
|
+
export { ResetPasswordPage } from './ResetPassword'
|
|
8
|
+
export type { ResetPasswordPageProps } from './ResetPassword'
|
|
9
|
+
|
|
10
|
+
export { CreatePasswordPage } from './CreatePassword'
|
|
11
|
+
export type { CreatePasswordPageProps } from './CreatePassword'
|
|
12
|
+
|
|
13
|
+
export { VerifyEmailPage } from './VerifyEmail'
|
|
14
|
+
export type { VerifyEmailPageProps } from './VerifyEmail'
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
&__input {
|
|
36
36
|
@include typography('text.regular');
|
|
37
37
|
flex: 1 0 0;
|
|
38
|
+
color: var(--label-primary, #121e52);
|
|
38
39
|
background-color: var(--surfaces-main-background-secondary);
|
|
39
40
|
border: 2px solid var(--border-primary);
|
|
40
41
|
border-radius: var(--radius-md);
|
|
@@ -57,6 +58,17 @@
|
|
|
57
58
|
&::placeholder {
|
|
58
59
|
color: var(--labels-main-label-secondary, #626a90);
|
|
59
60
|
}
|
|
61
|
+
|
|
62
|
+
&[type="date"]::-webkit-datetime-edit-text,
|
|
63
|
+
&[type="date"]::-webkit-datetime-edit-month-field,
|
|
64
|
+
&[type="date"]::-webkit-datetime-edit-day-field,
|
|
65
|
+
&[type="date"]::-webkit-datetime-edit-year-field,
|
|
66
|
+
&[type="time"]::-webkit-datetime-edit-text,
|
|
67
|
+
&[type="time"]::-webkit-datetime-edit-hour-field,
|
|
68
|
+
&[type="time"]::-webkit-datetime-edit-minute-field,
|
|
69
|
+
&[type="time"]::-webkit-datetime-edit-ampm-field {
|
|
70
|
+
color: var(--label-primary, #121e52);
|
|
71
|
+
}
|
|
60
72
|
}
|
|
61
73
|
|
|
62
74
|
&__textarea {
|