@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.
Files changed (132) hide show
  1. package/.yarnrc.yml +5 -0
  2. package/dist/custom-fields/constants.d.ts +9 -8
  3. package/dist/custom-fields/constants.d.ts.map +1 -1
  4. package/dist/events/event-venue-map/utils/index.d.ts +1 -1
  5. package/dist/events/event-venue-map/utils/index.d.ts.map +1 -1
  6. package/dist/iframe/event/event-venue-map/IframeEventVenueMap.d.ts +3 -3
  7. package/dist/iframe/order-process/components/BookingSummary/utils/index.d.ts +1 -1
  8. package/dist/iframe/order-process/components/BookingSummary/utils/index.d.ts.map +1 -1
  9. package/dist/iframe/payment/order-items-table/hooks/useTableData.d.ts +5 -15
  10. package/dist/iframe/payment/order-items-table/hooks/useTableData.d.ts.map +1 -1
  11. package/dist/iframe/payment/order-items-table/utils/index.d.ts +4 -4
  12. package/dist/iframe/payment/order-items-table/utils/index.d.ts.map +1 -1
  13. package/dist/index.d.ts +1 -2
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/index.js +1 -1
  16. package/dist/product-set/form/SelectCategoryModal.d.ts +5 -5
  17. package/dist/product-set/utils/index.d.ts +12 -12
  18. package/dist/sales/coupon/utils/index.d.ts +2 -2
  19. package/dist/static/date-range-input/DateRangeInput.d.ts.map +1 -1
  20. package/dist/v2/components/InputCheckbox/InputCheckbox.scss.js +1 -1
  21. package/dist/v2/components/Tooltip/Tooltip.d.ts +0 -1
  22. package/dist/v2/components/Tooltip/Tooltip.d.ts.map +1 -1
  23. package/dist/v2/components/ZoneCard/ZoneCard.scss.js +1 -1
  24. package/dist/v2/components/index.d.ts +1 -1
  25. package/dist/v2/components/index.d.ts.map +1 -1
  26. package/dist/v2/dashboard-analytics/blog-posts/index.d.ts +1 -1
  27. package/dist/v2/dashboard-analytics/blog-posts/index.d.ts.map +1 -1
  28. package/dist/v2/dashboard-analytics/chart/Chart.d.ts.map +1 -1
  29. package/dist/v2/dashboard-analytics/chart/Chart.js +3 -2
  30. package/dist/v2/icons/index.d.ts +14 -0
  31. package/dist/v2/icons/index.d.ts.map +1 -1
  32. package/dist/v2/icons/index.js +47 -1
  33. package/dist/v2/index.d.ts +2 -0
  34. package/dist/v2/index.d.ts.map +1 -1
  35. package/dist/v2/navigation/DashboardLayout/DashboardLayout.js +1 -1
  36. package/dist/v2/navigation/DashboardLayout/TopNavigation.d.ts.map +1 -1
  37. package/dist/v2/navigation/FigmasSideBar/FigmasSideBar.d.ts.map +1 -1
  38. package/dist/v2/navigation/config.d.ts.map +1 -1
  39. package/dist/v2/pages/SettingsSubPage/SettingsSubPage.d.ts +12 -0
  40. package/dist/v2/pages/SettingsSubPage/SettingsSubPage.d.ts.map +1 -0
  41. package/dist/v2/pages/SettingsSubPage/index.d.ts +3 -0
  42. package/dist/v2/pages/SettingsSubPage/index.d.ts.map +1 -0
  43. package/dist/v2/pages/auth/AuthLayout/AuthLayout.d.ts +14 -0
  44. package/dist/v2/pages/auth/AuthLayout/AuthLayout.d.ts.map +1 -0
  45. package/dist/v2/pages/auth/AuthLayout/index.d.ts +3 -0
  46. package/dist/v2/pages/auth/AuthLayout/index.d.ts.map +1 -0
  47. package/dist/v2/pages/auth/CreatePassword/CreatePasswordPage.d.ts +10 -0
  48. package/dist/v2/pages/auth/CreatePassword/CreatePasswordPage.d.ts.map +1 -0
  49. package/dist/v2/pages/auth/CreatePassword/index.d.ts +3 -0
  50. package/dist/v2/pages/auth/CreatePassword/index.d.ts.map +1 -0
  51. package/dist/v2/pages/auth/Login/LoginPage.d.ts +11 -0
  52. package/dist/v2/pages/auth/Login/LoginPage.d.ts.map +1 -0
  53. package/dist/v2/pages/auth/Login/index.d.ts +3 -0
  54. package/dist/v2/pages/auth/Login/index.d.ts.map +1 -0
  55. package/dist/v2/pages/auth/ResetPassword/ResetPasswordPage.d.ts +12 -0
  56. package/dist/v2/pages/auth/ResetPassword/ResetPasswordPage.d.ts.map +1 -0
  57. package/dist/v2/pages/auth/ResetPassword/index.d.ts +3 -0
  58. package/dist/v2/pages/auth/ResetPassword/index.d.ts.map +1 -0
  59. package/dist/v2/pages/auth/VerifyEmail/VerifyEmailPage.d.ts +9 -0
  60. package/dist/v2/pages/auth/VerifyEmail/VerifyEmailPage.d.ts.map +1 -0
  61. package/dist/v2/pages/auth/VerifyEmail/index.d.ts +3 -0
  62. package/dist/v2/pages/auth/VerifyEmail/index.d.ts.map +1 -0
  63. package/dist/v2/pages/auth/index.d.ts +11 -0
  64. package/dist/v2/pages/auth/index.d.ts.map +1 -0
  65. package/dist/v2/styles/common.scss +7 -0
  66. package/dist/v2/styles/components/Button.scss +199 -0
  67. package/dist/v2/styles/form/Layout.scss +15 -0
  68. package/dist/v2/styles/form/NewInput.scss +271 -0
  69. package/dist/v2/styles/form/NewInput.scss.js +1 -1
  70. package/dist/v2/styles/index.scss +6 -0
  71. package/dist/v2/styles/navigation/Navigation.scss +17 -0
  72. package/dist/v2/styles/navigation/NavigationItem.scss +86 -0
  73. package/dist/v2/styles/navigation/NavigationSection.scss +26 -0
  74. package/dist/v2/styles/navigation/_index.scss +9 -0
  75. package/dist/v2/styles/tokens/_colors.scss +562 -0
  76. package/dist/v2/styles/tokens/_sizes.scss +125 -0
  77. package/dist/v2/styles/tokens/_status.scss +108 -0
  78. package/dist/v2/styles/tokens/_typography.scss +146 -0
  79. package/dist/v2/types/navigation.d.ts +2 -0
  80. package/dist/v2/types/navigation.d.ts.map +1 -1
  81. package/dist/virtualized/components/VirtualizedGrid.d.ts.map +1 -1
  82. package/dist/virtualized/components/VirtualizedWindowScroller.d.ts.map +1 -1
  83. package/dist/virtualized/components/VirtualizedWindowScroller.js +3 -2
  84. package/package.json +4 -4
  85. package/rollup.config.js +7 -0
  86. package/src/auth/Authorizer.tsx +1 -1
  87. package/src/index.ts +1 -2
  88. package/src/static/date-range-input/DateRangeInput.tsx +1 -0
  89. package/src/v2/components/InputCheckbox/InputCheckbox.scss +3 -3
  90. package/src/v2/components/NPSScore/NPSScore.tsx +2 -2
  91. package/src/v2/components/Tooltip/Tooltip.tsx +1 -2
  92. package/src/v2/components/ZoneCard/ZoneCard.scss +78 -0
  93. package/src/v2/components/index.ts +1 -0
  94. package/src/v2/dashboard-analytics/blog-posts/index.ts +1 -1
  95. package/src/v2/dashboard-analytics/chart/Chart.tsx +36 -31
  96. package/src/v2/dashboard-analytics/dashboard/Dashboard.tsx +1 -1
  97. package/src/v2/icons/Icons.stories.tsx +253 -0
  98. package/src/v2/icons/index.tsx +24 -0
  99. package/src/v2/index.ts +4 -0
  100. package/src/v2/navigation/DashboardLayout/DashboardLayout.tsx +1 -1
  101. package/src/v2/navigation/DashboardLayout/TopNavigation.tsx +9 -6
  102. package/src/v2/navigation/FigmasAdminSideBar/FigmasAdminSideBar.tsx +1 -1
  103. package/src/v2/navigation/FigmasSideBar/FigmasSideBar.tsx +6 -4
  104. package/src/v2/navigation/config.tsx +0 -1
  105. package/src/v2/pages/SettingsSubPage/SettingsSubPage.scss +43 -0
  106. package/src/v2/pages/SettingsSubPage/SettingsSubPage.tsx +49 -0
  107. package/src/v2/pages/SettingsSubPage/index.ts +2 -0
  108. package/src/v2/pages/auth/AuthLayout/AuthLayout.scss +140 -0
  109. package/src/v2/pages/auth/AuthLayout/AuthLayout.tsx +61 -0
  110. package/src/v2/pages/auth/AuthLayout/index.ts +2 -0
  111. package/src/v2/pages/auth/CreatePassword/CreatePasswordPage.scss +149 -0
  112. package/src/v2/pages/auth/CreatePassword/CreatePasswordPage.stories.tsx +45 -0
  113. package/src/v2/pages/auth/CreatePassword/CreatePasswordPage.tsx +179 -0
  114. package/src/v2/pages/auth/CreatePassword/index.ts +2 -0
  115. package/src/v2/pages/auth/Login/LoginPage.scss +49 -0
  116. package/src/v2/pages/auth/Login/LoginPage.stories.tsx +45 -0
  117. package/src/v2/pages/auth/Login/LoginPage.tsx +98 -0
  118. package/src/v2/pages/auth/Login/index.ts +2 -0
  119. package/src/v2/pages/auth/ResetPassword/ResetPasswordPage.scss +84 -0
  120. package/src/v2/pages/auth/ResetPassword/ResetPasswordPage.stories.tsx +53 -0
  121. package/src/v2/pages/auth/ResetPassword/ResetPasswordPage.tsx +109 -0
  122. package/src/v2/pages/auth/ResetPassword/index.ts +2 -0
  123. package/src/v2/pages/auth/VerifyEmail/VerifyEmailPage.scss +72 -0
  124. package/src/v2/pages/auth/VerifyEmail/VerifyEmailPage.stories.tsx +41 -0
  125. package/src/v2/pages/auth/VerifyEmail/VerifyEmailPage.tsx +110 -0
  126. package/src/v2/pages/auth/VerifyEmail/index.ts +2 -0
  127. package/src/v2/pages/auth/index.ts +14 -0
  128. package/src/v2/styles/form/NewInput.scss +12 -0
  129. package/src/v2/types/navigation.ts +3 -0
  130. package/src/virtualized/components/VirtualizedGrid.tsx +1 -0
  131. package/src/virtualized/components/VirtualizedWindowScroller.tsx +1 -0
  132. package/tsconfig.build.tsbuildinfo +1 -0
