@sqrzro/auth 4.0.0-alpha.10 → 4.0.0-alpha.11

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.
@@ -8,6 +8,6 @@ function LoginForm({ classNames }) {
8
8
  const { fieldProps, formData, formProps } = useForm({
9
9
  onSubmit: submit,
10
10
  });
11
- return (_jsxs(Fragment, { children: [_jsx("h1", { className: classNames?.title, children: "Sign in to continue" }), _jsxs(Form, { classNames: { root: classNames?.form }, ...formProps, children: [_jsx(TextFormField, { ...fieldProps('email'), hasAssistiveError: true }), _jsx(PasswordFormField, { ...fieldProps('password'), hasAssistiveError: true }), _jsx("div", { className: classNames?.actions, children: _jsx(FormSubmit, { isFullWidth: true, children: "Sign In" }) }), _jsx("footer", { className: classNames?.footer, children: _jsx(Link, { className: classNames?.link, href: `/auth/password${formData.email ? `?email=${formData.email}` : ''}`, children: "Forgot Password?" }) })] })] }));
11
+ return (_jsxs(Fragment, { children: [_jsx("h1", { className: classNames?.title, children: "Sign in to continue" }), _jsxs(Form, { classNames: { root: classNames?.form }, ...formProps, children: [_jsx("div", { className: classNames?.field, children: _jsx(TextFormField, { ...fieldProps('email'), hasAssistiveError: true }) }), _jsx("div", { className: classNames?.field, children: _jsx(PasswordFormField, { ...fieldProps('password'), hasAssistiveError: true }) }), _jsx("div", { className: classNames?.actions, children: _jsx(FormSubmit, { isFullWidth: true, children: "Sign In" }) }), _jsx("footer", { className: classNames?.footer, children: _jsx(Link, { className: classNames?.link, href: `/auth/password${formData.email ? `?email=${formData.email}` : ''}`, children: "Forgot Password?" }) })] })] }));
12
12
  }
13
13
  export default LoginForm;
@@ -22,6 +22,6 @@ function PasswordForm({ classNames, defaults }) {
22
22
  setFormData('email', '');
23
23
  setSentCount(0);
24
24
  }
