form-craft-package 1.7.7 → 1.7.9-dev.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "form-craft-package",
3
- "version": "1.7.7",
3
+ "version": "1.7.9-dev.0",
4
4
  "main": "index.ts",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",
@@ -1,44 +1,75 @@
1
- import { Row, Col, Form, Button, Space, Input } from 'antd'
1
+ import { Button, Col, Form, Input, Row, Spin } from 'antd'
2
2
  import { useNavigate } from 'react-router-dom'
3
3
  import { useLoginHandler } from '../../common/custom-hooks/use-login-handler'
4
+ import { useConfigContext } from '../context'
4
5
 
5
6
  export const ForgotPassword = () => {
7
+ const { config } = useConfigContext()
6
8
  const navigate = useNavigate()
7
9
  const { handleForgotPassword } = useLoginHandler()
10
+
11
+ const formPadding = config?.loginLayout?.form?.padding
12
+ const titleColor = config?.loginLayout.form.color
13
+ const background = config?.loginLayout?.background
14
+ const logoUrl = config?.siteIdentity?.logoUrl
15
+ const primaryColor = config?.siteLayout?.siteConfigs?.colors?.primary
16
+
8
17
  return (
9
- <Row gutter={[60, 0]} justify="center" className="w-full">
10
- <Col xs={24} md={24} lg={10} xl={12} xxl={10} className="flex self-center">
11
- <Space size={15} direction="vertical" className="bg-white shadow py-10 px-8 w-full rounded">
12
- <div className="text-36 text-primary text-center">Forgot Password?</div>
13
- <div className="text-info text-18 text-center mx-auto" style={{ maxWidth: 300 }}>
14
- Please enter your account username to reset your password!
18
+ <Spin spinning={false}>
19
+ <div className="h-screen w-full flex items-center justify-center overflow-hidden" style={{ background }}>
20
+ <div
21
+ className="overflow-auto text-center shadow"
22
+ style={{
23
+ padding: formPadding,
24
+ background: '#fff',
25
+ width: 400,
26
+ maxWidth: '100%',
27
+ }}
28
+ >
29
+ {logoUrl && (
30
+ <div className="flex justify-center mb-4">
31
+ <img src={logoUrl} alt="Logo" className="h-10 object-contain" />
32
+ </div>
33
+ )}
34
+
35
+ <div className="font-bold mb-2" style={{ color: titleColor }}>
36
+ Forgot Password?
15
37
  </div>
16
- <Form
17
- name="forgot_password"
18
- id="forgot_password"
19
- initialValues={{ remember: false }}
20
- layout="vertical"
21
- onFinish={({ email }) => handleForgotPassword(email)}
22
- >
38
+
39
+ <div className="text-sm text-center mb-4 mx-auto">
40
+ Please enter your account email to reset your password!
41
+ </div>
42
+
43
+ <Form layout="vertical" onFinish={({ email }) => handleForgotPassword(email)}>
23
44
  <Row gutter={[0, 10]}>
24
- <Form.Item
25
- label={'Email'}
26
- name={'email'}
27
- rules={[{ required: true, message: `Please enter your email` }]}
28
- >
29
- <Input />
30
- </Form.Item>
45
+ <Col span={24}>
46
+ <Form.Item label="Email" name="email" rules={[{ required: true, message: 'Please enter your email' }]}>
47
+ <Input />
48
+ </Form.Item>
49
+ </Col>
31
50
  </Row>
51
+
52
+ <div className="flex justify-center mt-5">
53
+ <Button
54
+ htmlType="submit"
55
+ className="w-full"
56
+ style={{
57
+ color: '#fff',
58
+ backgroundColor: primaryColor,
59
+ }}
60
+ >
61
+ Submit Request
62
+ </Button>
63
+ </div>
32
64
  </Form>
33
- <Button className="btn-success w-full" htmlType="submit" form="forgot_password">
34
- Submit Request
35
- </Button>
36
- <Button className="btn-primary2 w-full" onClick={() => navigate('/login')}>
37
- Back to Login
38
- </Button>
39
- </Space>
40
- </Col>
41
- <Col xxl={1}></Col>
42
- </Row>
65
+
66
+ <div className="flex justify-center mt-4">
67
+ <Button type="link" onClick={() => navigate('/login')}>
68
+ Back to Login
69
+ </Button>
70
+ </div>
71
+ </div>
72
+ </div>
73
+ </Spin>
43
74
  )
44
75
  }
@@ -6,6 +6,7 @@ import { useNavigate } from 'react-router-dom'
6
6
 