@@ -0,0 +1,61 @@
1
+ import React, { useState, useEffect } from 'react'
2
+ import './AuthLayout.scss'
3
+ import { DashboardFooter } from '../../../navigation/DashboardLayout/DashboardFooter'
4
+ import { AuthBgDecorationIcon, BookedLogo } from '../../../icons'
5
+ import { Badge } from '../../../components/Badge'
6
+ import { Alert } from '../../../components/Alert'
7
+
8
+ export interface AuthLayoutProps {
9
+ badgeLabel: string
10
+ icon: React.ReactNode
11
+ title: string
12
+ subtitle: string
13
+ children: React.ReactNode
14
+ version?: string
15
+ error?: string
16
+ successMessage?: string
17
+ }
18
+
19
+ export const AuthLayout: React.FC<AuthLayoutProps> = ({ badgeLabel, icon, title, subtitle, children, version, error, successMessage }) => {
20
+ const [dismissed, setDismissed] = useState(false)
21
+
22
+ useEffect(() => {
23
+ setDismissed(false)
24
+ }, [error, successMessage])
25
+
26
+ const showError = error && !dismissed
27
+ const showSuccess = successMessage && !dismissed
28
+
29
+ return (
30
+ <div className="auth-layout">
31
+ <AuthBgDecorationIcon />
32
+
33
+ {showError && (
34
+ <Alert variant="error" title="Error" message={error} className="auth-layout__alert" onDismiss={() => setDismissed(true)} />
35
+ )}
36
+ {showSuccess && (
37
+ <Alert variant="success" title="Success" message={successMessage} className="auth-layout__alert" onDismiss={() => setDismissed(true)} />
38
+ )}
39
+
40
+ <div className="auth-layout__card">
41
+ <div className="auth-layout__header">
42
+ <BookedLogo />
43
+ <Badge>{badgeLabel}</Badge>
44
+ </div>
45
+ <div className="auth-layout__body">
46
+ <div className="auth-layout__content">
47
+ <div className="auth-layout__info">
48
+ <div className="auth-layout__icon">{icon}</div>
49
+ <h1 className="auth-layout__title">{title}</h1>
50
+ <p className="auth-layout__subtitle">{subtitle}</p>
51
+ </div>
52
+ <div className="auth-layout__form-area">
53
+ {children}
54
+ </div>
55
+ </div>
56
+ </div>
57
+ </div>
58
+ <DashboardFooter version={version} />
59
+ </div>
60
+ )
61
+ }
@@ -0,0 +1,2 @@
1
+ export { AuthLayout } from './AuthLayout'
2
+ export type { AuthLayoutProps } from './AuthLayout'
@@ -0,0 +1,149 @@
1
+ .auth-create-password {
2
+ display: flex;
3
+ flex-direction: column;
4
+ gap: 0;
5
+
6
+ &__requirements {
7
+ margin-bottom: 24px;
8
+ }
9
+
10
+ &__requirements-title {
11
+ font-family: var(--font-family-sans, 'Geist', sans-serif);
12
+ font-size: 15px;
13
+ font-weight: 600;
14
+ line-height: 1.4;
15
+ color: var(--label-primary);
16
+ margin: 0 0 8px;
17
+ padding: 0;
18
+ }
19
+
20
+ &__requirements-list {
21
+ list-style: none;
22
+ margin: 0;
23
+ padding: 0;
24
+ display: flex;
25
+ flex-direction: column;
26
+ gap: 6px;
27
+ }
28
+
29
+ &__requirement-item {
30
+ display: flex;
31
+ align-items: center;
32
+ gap: 8px;
33
+ font-family: var(--font-family-sans, 'Geist', sans-serif);
34
+ font-size: 15px;
35
+ font-weight: 400;
36
+ line-height: 1.4;
37
+ color: var(--label-primary);
38
+ }
39
+
40
+ &__requirement-icon {
41
+ width: 16px;
42
+ height: 16px;
43
+ flex-shrink: 0;
44
+ border-radius: 50%;
45
+ display: flex;
46
+ align-items: center;
47
+ justify-content: center;
48
+
49
+ &--met {
50
+ color: var(--label-status-success);
51
+ }
52
+
53
+ &--unmet {
54
+ color: var(--label-status-error);
55
+ }
56
+
57
+ &--neutral {
58
+ color: var(--label-tertiary);
59
+ }
60
+ }
61
+
62
+ &__field {
63
+ margin-bottom: 16px;
64
+ }
65
+
66
+ &__field--last {
67
+ margin-bottom: 24px;
68
+ }
69
+
70
+ &__strength {
71
+ margin-top: 8px;
72
+ }
73
+
74
+ &__strength-header {
75
+ display: flex;
76
+ justify-content: space-between;
77
+ margin-bottom: 4px;
78
+ font-family: var(--font-family-sans, 'Geist', sans-serif);
79
+ font-size: 12px;
80
+ color: var(--label-secondary);
81
+ }
82
+
83
+ &__strength-bar-track {
84
+ height: 4px;
85
+ background-color: var(--surface-tertiary);
86
+ border-radius: 4px;
87
+ overflow: hidden;
88
+ }
89
+
90
+ &__strength-bar-fill {
91
+ height: 100%;
92
+ border-radius: 4px;
93
+ transition: width 0.3s ease, background-color 0.3s ease;
94
+ }
95
+
96
+ &__match {
97
+ display: flex;
98
+ align-items: center;
99
+ gap: 8px;
100
+ margin-top: 8px;
101
+ font-family: var(--font-family-sans, 'Geist', sans-serif);
102
+ font-size: 13px;
103
+
104
+ &--match {
105
+ color: var(--label-status-success);
106
+ }
107
+
108
+ &--no-match {
109
+ color: var(--label-status-error);
110
+ }
111
+ }
112
+
113
+ &__actions {
114
+ display: flex;
115
+ flex-direction: column;
116
+ gap: 12px;
117
+ align-items: flex-start;
118
+ }
119
+
120
+ &__reset-link {
121
+ font-family: var(--font-family-sans, 'Geist', sans-serif);
122
+ font-size: 15px;
123
+ font-weight: 400;
124
+ color: var(--label-action);
125
+ text-decoration: underline;
126
+ background: none;
127
+ border: none;
128
+ padding: 0;
129
+ cursor: pointer;
130
+
131
+ &:hover {
132
+ opacity: 0.8;
133
+ }
134
+ }
135
+
136
+ &__error {
137
+ display: flex;
138
+ align-items: center;
139
+ gap: 8px;
140
+ padding: 10px 12px;
141
+ border-radius: 8px;
142
+ background-color: var(--surface-status-error);
143
+ border: 1px solid var(--border-status-error);
144
+ font-family: var(--font-family-sans, 'Geist', sans-serif);
145
+ font-size: 13px;
146
+ color: var(--label-status-error);
147
+ margin-bottom: 16px;
148
+ }
149
+ }
@@ -0,0 +1,45 @@
1
+ import React from 'react'
2
+ import type { Meta, StoryObj } from '@storybook/react'
3
+ import { CreatePasswordPage } from './CreatePasswordPage'
4
+
5
+ const meta: Meta<typeof CreatePasswordPage> = {
6
+ title: 'v2/Pages/Auth/Create Password',
7
+ component: CreatePasswordPage,
8
+ parameters: {
9
+ layout: 'fullscreen',
10
+ },
11
+ argTypes: {
12
+ onSubmit: { action: 'submitted' },
13
+ onResetInstead: { action: 'reset-instead' },
14
+ isLoading: { control: 'boolean' },
15
+ error: { control: 'text' },
16
+ },
17
+ }
18
+
19
+ export default meta
20
+ type Story = StoryObj<typeof CreatePasswordPage>
21
+
22
+ export const Default: Story = {
23
+ args: {
24
+ onSubmit: async (password) => {
25
+ console.log('Set password:', password)
26
+ },
27
+ onResetInstead: () => {
28
+ console.log('Reset instead clicked')
29
+ },
30
+ },
31
+ }
32
+
33
+ export const Loading: Story = {
34
+ args: {
35
+ ...Default.args,
36
+ isLoading: true,
37
+ },
38
+ }
39
+
40
+ export const WithError: Story = {
41
+ args: {
42
+ ...Default.args,
43
+ error: 'Failed to update password. Please try again.',
44
+ },
45
+ }
@@ -0,0 +1,179 @@
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 { PasswordTypeIcon, PasswordRequirementIcon } from '../../../icons'
8
+ import './CreatePasswordPage.scss'
9
+
10
+ type FormValues = {
11
+ password: string
12
+ confirmPassword: string
13
+ }
14
+
15
+ export interface CreatePasswordPageProps {
16
+ onSubmit: (password: string) => Promise<void> | void
17
+ onResetInstead?: () => void
18
+ isLoading?: boolean
19
+ error?: string
20
+ }
21
+
22
+ export const CreatePasswordPage: React.FC<CreatePasswordPageProps> = ({
23
+ onSubmit,
24
+ onResetInstead,
25
+ isLoading = false,
26
+ error,
27
+ }) => {
28
+ const { t } = useTranslation(['Validation', 'User'])
29
+ const { register, handleSubmit, watch, formState: { errors } } = useForm<FormValues>({ mode: 'onChange' })
30
+
31
+ const password = watch('password', '')
32
+ const confirmPassword = watch('confirmPassword', '')
33
+
34
+ const hasNumber = /\d/.test(password)
35
+ const hasCapital = /[A-Z]/.test(password)
36
+ const hasMinLength = password.length >= 8
37
+
38
+ const criteriaCount = [hasNumber, hasCapital, hasMinLength].filter(Boolean).length
39
+
40
+ const getStrengthColor = () => {
41
+ if (password.length === 0) return 'transparent'
42
+ if (criteriaCount <= 1) return 'var(--red-600)'
43
+ if (criteriaCount === 2) return 'var(--orange-500)'
44
+ return 'var(--green-600)'
45
+ }
46
+
47
+ const getStrengthWidth = () => {
48
+ if (password.length === 0) return '0%'
49
+ if (criteriaCount <= 1) return '33%'
50
+ if (criteriaCount === 2) return '66%'
51
+ return '100%'
52
+ }
53
+
54
+ const getStrengthLabel = () => {
55
+ if (password.length === 0) return ''
56
+ if (criteriaCount <= 1) return t('User:passwordStrengthWeak')
57
+ if (criteriaCount === 2) return t('User:passwordStrengthMedium')
58
+ return t('User:passwordStrengthStrong')
59
+ }
60
+
61
+ const passwordsMatch = password === confirmPassword && confirmPassword.length > 0
62
+ const showMatchIndicator = confirmPassword.length > 0
63
+
64
+ const onFormSubmit = async (data: FormValues) => {
65
+ await onSubmit(data.password)
66
+ }
67
+
68
+ return (
69
+ <AuthLayout
70
+ badgeLabel={t('User:newPassword')}
71
+ icon={<PasswordTypeIcon />}
72
+ title={t('User:newPassword')}
73
+ subtitle={t('User:newPasswordSubtitle')}
74
+ error={error}
75
+ >
76
+ <form className="auth-create-password" onSubmit={handleSubmit(onFormSubmit)} noValidate>
77
+
78
+ <div className="auth-create-password__requirements">
79
+ <p className="auth-create-password__requirements-title">
80
+ {t('User:passwordsMustContain')}
81
+ </p>
82
+ <ul className="auth-create-password__requirements-list">
83
+ <li className="auth-create-password__requirement-item">
84
+ <PasswordRequirementIcon met={hasNumber} visible={password.length > 0} />
85
+ {t('User:passwordRequireNumber')}
86
+ </li>
87
+ <li className="auth-create-password__requirement-item">
88
+ <PasswordRequirementIcon met={hasCapital} visible={password.length > 0} />
89
+ {t('User:passwordRequireCapital')}
90
+ </li>
91
+ <li className="auth-create-password__requirement-item">
92
+ <PasswordRequirementIcon met={hasMinLength} visible={password.length > 0} />
93
+ {t('User:passwordRequireMinLength')}
94
+ </li>
95
+ </ul>
96
+ </div>
97
+
98
+ <div className="auth-create-password__field">
99
+ <FormField
100
+ label={t('User:password')}
101
+ type="password"
102
+ disabled={isLoading}
103
+ error={errors.password?.message}
104
+ {...register('password', {
105
+ required: t('Validation:fieldRequired', { attribute: t('User:password') }) as string,
106
+ minLength: {
107
+ value: 8,
108
+ message: t('Validation:fieldMinLength', { attribute: t('User:password'), min: 8 }) as string,
109
+ },
110
+ })}
111
+ />
112
+ {password.length > 0 && (
113
+ <div className="auth-create-password__strength">
114
+ <div className="auth-create-password__strength-header">
115
+ <span>{t('User:passwordStrength')}</span>
116
+ <span>{getStrengthLabel()}</span>
117
+ </div>
118
+ <div className="auth-create-password__strength-bar-track">
119
+ <div
120
+ className="auth-create-password__strength-bar-fill"
121
+ style={{
122
+ width: getStrengthWidth(),
123
+ backgroundColor: getStrengthColor(),
124
+ }}
125
+ />
126
+ </div>
127
+ </div>
128
+ )}
129
+ </div>
130
+
131
+ <div className="auth-create-password__field--last">
132
+ <FormField
133
+ label={t('User:confirmPassword')}
134
+ type="password"
135
+ disabled={isLoading}
136
+ error={errors.confirmPassword?.message}
137
+ {...register('confirmPassword', {
138
+ required: t('Validation:fieldRequired', { attribute: t('User:confirmPassword') }) as string,
139
+ validate: (value) =>
140
+ value === password ||
141
+ (t('Validation:fieldDoesntMatchField', {
142
+ field1: t('User:confirmPassword'),
143
+ field2: t('User:password'),
144
+ }) as string),
145
+ })}
146
+ />
147
+ {showMatchIndicator && (
148
+ <div className={`auth-create-password__match auth-create-password__match--${passwordsMatch ? 'match' : 'no-match'}`}>
149
+ <PasswordRequirementIcon met={passwordsMatch} />
150
+ {passwordsMatch ? t('User:passwordsMatch') : t('User:passwordsDoNotMatch')}
151
+ </div>
152
+ )}
153
+ </div>
154
+
155
+ <div className="auth-create-password__actions">
156
+ <Button
157
+ type="submit"
158
+ variant="primary"
159
+ isLoading={isLoading}
160
+ disabled={isLoading}
161
+ >
162
+ {t('User:submit')}
163
+ </Button>
164
+
165
+ {onResetInstead && (
166
+ <button
167
+ type="button"
168
+ className="auth-create-password__reset-link"
169
+ onClick={onResetInstead}
170
+ disabled={isLoading}
171
+ >
172
+ {t('User:resetPasswordInstead')}
173
+ </button>
174
+ )}
175
+ </div>
176
+ </form>
177
+ </AuthLayout>
178
+ )
179
+ }
@@ -0,0 +1,2 @@
1
+ export { CreatePasswordPage } from './CreatePasswordPage'
2
+ export type { CreatePasswordPageProps } from './CreatePasswordPage'
@@ -0,0 +1,49 @@
1
+ .auth-login {
2
+ display: flex;
3
+ flex-direction: column;
4
+ gap: 0;
5
+
6
+ &__field {
7
+ margin-bottom: 16px;
8
+ }
9
+
10
+ &__field--last {
11
+ margin-bottom: 24px;
12
+ }
13
+
14
+ &__forgot {
15
+ display: inline-block;
16
+ margin-top: 8px;
17
+ font-family: var(--font-family-sans, 'Geist', sans-serif);
18
+ font-size: 15px;
19
+ font-weight: 400;
20
+ color: var(--label-action);
21
+ text-decoration: underline;
22
+ background: none;
23
+ border: none;
24
+ padding: 0;
25
+ cursor: pointer;
26
+
27
+ &:hover {
28
+ opacity: 0.8;
29
+ }
30
+ }
31
+
32
+ &__actions {
33
+ margin-bottom: 0;
34
+ }
35
+
36
+ &__error {
37
+ display: flex;
38
+ align-items: center;
39
+ gap: 8px;
40
+ padding: 10px 12px;
41
+ border-radius: 8px;
42
+ background-color: var(--surface-status-error);
43
+ border: 1px solid var(--border-status-error);
44
+ font-family: var(--font-family-sans, 'Geist', sans-serif);
45
+ font-size: 13px;
46
+ color: var(--label-status-error);
47
+ margin-bottom: 16px;
48
+ }
49
+ }
@@ -0,0 +1,45 @@
1
+ import React from 'react'
2
+ import type { Meta, StoryObj } from '@storybook/react'
3
+ import { LoginPage } from './LoginPage'
4
+
5
+ const meta: Meta<typeof LoginPage> = {
6
+ title: 'v2/Pages/Auth/Login',
7
+ component: LoginPage,
8
+ parameters: {
9
+ layout: 'fullscreen',
10
+ },
11
+ argTypes: {
12
+ onSubmit: { action: 'submitted' },
13
+ onForgotPassword: { action: 'forgot-password' },
14
+ isLoading: { control: 'boolean' },
15
+ error: { control: 'text' },
16
+ },
17
+ }
18
+
19
+ export default meta
20
+ type Story = StoryObj<typeof LoginPage>
21
+
22
+ export const Default: Story = {
23
+ args: {
24
+ onSubmit: async (email, password) => {
25
+ console.log('Login:', email, password)
26
+ },
27
+ onForgotPassword: () => {
28
+ console.log('Forgot password clicked')
29
+ },
30
+ },
31
+ }
32
+
33
+ export const Loading: Story = {
34
+ args: {
35
+ ...Default.args,
36
+ isLoading: true,
37
+ },
38
+ }
39
+
40
+ export const WithError: Story = {
41
+ args: {
42
+ ...Default.args,
43
+ error: 'Invalid email or password. Please try again.',
44
+ },
45
+ }
@@ -0,0 +1,98 @@
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 { SecurityIcon } from '../../../icons'
8
+ import emailRule from '@licklist/plugins/dist/validation/Rules/emailRule'
9
+ import './LoginPage.scss'
10
+
11
+ type FormValues = {
12
+ email: string
13
+ password: string
14
+ }
15
+
16
+ export interface LoginPageProps {
17
+ onSubmit: (email: string, password: string) => Promise<void> | void
18
+ onForgotPassword?: () => void
19
+ isLoading?: boolean
20
+ error?: string
21
+ version?: string
22
+ }
23
+
24
+ export const LoginPage: React.FC<LoginPageProps> = ({
25
+ onSubmit,
26
+ onForgotPassword,
27
+ isLoading = false,
28
+ error,
29
+ version,
30
+ }) => {
31
+ const { t } = useTranslation(['Validation', 'User'])
32
+ const { register, handleSubmit, formState: { errors } } = useForm<FormValues>({ mode: 'onChange' })
33
+
34
+ const onFormSubmit = async (data: FormValues) => {
35
+ await onSubmit(data.email, data.password)
36
+ }
37
+
38
+ return (
39
+ <AuthLayout
40
+ badgeLabel={t('User:login')}
41
+ icon={<SecurityIcon />}
42
+ title={t('User:login')}
43
+ subtitle={t('User:loginSubtitle')}
44
+ version={version}
45
+ error={error}
46
+ >
47
+ <form className="auth-login" onSubmit={handleSubmit(onFormSubmit)} noValidate>
48
+ <FormField
49
+ className="auth-login__field"
50
+ label={t('User:emailAddress')}
51
+ type="email"
52
+ disabled={isLoading}
53
+ error={errors.email?.message}
54
+ {...register('email', {
55
+ required: t('Validation:fieldRequired', { attribute: t('User:email') }) as string,
56
+ pattern: {
57
+ value: emailRule,
58
+ message: t('Validation:fieldValidEmail', { attribute: t('User:email') }) as string,
59
+ },
60
+ })}
61
+ />
62
+
63
+ <div className="auth-login__field--last">
64
+ <FormField
65
+ label={t('User:password')}
66
+ type="password"
67
+ disabled={isLoading}
68
+ error={errors.password?.message}
69
+ {...register('password', {
70
+ required: t('Validation:fieldRequired', { attribute: t('User:password') }) as string,
71
+ })}
72
+ />
73
+ {onForgotPassword && (
74
+ <button
75
+ type="button"
76
+ className="auth-login__forgot"
77
+ onClick={onForgotPassword}
78
+ disabled={isLoading}
79
+ >
80
+ {t('User:forgotPassword')}
81
+ </button>
82
+ )}
83
+ </div>
84
+
85
+ <div className="auth-login__actions">
86
+ <Button
87
+ type="submit"
88
+ variant="primary"
89
+ isLoading={isLoading}
90
+ disabled={isLoading}
91
+ >
92
+ {t('User:login')}
93
+ </Button>
94
+ </div>
95
+ </form>
96
+ </AuthLayout>
97
+ )
98
+ }
@@ -0,0 +1,2 @@
1
+ export { LoginPage } from './LoginPage'
2
+ export type { LoginPageProps } from './LoginPage'