@pisell/materials 1.0.544 → 1.0.546
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/build/lowcode/assets/3aabdcc7a349f06ed35f441355ffd5be.png +0 -0
- package/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/index.js +1 -1
- package/build/lowcode/meta.js +5 -5
- package/build/lowcode/preview.js +7 -7
- package/build/lowcode/render/default/assets/3aabdcc7a349f06ed35f441355ffd5be.png +0 -0
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +21 -21
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +20 -20
- package/es/components/dataSourceComponents/dataSourceForm/group/index.less +1 -1
- package/es/components/dataSourceComponents/dataSourceForm/utils.js +5 -5
- package/es/components/dataSourceComponents/dataSourceTable/filter/index.js +1 -1
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.d.ts +1 -1
- package/es/components/saasLogin/img/leftImg.png +0 -0
- package/es/components/saasLogin/index.d.ts +83 -0
- package/es/components/saasLogin/index.js +369 -0
- package/es/components/saasLogin/index.less +249 -0
- package/es/components/table/Table/utils.d.ts +1 -1
- package/es/index.d.ts +1 -0
- package/es/index.js +2 -1
- package/lib/components/dataSourceComponents/dataSourceForm/group/index.less +1 -1
- package/lib/components/dataSourceComponents/dataSourceForm/utils.js +3 -3
- package/lib/components/dataSourceComponents/dataSourceTable/filter/index.js +1 -1
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.d.ts +1 -1
- package/lib/components/saasLogin/img/leftImg.png +0 -0
- package/lib/components/saasLogin/index.d.ts +83 -0
- package/lib/components/saasLogin/index.js +262 -0
- package/lib/components/saasLogin/index.less +249 -0
- package/lib/components/table/Table/utils.d.ts +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +3 -0
- package/lowcode/form-item-select/snippets.ts +3 -1
- package/lowcode/saas-login/meta.ts +541 -0
- package/lowcode/saas-login/snippets.ts +38 -0
- package/package.json +3 -3
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
// Saas登录组件样式
|
|
2
|
+
.saas-login-wrapper {
|
|
3
|
+
display: flex;
|
|
4
|
+
height: 100vh;
|
|
5
|
+
width: 100vw;
|
|
6
|
+
overflow: hidden;
|
|
7
|
+
|
|
8
|
+
// 左侧区域
|
|
9
|
+
.saas-login-bg {
|
|
10
|
+
flex: 1;
|
|
11
|
+
display: flex;
|
|
12
|
+
align-items: center;
|
|
13
|
+
justify-content: center;
|
|
14
|
+
background: linear-gradient(135deg, #2563EB 0%, #4F46E5 50%, #7C3AED 100%);
|
|
15
|
+
position: relative;
|
|
16
|
+
|
|
17
|
+
img {
|
|
18
|
+
width: auto;
|
|
19
|
+
height: 471px;
|
|
20
|
+
position: absolute;
|
|
21
|
+
top: 50%;
|
|
22
|
+
left: 50%;
|
|
23
|
+
transform: translate(-50%, -50%);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// 右侧区域
|
|
28
|
+
.saas-login-main {
|
|
29
|
+
width: 480px;
|
|
30
|
+
background: #fff;
|
|
31
|
+
display: flex;
|
|
32
|
+
align-items: center;
|
|
33
|
+
justify-content: center;
|
|
34
|
+
height: 100%;
|
|
35
|
+
overflow-y: auto;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.saas-login-container {
|
|
40
|
+
// width: 100%;
|
|
41
|
+
width: 360px;
|
|
42
|
+
overflow-x: hidden;
|
|
43
|
+
// margin: 0 auto;
|
|
44
|
+
// padding: 24px;
|
|
45
|
+
text-align: center;
|
|
46
|
+
// height: 100%;
|
|
47
|
+
// overflow-y: auto;
|
|
48
|
+
|
|
49
|
+
// Logo样式
|
|
50
|
+
.saas-login-logo {
|
|
51
|
+
height: 48px;
|
|
52
|
+
margin-bottom: 24px;
|
|
53
|
+
border-radius: 8px;
|
|
54
|
+
|
|
55
|
+
&.left {
|
|
56
|
+
margin-right: auto;
|
|
57
|
+
margin-left: 0;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
&.center {
|
|
61
|
+
margin: 0 auto;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
&.right {
|
|
65
|
+
margin-left: auto;
|
|
66
|
+
margin-right: 0;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
img {
|
|
70
|
+
height: 48px;
|
|
71
|
+
object-fit: contain;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.saas-login-title {
|
|
76
|
+
font-size: 24px;
|
|
77
|
+
font-weight: 600;
|
|
78
|
+
color: #101828;
|
|
79
|
+
margin-top: 0;
|
|
80
|
+
margin-bottom: 12px;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.saas-login-subtitle {
|
|
84
|
+
font-size: 14px;
|
|
85
|
+
color: #667085;
|
|
86
|
+
margin-top: 0;
|
|
87
|
+
margin-bottom: 32px;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.saas-login-tabs {
|
|
91
|
+
display: flex;
|
|
92
|
+
justify-content: center;
|
|
93
|
+
gap: 24px;
|
|
94
|
+
margin-bottom: 32px;
|
|
95
|
+
border-bottom: 1px solid #E4E7EC;
|
|
96
|
+
|
|
97
|
+
.tab {
|
|
98
|
+
padding: 12px 24px;
|
|
99
|
+
cursor: pointer;
|
|
100
|
+
color: #667085;
|
|
101
|
+
font-weight: 500;
|
|
102
|
+
position: relative;
|
|
103
|
+
|
|
104
|
+
&.active {
|
|
105
|
+
color: #7F56D9;
|
|
106
|
+
|
|
107
|
+
&:after {
|
|
108
|
+
content: '';
|
|
109
|
+
position: absolute;
|
|
110
|
+
bottom: -1px;
|
|
111
|
+
left: 0;
|
|
112
|
+
right: 0;
|
|
113
|
+
height: 2px;
|
|
114
|
+
background: #7F56D9;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
&:hover {
|
|
119
|
+
color: #6941C6;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// 表单区域样式
|
|
125
|
+
.saas-login-form {
|
|
126
|
+
// 表单项标题
|
|
127
|
+
.form-item-label {
|
|
128
|
+
font-size: 14px;
|
|
129
|
+
font-weight: 500;
|
|
130
|
+
color: #344054;
|
|
131
|
+
margin-bottom: 6px;
|
|
132
|
+
text-align: left;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// 输入框样式
|
|
136
|
+
.saas-login-input {
|
|
137
|
+
height: 44px;
|
|
138
|
+
border-radius: 8px;
|
|
139
|
+
border: 1px solid #D0D5DD;
|
|
140
|
+
background: #FFF;
|
|
141
|
+
|
|
142
|
+
&:hover {
|
|
143
|
+
border-color: #7F56D9;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
&:focus {
|
|
147
|
+
border-color: #7F56D9;
|
|
148
|
+
box-shadow: 0 0 0 4px rgba(127, 86, 217, 0.1);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
&.ant-input-password {
|
|
152
|
+
padding: 4px 11px;
|
|
153
|
+
|
|
154
|
+
.ant-input {
|
|
155
|
+
height: 34px;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// 登录按钮样式
|
|
161
|
+
.saas-login-button {
|
|
162
|
+
height: 44px;
|
|
163
|
+
border-radius: 8px;
|
|
164
|
+
background: #7F56D9;
|
|
165
|
+
border: none;
|
|
166
|
+
font-weight: 500;
|
|
167
|
+
|
|
168
|
+
&:hover {
|
|
169
|
+
background: #6941C6;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
&:focus {
|
|
173
|
+
background: #7F56D9;
|
|
174
|
+
box-shadow: 0 0 0 4px rgba(127, 86, 217, 0.1);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
// 社交登录按钮样式
|
|
179
|
+
.saas-login-social {
|
|
180
|
+
width: 100%;
|
|
181
|
+
|
|
182
|
+
.saas-login-social-button {
|
|
183
|
+
height: 44px;
|
|
184
|
+
border-radius: 8px;
|
|
185
|
+
|
|
186
|
+
&.google {
|
|
187
|
+
border-color: #D0D5DD;
|
|
188
|
+
|
|
189
|
+
&:hover {
|
|
190
|
+
background: #F9FAFB;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
&.facebook {
|
|
195
|
+
border-color: #D0D5DD;
|
|
196
|
+
|
|
197
|
+
&:hover {
|
|
198
|
+
background: #F9FAFB;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
&.apple {
|
|
203
|
+
border-color: #D0D5DD;
|
|
204
|
+
|
|
205
|
+
&:hover {
|
|
206
|
+
background: #F9FAFB;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
// 页脚样式
|
|
214
|
+
.saas-login-footer {
|
|
215
|
+
margin-top: 32px;
|
|
216
|
+
|
|
217
|
+
.saas-login-signup {
|
|
218
|
+
font-size: 14px;
|
|
219
|
+
color: #667085;
|
|
220
|
+
margin-bottom: 16px;
|
|
221
|
+
|
|
222
|
+
a {
|
|
223
|
+
color: #7F56D9;
|
|
224
|
+
margin-left: 4px;
|
|
225
|
+
cursor: pointer;
|
|
226
|
+
|
|
227
|
+
&:hover {
|
|
228
|
+
color: #6941C6;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
.saas-login-links {
|
|
234
|
+
display: flex;
|
|
235
|
+
justify-content: center;
|
|
236
|
+
gap: 24px;
|
|
237
|
+
|
|
238
|
+
a {
|
|
239
|
+
font-size: 14px;
|
|
240
|
+
color: #667085;
|
|
241
|
+
cursor: pointer;
|
|
242
|
+
|
|
243
|
+
&:hover {
|
|
244
|
+
color: #101828;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
@@ -167,7 +167,7 @@ export declare const getSettingKeyArrByMode: ({ filter, columnSetting, dataSourc
|
|
|
167
167
|
sort?: SortType | undefined;
|
|
168
168
|
mode: "" | "localStorage" | "remote";
|
|
169
169
|
currentViewMode: ModeType;
|
|
170
|
-
}) => ("
|
|
170
|
+
}) => ("view_mode" | "column_setting" | "order_by" | "group_by" | "gallery_setting" | "filter_setting")[];
|
|
171
171
|
export declare const omit: (obj: Record<string, any>, keys: string[]) => Record<string, any>;
|
|
172
172
|
export declare const stringify: (obj: Record<string, any>) => string;
|
|
173
173
|
export {};
|
package/es/index.d.ts
CHANGED
|
@@ -153,3 +153,4 @@ export { default as PisellHeaderProgressBar } from './components/pisellHeaderPro
|
|
|
153
153
|
export { default as PisellList01 } from './components/pisellList01';
|
|
154
154
|
export { default as PageHeader } from './components/page-header';
|
|
155
155
|
export { default as OrganizationTenantSwitcher } from './components/organizationTenantSwitcher';
|
|
156
|
+
export { default as SaasLogin } from './components/saasLogin';
|
package/es/index.js
CHANGED
|
@@ -182,4 +182,5 @@ export { default as PisellImageCarousels } from "./components/pisellImageCarouse
|
|
|
182
182
|
export { default as PisellHeaderProgressBar } from "./components/pisellHeaderProgressBar";
|
|
183
183
|
export { default as PisellList01 } from "./components/pisellList01";
|
|
184
184
|
export { default as PageHeader } from "./components/page-header";
|
|
185
|
-
export { default as OrganizationTenantSwitcher } from "./components/organizationTenantSwitcher";
|
|
185
|
+
export { default as OrganizationTenantSwitcher } from "./components/organizationTenantSwitcher";
|
|
186
|
+
export { default as SaasLogin } from "./components/saasLogin";
|
|
@@ -330,14 +330,14 @@ var withOptions = (WrappedComponent) => {
|
|
|
330
330
|
}
|
|
331
331
|
}, []);
|
|
332
332
|
const options = (0, import_react.useMemo)(() => {
|
|
333
|
-
var _a2, _b;
|
|
333
|
+
var _a2, _b, _c;
|
|
334
334
|
if (optionSourceType !== "api") {
|
|
335
335
|
return propsOptions;
|
|
336
336
|
}
|
|
337
|
-
return (((_b = (_a2 = list.data) == null ? void 0 : _a2.data) == null ? void 0 : _b.map((item) => ({
|
|
337
|
+
return (((_c = (_b = (_a2 = list.data) == null ? void 0 : _a2.data) == null ? void 0 : _b.filter) == null ? void 0 : _c.call(_b, (item) => !["draft", "inactive", "disabled"].includes(item == null ? void 0 : item.status))) || []).map((item) => ({
|
|
338
338
|
label: translationOriginal(item[labelField]),
|
|
339
339
|
value: item[valueField]
|
|
340
|
-
}))
|
|
340
|
+
})) || [];
|
|
341
341
|
}, [propsOptions, optionSourceType, (_a = list == null ? void 0 : list.data) == null ? void 0 : _a.data]);
|
|
342
342
|
return /* @__PURE__ */ import_react.default.createElement(WrappedComponent, { ...props, options });
|
|
343
343
|
};
|
|
@@ -167,7 +167,7 @@ var Filter = (props) => {
|
|
|
167
167
|
},
|
|
168
168
|
searchDom,
|
|
169
169
|
filterDom,
|
|
170
|
-
show && /* @__PURE__ */ import_react.default.createElement(
|
|
170
|
+
show && sortButtonShow && /* @__PURE__ */ import_react.default.createElement(
|
|
171
171
|
import_FilterButton.default,
|
|
172
172
|
{
|
|
173
173
|
value: list,
|
|
@@ -65,7 +65,7 @@ declare const useTableProps: (props: UseTablePropsProps) => {
|
|
|
65
65
|
useCustomAction: boolean;
|
|
66
66
|
actionType: string;
|
|
67
67
|
openMode: "modal" | "drawer";
|
|
68
|
-
openContentSize: "small" | "
|
|
68
|
+
openContentSize: "small" | "large" | "middle";
|
|
69
69
|
openTitle: string;
|
|
70
70
|
key: string;
|
|
71
71
|
} | undefined;
|
|
Binary file
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './index.less';
|
|
3
|
+
import { I18nData } from '@/types';
|
|
4
|
+
/**
|
|
5
|
+
* SaasLogin组件的属性接口
|
|
6
|
+
*/
|
|
7
|
+
export interface SaasLoginProps {
|
|
8
|
+
/** Logo相关配置 */
|
|
9
|
+
showLogo?: boolean;
|
|
10
|
+
logo?: string;
|
|
11
|
+
logoPosition?: 'left' | 'center' | 'right';
|
|
12
|
+
logoSize?: {
|
|
13
|
+
width?: number;
|
|
14
|
+
height?: number;
|
|
15
|
+
};
|
|
16
|
+
/** 标题相关配置 */
|
|
17
|
+
title?: string | I18nData;
|
|
18
|
+
showTitle?: boolean;
|
|
19
|
+
titleAlign?: 'left' | 'center' | 'right';
|
|
20
|
+
/** 副标题相关配置 */
|
|
21
|
+
subtitle?: string | I18nData;
|
|
22
|
+
showSubtitle?: boolean;
|
|
23
|
+
subtitleAlign?: 'left' | 'center' | 'right';
|
|
24
|
+
/** 登录方式配置 */
|
|
25
|
+
loginMethods?: ('email' | 'google' | 'facebook' | 'apple')[];
|
|
26
|
+
defaultLoginMethod?: 'email' | 'google' | 'facebook' | 'apple';
|
|
27
|
+
/** 表单配置 */
|
|
28
|
+
emailLabel?: string | I18nData;
|
|
29
|
+
passwordLabel?: string | I18nData;
|
|
30
|
+
emailPlaceholder?: string | I18nData;
|
|
31
|
+
passwordPlaceholder?: string | I18nData;
|
|
32
|
+
emailRules?: any[];
|
|
33
|
+
buttonText?: string | I18nData;
|
|
34
|
+
rememberMeText?: string | I18nData;
|
|
35
|
+
forgotPasswordText?: string | I18nData;
|
|
36
|
+
showRememberMe?: boolean;
|
|
37
|
+
showForgotPassword?: boolean;
|
|
38
|
+
/** 社交登录配置 */
|
|
39
|
+
socialLoginTexts?: {
|
|
40
|
+
google?: string | I18nData;
|
|
41
|
+
facebook?: string | I18nData;
|
|
42
|
+
apple?: string | I18nData;
|
|
43
|
+
};
|
|
44
|
+
/** 底部配置 */
|
|
45
|
+
showFooter?: boolean;
|
|
46
|
+
showSignUp?: boolean;
|
|
47
|
+
signUpText?: string | I18nData;
|
|
48
|
+
signUpLink?: string;
|
|
49
|
+
signUpPosition?: 'left' | 'center' | 'right';
|
|
50
|
+
otherLinks?: Array<{
|
|
51
|
+
text: string | I18nData;
|
|
52
|
+
url: string;
|
|
53
|
+
}>;
|
|
54
|
+
otherLinksPosition?: 'left' | 'center' | 'right';
|
|
55
|
+
/** 登录/注册切换配置 */
|
|
56
|
+
showTabs?: boolean;
|
|
57
|
+
loginTabText?: string | I18nData;
|
|
58
|
+
registerTabText?: string | I18nData;
|
|
59
|
+
/** 注册表单配置 */
|
|
60
|
+
registerEmailPlaceholder?: string | I18nData;
|
|
61
|
+
registerPasswordPlaceholder?: string | I18nData;
|
|
62
|
+
registerButtonText?: string | I18nData;
|
|
63
|
+
/** 事件回调 */
|
|
64
|
+
onLogin?: (values: {
|
|
65
|
+
email: string;
|
|
66
|
+
loginMethod: string;
|
|
67
|
+
}) => void;
|
|
68
|
+
onSocialLogin?: (type: 'google' | 'facebook' | 'apple') => void;
|
|
69
|
+
onSignUp?: () => void;
|
|
70
|
+
onRegister?: (values: {
|
|
71
|
+
email: string;
|
|
72
|
+
password: string;
|
|
73
|
+
}) => void;
|
|
74
|
+
/** 新增背景图片属性 */
|
|
75
|
+
backgroundImage?: string;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Saas登录组件
|
|
79
|
+
* @param props - 组件属性
|
|
80
|
+
* @returns React组件
|
|
81
|
+
*/
|
|
82
|
+
declare const SaasLogin: React.FC<SaasLoginProps>;
|
|
83
|
+
export default SaasLogin;
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/components/saasLogin/index.tsx
|
|
30
|
+
var saasLogin_exports = {};
|
|
31
|
+
__export(saasLogin_exports, {
|
|
32
|
+
default: () => saasLogin_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(saasLogin_exports);
|
|
35
|
+
var import_react = __toESM(require("react"));
|
|
36
|
+
var import_antd = require("antd");
|
|
37
|
+
var import_icons = require("@ant-design/icons");
|
|
38
|
+
var import_index = require("./index.less");
|
|
39
|
+
var import_leftImg = __toESM(require("./img/leftImg.png"));
|
|
40
|
+
var SaasLogin = ({
|
|
41
|
+
showLogo = true,
|
|
42
|
+
logo,
|
|
43
|
+
logoPosition = "center",
|
|
44
|
+
logoSize = { width: 48, height: 48 },
|
|
45
|
+
title = "Log in to your account",
|
|
46
|
+
showTitle = false,
|
|
47
|
+
titleAlign = "center",
|
|
48
|
+
subtitle = "Welcome back! Please enter your details.",
|
|
49
|
+
showSubtitle = false,
|
|
50
|
+
subtitleAlign = "center",
|
|
51
|
+
loginMethods = ["email", "google", "facebook", "apple"],
|
|
52
|
+
defaultLoginMethod = "email",
|
|
53
|
+
emailLabel = "Email",
|
|
54
|
+
passwordLabel = "Password",
|
|
55
|
+
emailPlaceholder = "Enter your email",
|
|
56
|
+
passwordPlaceholder = "Enter your password",
|
|
57
|
+
emailRules = [
|
|
58
|
+
{ required: true, message: "Please input your email!" },
|
|
59
|
+
{ type: "email", message: "Please enter a valid email!" }
|
|
60
|
+
],
|
|
61
|
+
buttonText = "Sign in",
|
|
62
|
+
socialLoginTexts = {
|
|
63
|
+
google: "Continue with Google",
|
|
64
|
+
facebook: "Continue with Facebook",
|
|
65
|
+
apple: "Continue with Apple"
|
|
66
|
+
},
|
|
67
|
+
showFooter = true,
|
|
68
|
+
showSignUp = true,
|
|
69
|
+
signUpText = "Don't have an account? Sign up",
|
|
70
|
+
signUpLink = "",
|
|
71
|
+
signUpPosition = "center",
|
|
72
|
+
otherLinks = [],
|
|
73
|
+
otherLinksPosition = "center",
|
|
74
|
+
showTabs = true,
|
|
75
|
+
loginTabText = "Login",
|
|
76
|
+
registerTabText = "Register",
|
|
77
|
+
registerEmailPlaceholder = "Enter your email",
|
|
78
|
+
registerPasswordPlaceholder = "Create a password",
|
|
79
|
+
registerButtonText = "Create account",
|
|
80
|
+
rememberMeText = "Remember me",
|
|
81
|
+
forgotPasswordText = "Forgot password?",
|
|
82
|
+
showRememberMe = false,
|
|
83
|
+
showForgotPassword = false,
|
|
84
|
+
onLogin,
|
|
85
|
+
onSocialLogin,
|
|
86
|
+
onSignUp,
|
|
87
|
+
onRegister,
|
|
88
|
+
backgroundImage = "/login-illustration.png"
|
|
89
|
+
}) => {
|
|
90
|
+
const [form] = import_antd.Form.useForm();
|
|
91
|
+
const [loading, setLoading] = (0, import_react.useState)(false);
|
|
92
|
+
const [activeTab, setActiveTab] = (0, import_react.useState)("login");
|
|
93
|
+
(0, import_react.useEffect)(() => {
|
|
94
|
+
document.body.id = "body";
|
|
95
|
+
}, []);
|
|
96
|
+
const handleEmailLogin = async () => {
|
|
97
|
+
try {
|
|
98
|
+
setLoading(true);
|
|
99
|
+
const values = await form.validateFields();
|
|
100
|
+
onLogin == null ? void 0 : onLogin({ ...values, loginMethod: "email" });
|
|
101
|
+
} catch (error) {
|
|
102
|
+
console.error("Validation failed:", error);
|
|
103
|
+
} finally {
|
|
104
|
+
setLoading(false);
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
const handleSocialLogin = (type) => {
|
|
108
|
+
onSocialLogin == null ? void 0 : onSocialLogin(type);
|
|
109
|
+
};
|
|
110
|
+
const handleRegister = async () => {
|
|
111
|
+
try {
|
|
112
|
+
setLoading(true);
|
|
113
|
+
const values = await form.validateFields();
|
|
114
|
+
onRegister == null ? void 0 : onRegister(values);
|
|
115
|
+
} catch (error) {
|
|
116
|
+
console.error("Validation failed:", error);
|
|
117
|
+
} finally {
|
|
118
|
+
setLoading(false);
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
return /* @__PURE__ */ import_react.default.createElement("div", { className: "saas-login-wrapper" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "saas-login-bg" }, /* @__PURE__ */ import_react.default.createElement("img", { src: import_leftImg.default, alt: "login" })), /* @__PURE__ */ import_react.default.createElement("div", { className: "saas-login-main" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "saas-login-container" }, showLogo && /* @__PURE__ */ import_react.default.createElement(
|
|
122
|
+
"div",
|
|
123
|
+
{
|
|
124
|
+
className: `saas-login-logo ${logoPosition}`
|
|
125
|
+
},
|
|
126
|
+
logo && /* @__PURE__ */ import_react.default.createElement("img", { src: logo, alt: "logo" })
|
|
127
|
+
), showTitle && /* @__PURE__ */ import_react.default.createElement("h1", { className: "saas-login-title", style: { textAlign: titleAlign } }, title), showSubtitle && /* @__PURE__ */ import_react.default.createElement("p", { className: "saas-login-subtitle", style: { textAlign: subtitleAlign } }, subtitle), showTabs && /* @__PURE__ */ import_react.default.createElement("div", { className: "saas-login-tabs" }, /* @__PURE__ */ import_react.default.createElement(
|
|
128
|
+
"div",
|
|
129
|
+
{
|
|
130
|
+
className: `tab ${activeTab === "login" ? "active" : ""}`,
|
|
131
|
+
onClick: () => setActiveTab("login")
|
|
132
|
+
},
|
|
133
|
+
loginTabText
|
|
134
|
+
), /* @__PURE__ */ import_react.default.createElement(
|
|
135
|
+
"div",
|
|
136
|
+
{
|
|
137
|
+
className: `tab ${activeTab === "register" ? "active" : ""}`,
|
|
138
|
+
onClick: () => setActiveTab("register")
|
|
139
|
+
},
|
|
140
|
+
registerTabText
|
|
141
|
+
)), /* @__PURE__ */ import_react.default.createElement("div", { className: "saas-login-form" }, activeTab === "login" ? /* @__PURE__ */ import_react.default.createElement(import_antd.Form, { form }, /* @__PURE__ */ import_react.default.createElement("div", { className: "form-item-label" }, emailLabel), /* @__PURE__ */ import_react.default.createElement(
|
|
142
|
+
import_antd.Form.Item,
|
|
143
|
+
{
|
|
144
|
+
name: "email",
|
|
145
|
+
rules: emailRules
|
|
146
|
+
},
|
|
147
|
+
/* @__PURE__ */ import_react.default.createElement(
|
|
148
|
+
import_antd.Input,
|
|
149
|
+
{
|
|
150
|
+
placeholder: emailPlaceholder,
|
|
151
|
+
size: "large",
|
|
152
|
+
className: "saas-login-input"
|
|
153
|
+
}
|
|
154
|
+
)
|
|
155
|
+
), /* @__PURE__ */ import_react.default.createElement("div", { className: "form-item-label" }, passwordLabel), /* @__PURE__ */ import_react.default.createElement(
|
|
156
|
+
import_antd.Form.Item,
|
|
157
|
+
{
|
|
158
|
+
name: "password",
|
|
159
|
+
rules: [
|
|
160
|
+
{ required: true, message: "Please input your password!" }
|
|
161
|
+
]
|
|
162
|
+
},
|
|
163
|
+
/* @__PURE__ */ import_react.default.createElement(
|
|
164
|
+
import_antd.Input.Password,
|
|
165
|
+
{
|
|
166
|
+
placeholder: passwordPlaceholder,
|
|
167
|
+
size: "large",
|
|
168
|
+
className: "saas-login-input"
|
|
169
|
+
}
|
|
170
|
+
)
|
|
171
|
+
), (showRememberMe || showForgotPassword) && /* @__PURE__ */ import_react.default.createElement("div", { className: "saas-login-options" }, showRememberMe && /* @__PURE__ */ import_react.default.createElement(import_antd.Checkbox, null, rememberMeText), showForgotPassword && /* @__PURE__ */ import_react.default.createElement("a", { className: "forgot-password" }, forgotPasswordText)), /* @__PURE__ */ import_react.default.createElement(
|
|
172
|
+
import_antd.Button,
|
|
173
|
+
{
|
|
174
|
+
type: "primary",
|
|
175
|
+
block: true,
|
|
176
|
+
size: "large",
|
|
177
|
+
loading,
|
|
178
|
+
onClick: handleEmailLogin,
|
|
179
|
+
className: "saas-login-button"
|
|
180
|
+
},
|
|
181
|
+
buttonText
|
|
182
|
+
)) : /* @__PURE__ */ import_react.default.createElement(import_antd.Form, { form }, /* @__PURE__ */ import_react.default.createElement(
|
|
183
|
+
import_antd.Form.Item,
|
|
184
|
+
{
|
|
185
|
+
name: "email",
|
|
186
|
+
rules: emailRules
|
|
187
|
+
},
|
|
188
|
+
/* @__PURE__ */ import_react.default.createElement(
|
|
189
|
+
import_antd.Input,
|
|
190
|
+
{
|
|
191
|
+
placeholder: registerEmailPlaceholder,
|
|
192
|
+
size: "large",
|
|
193
|
+
className: "saas-login-input"
|
|
194
|
+
}
|
|
195
|
+
)
|
|
196
|
+
), /* @__PURE__ */ import_react.default.createElement(
|
|
197
|
+
import_antd.Form.Item,
|
|
198
|
+
{
|
|
199
|
+
name: "password",
|
|
200
|
+
rules: [
|
|
201
|
+
{ required: true, message: "Please input your password!" },
|
|
202
|
+
{ min: 6, message: "Password must be at least 6 characters!" }
|
|
203
|
+
]
|
|
204
|
+
},
|
|
205
|
+
/* @__PURE__ */ import_react.default.createElement(
|
|
206
|
+
import_antd.Input.Password,
|
|
207
|
+
{
|
|
208
|
+
placeholder: registerPasswordPlaceholder,
|
|
209
|
+
size: "large",
|
|
210
|
+
className: "saas-login-input"
|
|
211
|
+
}
|
|
212
|
+
)
|
|
213
|
+
), /* @__PURE__ */ import_react.default.createElement(
|
|
214
|
+
import_antd.Button,
|
|
215
|
+
{
|
|
216
|
+
type: "primary",
|
|
217
|
+
block: true,
|
|
218
|
+
size: "large",
|
|
219
|
+
loading,
|
|
220
|
+
onClick: handleRegister,
|
|
221
|
+
className: "saas-login-button"
|
|
222
|
+
},
|
|
223
|
+
registerButtonText
|
|
224
|
+
)), /* @__PURE__ */ import_react.default.createElement(import_antd.Space, { direction: "vertical", className: "saas-login-social" }, loginMethods.includes("google") && /* @__PURE__ */ import_react.default.createElement(
|
|
225
|
+
import_antd.Button,
|
|
226
|
+
{
|
|
227
|
+
block: true,
|
|
228
|
+
icon: /* @__PURE__ */ import_react.default.createElement(import_icons.GoogleOutlined, null),
|
|
229
|
+
className: "saas-login-social-button google",
|
|
230
|
+
onClick: () => handleSocialLogin("google")
|
|
231
|
+
},
|
|
232
|
+
socialLoginTexts.google
|
|
233
|
+
), loginMethods.includes("facebook") && /* @__PURE__ */ import_react.default.createElement(
|
|
234
|
+
import_antd.Button,
|
|
235
|
+
{
|
|
236
|
+
block: true,
|
|
237
|
+
icon: /* @__PURE__ */ import_react.default.createElement(import_icons.FacebookOutlined, null),
|
|
238
|
+
className: "saas-login-social-button facebook",
|
|
239
|
+
onClick: () => handleSocialLogin("facebook")
|
|
240
|
+
},
|
|
241
|
+
socialLoginTexts.facebook
|
|
242
|
+
), loginMethods.includes("apple") && /* @__PURE__ */ import_react.default.createElement(
|
|
243
|
+
import_antd.Button,
|
|
244
|
+
{
|
|
245
|
+
block: true,
|
|
246
|
+
icon: /* @__PURE__ */ import_react.default.createElement(import_icons.AppleOutlined, null),
|
|
247
|
+
className: "saas-login-social-button apple",
|
|
248
|
+
onClick: () => handleSocialLogin("apple")
|
|
249
|
+
},
|
|
250
|
+
socialLoginTexts.apple
|
|
251
|
+
))), showFooter && /* @__PURE__ */ import_react.default.createElement("div", { className: "saas-login-footer" }, showSignUp && /* @__PURE__ */ import_react.default.createElement("p", { className: "saas-login-signup" }, signUpText, signUpLink ? /* @__PURE__ */ import_react.default.createElement("a", { href: signUpLink }, "Sign up") : /* @__PURE__ */ import_react.default.createElement("a", { onClick: onSignUp }, "Sign up")), otherLinks.length > 0 && /* @__PURE__ */ import_react.default.createElement("div", { className: "saas-login-links" }, otherLinks.map((link, index) => /* @__PURE__ */ import_react.default.createElement(
|
|
252
|
+
"a",
|
|
253
|
+
{
|
|
254
|
+
key: index,
|
|
255
|
+
href: link.url,
|
|
256
|
+
target: "_blank",
|
|
257
|
+
rel: "noopener noreferrer"
|
|
258
|
+
},
|
|
259
|
+
link.text
|
|
260
|
+
)))))));
|
|
261
|
+
};
|
|
262
|
+
var saasLogin_default = SaasLogin;
|