7
7
  export function UnauthenticatedLayout() {
8
8
  const { config } = useConfigContext()
9
+ console.log(config?.siteLanguages)
9
10
  const navigate = useNavigate()
10
11
  const loginLayout = config?.loginLayout
11
12
  const siteIdentity = config?.siteIdentity
@@ -17,7 +17,7 @@ export const LayoutRowConditionalHeaderRenderer = ({
17
17
  <Collapse
18
18
  className="fc-collapsible-row bg-transparent"
19
19
  bordered={false}
20
- defaultActiveKey={['1']}
20
+ defaultActiveKey={[]}
21
21
  items={[
22
22
  {
23
23
  key: '1',
@@ -77,7 +77,7 @@ export const layoutTemplates = [
77
77
  <div key={form.id} className="">
78
78
  <Link
79
79
  to={href}
80
- target={form.customLink || form.newTab ? '_blank' : '_self'}
80
+ target={form.newTab ? '_blank' : '_self'}
81
81
  onClick={isParentMenu ? () => toggleMenu(form.id) : undefined}
82
82
  style={{
83
83
  width: `${navigationWidth - 25}px`,
@@ -127,15 +127,16 @@ export const layoutTemplates = [
127
127
  const menu = (
128
128
  <Menu className="text-primary">
129
129
  {menuItems?.map(({ name, icon: Icon, onClick }) => (
130
- <Menu.Item key={name}>
131
- <Button type="link" onClick={onClick} className="flex items-center gap-2 px-3 py-1 leading-6 text-md">
130
+ <Menu.Item key={name} onClick={onClick}>
131
+ <div className="flex items-center gap-2 px-3 py-1 text-md">
132
132
  <Icon />
133
133
  {name}
134
- </Button>
134
+ </div>
135
135
  </Menu.Item>
136
136
  ))}
137
137
  </Menu>
138
138
  )
139
+
139
140
  return (
140
141
  <Layout className="h-screen overflow-y-auto fc-layout">
141
142
  <Header className="sticky top-0 z-40 flex items-center shadow-sm justify-between px-1 overflow-hidden fc-header">
@@ -190,7 +191,7 @@ export const layoutTemplates = [
190
191
  <Button type="link" className="">
191
192
  <span className="ml-4 text-primary text-md font-semibold">
192
193
  <div className="hidden">{userName}</div>
193
- <span className="italic text-warning font-normal">User info coming soon...</span>
194
+ <span className="italic text-warning font-normal">Admin</span>
194
195
  </span>
195
196
  <FaCaretDown className="text-primary ml-1" />
196
197
  </Button>
@@ -281,7 +282,7 @@ export const layoutTemplates = [
281
282
  <div key={form.id} className="relative group">
282
283
  <Link
283
284
  to={href}
284
- target={form.customLink || form.newTab ? '_blank' : '_self'}
285
+ target={form.newTab ? '_blank' : '_self'}
285
286
  onClick={isParentMenu ? (e) => e.preventDefault() : undefined}
286
287
  style={{
287
288
  borderRadius: `${siteConfigs?.Link.borderRadius}px`,
@@ -330,15 +331,16 @@ export const layoutTemplates = [
330
331
  const menu = (
331
332
  <Menu className="text-primary">
332
333
  {menuItems?.map(({ name, icon: Icon, onClick }) => (
333
- <Menu.Item key={name}>
334
- <Button type="link" onClick={onClick} className="flex items-center gap-2 px-3 py-1 leading-6 text-md">
334
+ <Menu.Item key={name} onClick={onClick}>
335
+ <div className="flex items-center gap-2 px-3 py-1 text-md">
335
336
  <Icon />
336
337
  {name}
337
- </Button>
338
+ </div>
338
339
  </Menu.Item>
339
340
  ))}
340
341
  </Menu>
341
342
  )
343
+
342
344
  return (
343
345
  <Layout className="fc-layout">
344
346
  <Header className="fc-header sticky top-0 z-40 flex items-center shadow-sm justify-between px-1 overflow-hidden">
@@ -403,7 +405,7 @@ export const layoutTemplates = [
403
405
  <Button type="link" className="">
404
406
  <span className="ml-4 text-primary text-md font-semibold">
405
407
  <div className="hidden">{userName}</div>
406
- <span className="italic text-warning font-normal">User info coming soon...</span>
408
+ <span className="italic text-warning font-normal">Admin</span>
407
409
  </span>
408
410
  <FaCaretDown className="text-primary ml-1" />
409
411
  </Button>
@@ -484,7 +486,7 @@ export const layoutTemplates = [
484
486
  <div key={form.id} className="menu-item">
485
487
  <Link
486
488
  to={href}
487
- target={form.customLink || form.newTab ? '_blank' : '_self'}
489
+ target={form.newTab ? '_blank' : '_self'}
488
490
  onClick={isParentMenu ? () => toggleMenu(form.id) : undefined}
489
491
  style={{
490
492
  width: `${navigationWidth - 25}px`,
@@ -535,11 +537,11 @@ export const layoutTemplates = [
535
537
  const menu = (
536
538
  <Menu className="text-primary">
537
539
  {menuItems?.map(({ name, icon: Icon, onClick }) => (
538
- <Menu.Item key={name}>
539
- <Button type="link" onClick={onClick} className="flex items-center gap-2 px-3 py-1 leading-6">
540
+ <Menu.Item key={name} onClick={onClick}>
541
+ <div className="flex items-center gap-2 px-3 py-1 text-md">
540
542
  <Icon />
541
543
  {name}
542
- </Button>
544
+ </div>
543
545
  </Menu.Item>
544
546
  ))}
545
547
  </Menu>
@@ -588,7 +590,7 @@ export const layoutTemplates = [
588
590
  ) : (
589
591
  <span className="text-primary font-semibold text-md">
590
592
  <div className="hidden">{userName}</div>
591
- <span className="italic text-warning font-normal">User info coming soon...</span>
593
+ <span className="italic text-warning font-normal">Admin</span>
592
594
  </span>
593
595
  )}
594
596
  <FaCaretDown className="text-primary ml-1" />
@@ -654,7 +656,7 @@ export const layoutTemplates = [
654
656
  ) : (
655
657
  <span className="text-primary font-semibold text-md">
656
658
  <div className="hidden">{userName}</div>
657
- <span className="italic text-warning font-normal">User info coming soon...</span>
659
+ <span className="italic text-warning font-normal">Admin</span>
658
660
  </span>
659
661
  )}
660
662
  <FaCaretDown className="text-primary ml-1" />