25
- return (_jsxs(Fragment, { children: [_jsx("div", { style: { display: sentCount === 0 ? 'block' : 'none' }, children: _jsxs(Form, { ...formProps, children: [_jsx("h1", { className: classNames?.title, children: "Reset Your Password" }), _jsx("p", { className: "text-sm", children: "Enter the email address associated with your account and we'll send you a link to reset your password." }), _jsx(TextFormField, { ...fieldProps('email'), hasAssistiveError: true }), _jsx("div", { className: classNames?.actions, children: _jsx(FormSubmit, { isFullWidth: true, children: "Send Email" }) }), _jsx("footer", { className: classNames?.footer, children: _jsx(Link, { className: classNames?.link, href: "/auth/login", children: "Back" }) })] }) }), _jsx("div", { style: { display: sentCount === 0 ? 'none' : 'block' }, children: _jsxs("div", { className: classNames?.form, children: [_jsx("h1", { className: classNames?.title, children: "Check Your Email" }), sentCount === 1 ? (_jsxs(Fragment, { children: [_jsxs("p", { className: "text-sm", children: ["If ", _jsx("strong", { children: formData.email }), " matches an email we have on file, then we've sent you an email containing further instructions for resetting your password."] }), _jsxs("p", { className: "text-sm", children: ["If you haven't received an email in 5 minutes, check your spam,", ' ', _jsx(Link, { className: classNames?.link, onClick: handleResend, children: "resend" }), ", or", ' ', _jsx(Link, { className: classNames?.link, onClick: handleReset, children: "try a different email address" }), "."] })] })) : (_jsxs(Fragment, { children: [_jsxs("p", { className: "text-sm", children: ["We've resent password reset instructions to", ' ', _jsx("strong", { children: formData.email }), ", if it is an email we have on file."] }), _jsxs("p", { className: "text-sm", children: ["Please check again. If you still haven't received an email,", ' ', _jsx(Link, { className: classNames?.link, onClick: handleReset, children: "try a different email address" }), "."] })] }))] }) })] }));
25
+ return (_jsxs(Fragment, { children: [_jsx("div", { style: { display: sentCount === 0 ? 'block' : 'none' }, children: _jsxs(Form, { classNames: { root: classNames?.form }, ...formProps, children: [_jsx("h1", { className: classNames?.title, children: "Reset Your Password" }), _jsx("div", { className: classNames?.content, children: _jsx("p", { children: "Enter the email address associated with your account and we'll send you a link to reset your password." }) }), _jsx("div", { className: classNames?.field, children: _jsx(TextFormField, { ...fieldProps('email'), hasAssistiveError: true }) }), _jsx("div", { className: classNames?.actions, children: _jsx(FormSubmit, { isFullWidth: true, children: "Send Email" }) }), _jsx("footer", { className: classNames?.footer, children: _jsx(Link, { className: classNames?.link, href: "/auth/login", children: "Back" }) })] }) }), _jsx("div", { style: { display: sentCount === 0 ? 'none' : 'block' }, children: _jsxs("div", { className: classNames?.form, children: [_jsx("h1", { className: classNames?.title, children: "Check Your Email" }), sentCount === 1 ? (_jsxs("div", { className: classNames?.content, children: [_jsxs("p", { children: ["If ", _jsx("strong", { children: formData.email }), " matches an email we have on file, then we've sent you an email containing further instructions for resetting your password."] }), _jsxs("p", { children: ["If you haven't received an email in 5 minutes, check your spam,", ' ', _jsx(Link, { className: classNames?.link, onClick: handleResend, children: "resend" }), ", or", ' ', _jsx(Link, { className: classNames?.link, onClick: handleReset, children: "try a different email address" }), "."] })] })) : (_jsxs("div", { className: classNames?.content, children: [_jsxs("p", { children: ["We've resent password reset instructions to", ' ', _jsx("strong", { children: formData.email }), ", if it is an email we have on file."] }), _jsxs("p", { children: ["Please check again. If you still haven't received an email,", ' ', _jsx(Link, { className: classNames?.link, onClick: handleReset, children: "try a different email address" }), "."] })] }))] }) })] }));
26
26
  }
27
27
  export default PasswordForm;
@@ -1,6 +1,6 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { Fragment, useState } from 'react';
3
+ import { useState } from 'react';
4
4
  import { Form, FormSubmit, useForm } from '@sqrzro/ui/forms';
5
5
  import PasswordComplexityFormField from '../../components/PasswordComplexityFormField';
6
6
  import submit from './server';
@@ -10,6 +10,6 @@ function PasswordResetForm({ classNames, token, }) {
10
10
  defaults: { token },
11
11
  onSubmit: submit,
12
12
  });
13
- return (_jsx(Fragment, { children: _jsxs(Form, { ...formProps, children: [_jsx(PasswordComplexityFormField, { ...fieldProps('password'), onComplexity: (isValid) => setIsDisabled(!isValid) }), _jsx(FormSubmit, { isDisabled: isDisabled, children: "Reset Password" })] }) }));
13
+ return (_jsxs(Form, { classNames: { root: classNames?.form }, ...formProps, children: [_jsx("h1", { className: classNames?.title, children: "Reset Your Password" }), _jsx("div", { className: classNames?.field, children: _jsx(PasswordComplexityFormField, { ...fieldProps('password'), onComplexity: (isValid) => setIsDisabled(!isValid) }) }), _jsx("div", { className: classNames?.actions, children: _jsx(FormSubmit, { isDisabled: isDisabled, children: "Reset Password" }) })] }));
14
14
  }
15
15
  export default PasswordResetForm;
package/dist/index.d.ts CHANGED
@@ -2,4 +2,6 @@ export type { AuthClassNames, AuthConfigObject } from './interfaces';
2
2
  export type { AuthProps } from './components/Auth';
3
3
  export { default as Auth } from './components/Auth';
4
4
  export { default as LogoutButton } from './components/LogoutButton';
5
+ export { default as PasswordComplexityFormField } from './components/PasswordComplexityFormField';
6
+ export { default as getComplexityRule } from './rules/complexity';
5
7
  export { default as getAuthProxy } from './get-auth-proxy';
package/dist/index.js CHANGED
@@ -1,3 +1,5 @@
1
1
  export { default as Auth } from './components/Auth';
2
2
  export { default as LogoutButton } from './components/LogoutButton';
3
+ export { default as PasswordComplexityFormField } from './components/PasswordComplexityFormField';
4
+ export { default as getComplexityRule } from './rules/complexity';
3
5
  export { default as getAuthProxy } from './get-auth-proxy';
@@ -3,6 +3,8 @@ export interface AuthConfigObject {
3
3
  }
4
4
  export interface AuthClassNames {
5
5
  actions: string;
6
+ content: string;
7
+ field: string;
6
8
  footer: string;
7
9
  form: string;
8
10
  link: string;
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@sqrzro/auth",
3
3
  "type": "module",
4
- "version": "4.0.0-alpha.10",
4
+ "version": "4.0.0-alpha.11",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "dependencies": {
8
8
  "zod": "^4.3.6",
9
- "@sqrzro/server": "^4.0.0-alpha.20",
10
9
  "@sqrzro/ui": "^4.0.0-alpha.20",
11
- "@sqrzro/utility": "^4.0.0-alpha.7"
10
+ "@sqrzro/utility": "^4.0.0-alpha.7",
11
+ "@sqrzro/server": "^4.0.0-alpha.20"
12
12
  },
13
13
  "devDependencies": {
14
14
  "@types/react": "^19.2.7",
@@ -18,8 +18,12 @@ function LoginForm({ classNames }: AuthClassNameProps): React.ReactElement | nul
18
18
  <Fragment>
19
19
  <h1 className={classNames?.title}>Sign in to continue</h1>
20
20
  <Form classNames={{ root: classNames?.form }} {...formProps}>
21
- <TextFormField {...fieldProps('email')} hasAssistiveError />
22
- <PasswordFormField {...fieldProps('password')} hasAssistiveError />
21
+ <div className={classNames?.field}>
22
+ <TextFormField {...fieldProps('email')} hasAssistiveError />
23
+ </div>
24
+ <div className={classNames?.field}>
25
+ <PasswordFormField {...fieldProps('password')} hasAssistiveError />
26
+ </div>
23
27
  <div className={classNames?.actions}>
24
28
  <FormSubmit isFullWidth>Sign In</FormSubmit>
25
29
  </div>
@@ -40,13 +40,17 @@ function PasswordForm({ classNames, defaults }: PasswordFormProps): React.ReactE
40
40
  return (
41
41
  <Fragment>
42
42
  <div style={{ display: sentCount === 0 ? 'block' : 'none' }}>
43
- <Form {...formProps}>
43
+ <Form classNames={{ root: classNames?.form }} {...formProps}>
44
44
  <h1 className={classNames?.title}>Reset Your Password</h1>
45
- <p className="text-sm">
46
- Enter the email address associated with your account and we&#39;ll send you
47
- a link to reset your password.
48
- </p>
49
- <TextFormField {...fieldProps('email')} hasAssistiveError />
45
+ <div className={classNames?.content}>
46
+ <p>
47
+ Enter the email address associated with your account and we&#39;ll send
48
+ you a link to reset your password.
49
+ </p>
50
+ </div>
51
+ <div className={classNames?.field}>
52
+ <TextFormField {...fieldProps('email')} hasAssistiveError />
53
+ </div>
50
54
  <div className={classNames?.actions}>
51
55
  <FormSubmit isFullWidth>Send Email</FormSubmit>
52
56
  </div>
@@ -61,13 +65,13 @@ function PasswordForm({ classNames, defaults }: PasswordFormProps): React.ReactE
61
65
  <div className={classNames?.form}>
62
66
  <h1 className={classNames?.title}>Check Your Email</h1>
63
67
  {sentCount === 1 ? (
64
- <Fragment>
65
- <p className="text-sm">
68
+ <div className={classNames?.content}>
69
+ <p>
66
70
  If <strong>{formData.email}</strong> matches an email we have on
67
71
  file, then we&#39;ve sent you an email containing further
68
72
  instructions for resetting your password.
69
73
  </p>
70
- <p className="text-sm">
74
+ <p>
71
75
  If you haven&#39;t received an email in 5 minutes, check your spam,{' '}
72
76
  <Link className={classNames?.link} onClick={handleResend}>
73
77
  resend
@@ -78,22 +82,22 @@ function PasswordForm({ classNames, defaults }: PasswordFormProps): React.ReactE
78
82
  </Link>
79
83
  .
80
84
  </p>
81
- </Fragment>
85
+ </div>
82
86
  ) : (
83
- <Fragment>
84
- <p className="text-sm">
87
+ <div className={classNames?.content}>
88
+ <p>
85
89
  We&#39;ve resent password reset instructions to{' '}
86
90
  <strong>{formData.email}</strong>, if it is an email we have on
87
91
  file.
88
92
  </p>
89
- <p className="text-sm">
93
+ <p>
90
94
  Please check again. If you still haven&#39;t received an email,{' '}
91
95
  <Link className={classNames?.link} onClick={handleReset}>
92
96
  try a different email address
93
97
  </Link>
94
98
  .
95
99
  </p>
96
- </Fragment>
100
+ </div>
97
101
  )}
98
102
  </div>
99
103
  </div>
@@ -1,6 +1,6 @@
1
1
  'use client';
2
2
 
3
- import { Fragment, useState } from 'react';
3
+ import { useState } from 'react';
4
4
 
5
5
  import { Form, FormSubmit, useForm } from '@sqrzro/ui/forms';
6
6
 
@@ -25,15 +25,18 @@ function PasswordResetForm({
25
25
  });
26
26
 
27
27
  return (
28
- <Fragment>
29
- <Form {...formProps}>
28
+ <Form classNames={{ root: classNames?.form }} {...formProps}>
29
+ <h1 className={classNames?.title}>Reset Your Password</h1>
30
+ <div className={classNames?.field}>
30
31
  <PasswordComplexityFormField
31
32
  {...fieldProps('password')}
32
33
  onComplexity={(isValid) => setIsDisabled(!isValid)}
33
34
  />
35
+ </div>
36
+ <div className={classNames?.actions}>
34
37
  <FormSubmit isDisabled={isDisabled}>Reset Password</FormSubmit>
35
- </Form>
36
- </Fragment>
38
+ </div>
39
+ </Form>
37
40
  );
38
41
  }
39
42
 
package/src/index.ts CHANGED
@@ -4,5 +4,8 @@ export type { AuthProps } from './components/Auth';
4
4
  export { default as Auth } from './components/Auth';
5
5
 
6
6
  export { default as LogoutButton } from './components/LogoutButton';
7
+ export { default as PasswordComplexityFormField } from './components/PasswordComplexityFormField';
8
+
9
+ export { default as getComplexityRule } from './rules/complexity';
7
10
 
8
11
  export { default as getAuthProxy } from './get-auth-proxy';
package/src/interfaces.ts CHANGED
@@ -4,6 +4,8 @@ export interface AuthConfigObject {
4
4
 
5
5
  export interface AuthClassNames {
6
6
  actions: string;
7
+ content: string;
8
+ field: string;
7
9
  footer: string;
8
10
  form: string;
9
11
  link: string;