@tomny-dev/uzi 0.12.0 → 0.13.0-pr.108.360.1.db23138
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/dist/components/auth-form/AuthForm.d.ts +24 -0
- package/dist/components/auth-form/AuthForm.d.ts.map +1 -0
- package/dist/components/auth-form/AuthForm.test.d.ts +2 -0
- package/dist/components/auth-form/AuthForm.test.d.ts.map +1 -0
- package/dist/components/auth-pages/AuthPages.d.ts.map +1 -1
- package/dist/index.cjs +13 -9
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -10
- package/dist/index63.js +15 -21
- package/dist/index63.js.map +1 -1
- package/dist/index64.cjs +21 -30
- package/dist/index64.cjs.map +1 -1
- package/dist/index64.js +51 -44
- package/dist/index64.js.map +1 -1
- package/dist/index65.cjs +52 -43
- package/dist/index65.cjs.map +1 -1
- package/dist/index65.js +14 -50
- package/dist/index65.js.map +1 -1
- package/dist/index66.cjs +15 -69
- package/dist/index66.cjs.map +1 -1
- package/dist/index66.js +25 -414
- package/dist/index66.js.map +1 -1
- package/dist/index67.cjs +25 -416
- package/dist/index67.cjs.map +1 -1
- package/dist/index67.js +56 -58
- package/dist/index67.js.map +1 -1
- package/dist/index68.cjs +82 -85
- package/dist/index68.cjs.map +1 -1
- package/dist/index68.js +420 -226
- package/dist/index68.js.map +1 -1
- package/dist/index69.cjs +421 -225
- package/dist/index69.cjs.map +1 -1
- package/dist/index69.js +58 -42
- package/dist/index69.js.map +1 -1
- package/dist/index70.cjs +85 -61
- package/dist/index70.cjs.map +1 -1
- package/dist/index70.js +236 -76
- package/dist/index70.js.map +1 -1
- package/dist/index71.cjs +235 -75
- package/dist/index71.cjs.map +1 -1
- package/dist/index71.js +42 -20
- package/dist/index71.js.map +1 -1
- package/dist/index72.cjs +60 -27
- package/dist/index72.cjs.map +1 -1
- package/dist/index72.js +73 -88
- package/dist/index72.js.map +1 -1
- package/dist/index73.cjs +73 -90
- package/dist/index73.cjs.map +1 -1
- package/dist/index73.js +17 -15
- package/dist/index73.js.map +1 -1
- package/dist/index74.cjs +22 -19
- package/dist/index74.cjs.map +1 -1
- package/dist/index74.js +85 -143
- package/dist/index74.js.map +1 -1
- package/dist/index75.cjs +87 -143
- package/dist/index75.cjs.map +1 -1
- package/dist/index75.js +19 -91
- package/dist/index75.js.map +1 -1
- package/dist/index76.cjs +27 -135
- package/dist/index76.cjs.map +1 -1
- package/dist/index76.js +140 -673
- package/dist/index76.js.map +1 -1
- package/dist/index77.cjs +140 -673
- package/dist/index77.cjs.map +1 -1
- package/dist/index77.js +91 -31
- package/dist/index77.js.map +1 -1
- package/dist/index78.cjs +135 -45
- package/dist/index78.cjs.map +1 -1
- package/dist/index78.js +667 -206
- package/dist/index78.js.map +1 -1
- package/dist/index79.cjs +667 -204
- package/dist/index79.cjs.map +1 -1
- package/dist/index79.js +31 -15
- package/dist/index79.js.map +1 -1
- package/dist/index80.cjs +45 -21
- package/dist/index80.cjs.map +1 -1
- package/dist/index80.js +224 -29
- package/dist/index80.js.map +1 -1
- package/dist/index81.cjs +224 -30
- package/dist/index81.cjs.map +1 -1
- package/dist/index81.js +19 -0
- package/dist/index81.js.map +1 -0
- package/dist/index82.cjs +25 -0
- package/dist/index82.cjs.map +1 -0
- package/dist/index82.js +36 -0
- package/dist/index82.js.map +1 -0
- package/dist/index83.cjs +37 -0
- package/dist/index83.cjs.map +1 -0
- package/dist/style.css +13 -3
- package/package.json +1 -1
package/dist/index65.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index65.js","names":[],"sources":["../src/components/auth-
|
|
1
|
+
{"version":3,"file":"index65.js","names":[],"sources":["../src/components/auth-card/auth-card.module.css"],"sourcesContent":[".authLayout {\n display: flex;\n align-items: center;\n justify-content: center;\n min-height: 100vh;\n min-height: 100dvh;\n padding: 20px;\n background: var(--background);\n}\n\n.authCard {\n width: 100%;\n max-width: 400px;\n border-radius: var(--ts-card-radius, 12px);\n border: 1px solid var(--ts-card-border, var(--border));\n background: var(--ts-card-bg, var(--card));\n color: var(--ts-card-fg, var(--foreground));\n box-shadow: var(--ts-card-shadow, 0 16px 36px rgba(0, 0, 0, 0.28));\n padding: 24px;\n display: flex;\n flex-direction: column;\n gap: 16px;\n}\n\n.authBrand {\n display: flex;\n justify-content: center;\n margin-bottom: 4px;\n}\n\n.authBrand svg {\n width: 40px;\n height: 40px;\n color: var(--primary);\n}\n\n.authHeader {\n text-align: center;\n}\n\n.authTitle {\n font-size: 1.25rem;\n font-weight: 600;\n line-height: 1.4;\n margin: 0;\n color: var(--foreground);\n}\n\n.authSubtitle {\n font-size: 0.875rem;\n color: var(--muted-foreground);\n margin-top: 8px;\n margin-bottom: 0;\n line-height: 1.4;\n}\n\n.authBody {\n display: flex;\n flex-direction: column;\n gap: 16px;\n}\n\n.divider {\n border: none;\n border-top: 1px solid var(--border);\n margin: 0;\n}\n\n.authFooter {\n text-align: center;\n font-size: 0.875rem;\n color: var(--muted-foreground);\n margin: 0;\n}\n\n.authFooter a {\n color: var(--primary);\n text-decoration: none;\n font-weight: 500;\n}\n\n.authFooter a:hover {\n text-decoration: underline;\n}\n"],"mappings":""}
|
package/dist/index66.cjs
CHANGED
|
@@ -1,88 +1,34 @@
|
|
|
1
|
-
//#region src/components/auth-
|
|
2
|
-
var authLayout = "uzi-auth-
|
|
3
|
-
var authCard = "uzi-auth-
|
|
4
|
-
var authBrand = "uzi-auth-
|
|
5
|
-
var authHeader = "uzi-auth-
|
|
6
|
-
var authTitle = "uzi-auth-
|
|
7
|
-
var authSubtitle = "uzi-auth-
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
var error = "uzi-auth-pages-module__error__7Mhyi";
|
|
13
|
-
var passwordWrapper = "uzi-auth-pages-module__passwordWrapper__P0bez";
|
|
14
|
-
var toggle = "uzi-auth-pages-module__toggle__T7HaZ";
|
|
15
|
-
var eyeIcon = "uzi-auth-pages-module__eyeIcon__ab2Ts";
|
|
16
|
-
var checkboxRow = "uzi-auth-pages-module__checkboxRow__Rq-84";
|
|
17
|
-
var checkboxLabel = "uzi-auth-pages-module__checkboxLabel__poKs-";
|
|
18
|
-
var checkbox = "uzi-auth-pages-module__checkbox__KOQQe";
|
|
19
|
-
var forgotLink = "uzi-auth-pages-module__forgotLink__5q-vL";
|
|
20
|
-
var checkboxLink = "uzi-auth-pages-module__checkboxLink__kAkKg";
|
|
21
|
-
var submitButton = "uzi-auth-pages-module__submitButton__mlGxT";
|
|
22
|
-
var spinner = "uzi-auth-pages-module__spinner__seK4F";
|
|
23
|
-
var spin = "uzi-auth-pages-module__spin__hYpWH";
|
|
24
|
-
var divider = "uzi-auth-pages-module__divider__Debmu";
|
|
25
|
-
var authFooter = "uzi-auth-pages-module__authFooter__SEaGh";
|
|
26
|
-
var sentMessage = "uzi-auth-pages-module__sentMessage__vLBoY";
|
|
27
|
-
var sentText = "uzi-auth-pages-module__sentText__qyJkF";
|
|
28
|
-
var backLink = "uzi-auth-pages-module__backLink__ezB3X";
|
|
29
|
-
var auth_pages_module_default = {
|
|
1
|
+
//#region src/components/auth-card/auth-card.module.css
|
|
2
|
+
var authLayout = "uzi-auth-card-module__authLayout__GHr1j";
|
|
3
|
+
var authCard = "uzi-auth-card-module__authCard__ZYYit";
|
|
4
|
+
var authBrand = "uzi-auth-card-module__authBrand__ZCDVm";
|
|
5
|
+
var authHeader = "uzi-auth-card-module__authHeader__NB6UQ";
|
|
6
|
+
var authTitle = "uzi-auth-card-module__authTitle__VtHLn";
|
|
7
|
+
var authSubtitle = "uzi-auth-card-module__authSubtitle__ZupId";
|
|
8
|
+
var authBody = "uzi-auth-card-module__authBody__PTyaL";
|
|
9
|
+
var divider = "uzi-auth-card-module__divider__D8r12";
|
|
10
|
+
var authFooter = "uzi-auth-card-module__authFooter__C5s--";
|
|
11
|
+
var auth_card_module_default = {
|
|
30
12
|
authLayout,
|
|
31
13
|
authCard,
|
|
32
14
|
authBrand,
|
|
33
15
|
authHeader,
|
|
34
16
|
authTitle,
|
|
35
17
|
authSubtitle,
|
|
36
|
-
|
|
37
|
-
field,
|
|
38
|
-
label,
|
|
39
|
-
input,
|
|
40
|
-
error,
|
|
41
|
-
passwordWrapper,
|
|
42
|
-
toggle,
|
|
43
|
-
eyeIcon,
|
|
44
|
-
checkboxRow,
|
|
45
|
-
checkboxLabel,
|
|
46
|
-
checkbox,
|
|
47
|
-
forgotLink,
|
|
48
|
-
checkboxLink,
|
|
49
|
-
submitButton,
|
|
50
|
-
spinner,
|
|
51
|
-
spin,
|
|
18
|
+
authBody,
|
|
52
19
|
divider,
|
|
53
|
-
authFooter
|
|
54
|
-
sentMessage,
|
|
55
|
-
sentText,
|
|
56
|
-
backLink
|
|
20
|
+
authFooter
|
|
57
21
|
};
|
|
58
22
|
//#endregion
|
|
23
|
+
exports.authBody = authBody;
|
|
59
24
|
exports.authBrand = authBrand;
|
|
60
25
|
exports.authCard = authCard;
|
|
61
26
|
exports.authFooter = authFooter;
|
|
62
|
-
exports.authForm = authForm;
|
|
63
27
|
exports.authHeader = authHeader;
|
|
64
28
|
exports.authLayout = authLayout;
|
|
65
29
|
exports.authSubtitle = authSubtitle;
|
|
66
30
|
exports.authTitle = authTitle;
|
|
67
|
-
exports.
|
|
68
|
-
exports.checkbox = checkbox;
|
|
69
|
-
exports.checkboxLabel = checkboxLabel;
|
|
70
|
-
exports.checkboxLink = checkboxLink;
|
|
71
|
-
exports.checkboxRow = checkboxRow;
|
|
72
|
-
exports.default = auth_pages_module_default;
|
|
31
|
+
exports.default = auth_card_module_default;
|
|
73
32
|
exports.divider = divider;
|
|
74
|
-
exports.error = error;
|
|
75
|
-
exports.eyeIcon = eyeIcon;
|
|
76
|
-
exports.field = field;
|
|
77
|
-
exports.forgotLink = forgotLink;
|
|
78
|
-
exports.input = input;
|
|
79
|
-
exports.label = label;
|
|
80
|
-
exports.passwordWrapper = passwordWrapper;
|
|
81
|
-
exports.sentMessage = sentMessage;
|
|
82
|
-
exports.sentText = sentText;
|
|
83
|
-
exports.spin = spin;
|
|
84
|
-
exports.spinner = spinner;
|
|
85
|
-
exports.submitButton = submitButton;
|
|
86
|
-
exports.toggle = toggle;
|
|
87
33
|
|
|
88
34
|
//# sourceMappingURL=index66.cjs.map
|
package/dist/index66.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index66.cjs","names":[],"sources":["../src/components/auth-
|
|
1
|
+
{"version":3,"file":"index66.cjs","names":[],"sources":["../src/components/auth-card/auth-card.module.css"],"sourcesContent":[".authLayout {\n display: flex;\n align-items: center;\n justify-content: center;\n min-height: 100vh;\n min-height: 100dvh;\n padding: 20px;\n background: var(--background);\n}\n\n.authCard {\n width: 100%;\n max-width: 400px;\n border-radius: var(--ts-card-radius, 12px);\n border: 1px solid var(--ts-card-border, var(--border));\n background: var(--ts-card-bg, var(--card));\n color: var(--ts-card-fg, var(--foreground));\n box-shadow: var(--ts-card-shadow, 0 16px 36px rgba(0, 0, 0, 0.28));\n padding: 24px;\n display: flex;\n flex-direction: column;\n gap: 16px;\n}\n\n.authBrand {\n display: flex;\n justify-content: center;\n margin-bottom: 4px;\n}\n\n.authBrand svg {\n width: 40px;\n height: 40px;\n color: var(--primary);\n}\n\n.authHeader {\n text-align: center;\n}\n\n.authTitle {\n font-size: 1.25rem;\n font-weight: 600;\n line-height: 1.4;\n margin: 0;\n color: var(--foreground);\n}\n\n.authSubtitle {\n font-size: 0.875rem;\n color: var(--muted-foreground);\n margin-top: 8px;\n margin-bottom: 0;\n line-height: 1.4;\n}\n\n.authBody {\n display: flex;\n flex-direction: column;\n gap: 16px;\n}\n\n.divider {\n border: none;\n border-top: 1px solid var(--border);\n margin: 0;\n}\n\n.authFooter {\n text-align: center;\n font-size: 0.875rem;\n color: var(--muted-foreground);\n margin: 0;\n}\n\n.authFooter a {\n color: var(--primary);\n text-decoration: none;\n font-weight: 500;\n}\n\n.authFooter a:hover {\n text-decoration: underline;\n}\n"],"mappings":""}
|
package/dist/index66.js
CHANGED
|
@@ -1,439 +1,50 @@
|
|
|
1
1
|
import { cx } from "./index3.js";
|
|
2
|
-
import
|
|
2
|
+
import auth_card_module_default from "./index65.js";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
-
//#region src/components/auth-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
stroke: "currentColor",
|
|
15
|
-
strokeWidth: "2"
|
|
16
|
-
}), /* @__PURE__ */ jsx("circle", {
|
|
17
|
-
cx: "12",
|
|
18
|
-
cy: "12",
|
|
19
|
-
r: "3",
|
|
20
|
-
stroke: "currentColor",
|
|
21
|
-
strokeWidth: "2"
|
|
22
|
-
})]
|
|
23
|
-
});
|
|
24
|
-
return /* @__PURE__ */ jsxs("svg", {
|
|
25
|
-
viewBox: "0 0 24 24",
|
|
26
|
-
fill: "none",
|
|
27
|
-
"aria-hidden": "true",
|
|
28
|
-
className: auth_pages_module_default.eyeIcon,
|
|
29
|
-
children: [
|
|
30
|
-
/* @__PURE__ */ jsx("path", {
|
|
31
|
-
d: "M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94",
|
|
32
|
-
stroke: "currentColor",
|
|
33
|
-
strokeWidth: "2"
|
|
34
|
-
}),
|
|
35
|
-
/* @__PURE__ */ jsx("path", {
|
|
36
|
-
d: "M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19",
|
|
37
|
-
stroke: "currentColor",
|
|
38
|
-
strokeWidth: "2"
|
|
39
|
-
}),
|
|
40
|
-
/* @__PURE__ */ jsx("line", {
|
|
41
|
-
x1: "1",
|
|
42
|
-
y1: "1",
|
|
43
|
-
x2: "23",
|
|
44
|
-
y2: "23",
|
|
45
|
-
stroke: "currentColor",
|
|
46
|
-
strokeWidth: "2"
|
|
47
|
-
})
|
|
48
|
-
]
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
function Field({ label, id, children, error }) {
|
|
52
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
53
|
-
className: auth_pages_module_default.field,
|
|
54
|
-
children: [
|
|
55
|
-
/* @__PURE__ */ jsx("label", {
|
|
56
|
-
htmlFor: id,
|
|
57
|
-
className: auth_pages_module_default.label,
|
|
58
|
-
children: label
|
|
59
|
-
}),
|
|
60
|
-
children,
|
|
61
|
-
error && /* @__PURE__ */ jsx("span", {
|
|
62
|
-
className: auth_pages_module_default.error,
|
|
63
|
-
children: error
|
|
64
|
-
})
|
|
65
|
-
]
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
function PasswordField({ id, label, placeholder, value, onChange, error }) {
|
|
69
|
-
const [show, setShow] = React.useState(false);
|
|
70
|
-
const toggleRef = React.useRef(null);
|
|
71
|
-
return /* @__PURE__ */ jsx(Field, {
|
|
72
|
-
label: label ?? "Password",
|
|
73
|
-
id,
|
|
74
|
-
error,
|
|
75
|
-
children: /* @__PURE__ */ jsxs("div", {
|
|
76
|
-
className: auth_pages_module_default.passwordWrapper,
|
|
77
|
-
children: [/* @__PURE__ */ jsx("input", {
|
|
78
|
-
id,
|
|
79
|
-
type: show ? "text" : "password",
|
|
80
|
-
placeholder,
|
|
81
|
-
value,
|
|
82
|
-
onChange,
|
|
83
|
-
className: auth_pages_module_default.input
|
|
84
|
-
}), /* @__PURE__ */ jsx("button", {
|
|
85
|
-
ref: toggleRef,
|
|
86
|
-
type: "button",
|
|
87
|
-
onClick: () => setShow((s) => !s),
|
|
88
|
-
className: auth_pages_module_default.toggle,
|
|
89
|
-
"aria-label": show ? "Hide password" : "Show password",
|
|
90
|
-
children: /* @__PURE__ */ jsx(EyeIcon, { open: show })
|
|
91
|
-
})]
|
|
92
|
-
})
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
function CheckboxRow({ label, linkText, linkHref, checked, onChange }) {
|
|
96
|
-
if (!label) return null;
|
|
97
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
98
|
-
className: auth_pages_module_default.checkboxRow,
|
|
99
|
-
children: [/* @__PURE__ */ jsxs("label", {
|
|
100
|
-
className: auth_pages_module_default.checkboxLabel,
|
|
101
|
-
children: [/* @__PURE__ */ jsx("input", {
|
|
102
|
-
type: "checkbox",
|
|
103
|
-
className: auth_pages_module_default.checkbox,
|
|
104
|
-
checked,
|
|
105
|
-
onChange: (e) => onChange?.(e.target.checked)
|
|
106
|
-
}), /* @__PURE__ */ jsx("span", { children: label })]
|
|
107
|
-
}), linkHref && /* @__PURE__ */ jsx("a", {
|
|
108
|
-
href: linkHref,
|
|
109
|
-
className: auth_pages_module_default.forgotLink,
|
|
110
|
-
children: linkText
|
|
111
|
-
})]
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
function SignInPage({ title = "Sign in", subtitle, footer, onSubmit, loading = false, brand, className, emailPlaceholder = "Email address", passwordPlaceholder = "Password", rememberLabel = "Remember me", forgotLinkText = "Forgot password?", forgotLinkHref }) {
|
|
115
|
-
const id = React.useId();
|
|
116
|
-
const [email, setEmail] = React.useState("");
|
|
117
|
-
const [password, setPassword] = React.useState("");
|
|
118
|
-
const [rememberMe, setRememberMe] = React.useState(false);
|
|
119
|
-
const [errors, setErrors] = React.useState({});
|
|
120
|
-
const [submitted, setSubmitted] = React.useState(false);
|
|
121
|
-
const validate = () => {
|
|
122
|
-
const newErrors = {};
|
|
123
|
-
if (!email.trim()) newErrors.email = "Email is required";
|
|
124
|
-
else if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email)) newErrors.email = "Enter a valid email";
|
|
125
|
-
if (!password) newErrors.password = "Password is required";
|
|
126
|
-
setErrors(newErrors);
|
|
127
|
-
return Object.keys(newErrors).length === 0;
|
|
128
|
-
};
|
|
129
|
-
const handleSubmit = (e) => {
|
|
130
|
-
e.preventDefault();
|
|
131
|
-
setSubmitted(true);
|
|
132
|
-
if (!validate()) return;
|
|
133
|
-
onSubmit?.({
|
|
134
|
-
email,
|
|
135
|
-
password,
|
|
136
|
-
rememberMe
|
|
137
|
-
});
|
|
138
|
-
};
|
|
5
|
+
//#region src/components/auth-card/AuthCard.tsx
|
|
6
|
+
/**
|
|
7
|
+
* AuthCard — a centered card layout for auth pages.
|
|
8
|
+
*
|
|
9
|
+
* - Centered vertically and horizontally on screen
|
|
10
|
+
* - Brand → title → subtitle → form → divider → footer
|
|
11
|
+
* - No auth logic — just the visual template
|
|
12
|
+
*/
|
|
13
|
+
var AuthCard = React.forwardRef(({ title, subtitle, children, footer, brand, className }, ref) => {
|
|
139
14
|
return /* @__PURE__ */ jsx("div", {
|
|
140
|
-
className: cx(
|
|
15
|
+
className: cx(auth_card_module_default.authLayout, className),
|
|
16
|
+
ref,
|
|
141
17
|
children: /* @__PURE__ */ jsxs("div", {
|
|
142
|
-
className:
|
|
18
|
+
className: auth_card_module_default.authCard,
|
|
143
19
|
children: [
|
|
144
20
|
brand && /* @__PURE__ */ jsx("div", {
|
|
145
|
-
className:
|
|
21
|
+
className: auth_card_module_default.authBrand,
|
|
146
22
|
children: brand
|
|
147
23
|
}),
|
|
148
24
|
/* @__PURE__ */ jsxs("div", {
|
|
149
|
-
className:
|
|
25
|
+
className: auth_card_module_default.authHeader,
|
|
150
26
|
children: [/* @__PURE__ */ jsx("h1", {
|
|
151
|
-
className:
|
|
27
|
+
className: auth_card_module_default.authTitle,
|
|
152
28
|
children: title
|
|
153
29
|
}), subtitle && /* @__PURE__ */ jsx("p", {
|
|
154
|
-
className:
|
|
30
|
+
className: auth_card_module_default.authSubtitle,
|
|
155
31
|
children: subtitle
|
|
156
32
|
})]
|
|
157
33
|
}),
|
|
158
|
-
/* @__PURE__ */
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
children: [
|
|
162
|
-
/* @__PURE__ */ jsx(Field, {
|
|
163
|
-
label: emailPlaceholder,
|
|
164
|
-
id: id + "-email",
|
|
165
|
-
error: submitted ? errors.email : void 0,
|
|
166
|
-
children: /* @__PURE__ */ jsx("input", {
|
|
167
|
-
id: id + "-email",
|
|
168
|
-
type: "email",
|
|
169
|
-
placeholder: "you@example.com",
|
|
170
|
-
value: email,
|
|
171
|
-
onChange: (e) => setEmail(e.target.value),
|
|
172
|
-
className: auth_pages_module_default.input,
|
|
173
|
-
autoComplete: "email",
|
|
174
|
-
autoFocus: true
|
|
175
|
-
})
|
|
176
|
-
}),
|
|
177
|
-
/* @__PURE__ */ jsx(PasswordField, {
|
|
178
|
-
label: passwordPlaceholder,
|
|
179
|
-
id: id + "-password",
|
|
180
|
-
placeholder: passwordPlaceholder,
|
|
181
|
-
value: password,
|
|
182
|
-
onChange: (e) => {
|
|
183
|
-
setPassword(e.target.value);
|
|
184
|
-
if (submitted) setSubmitted(false);
|
|
185
|
-
},
|
|
186
|
-
error: submitted ? errors.password : void 0
|
|
187
|
-
}),
|
|
188
|
-
/* @__PURE__ */ jsx(CheckboxRow, {
|
|
189
|
-
label: rememberLabel,
|
|
190
|
-
linkText: forgotLinkText,
|
|
191
|
-
linkHref: forgotLinkHref,
|
|
192
|
-
checked: rememberMe,
|
|
193
|
-
onChange: (c) => {
|
|
194
|
-
setRememberMe(c);
|
|
195
|
-
if (submitted) setSubmitted(false);
|
|
196
|
-
}
|
|
197
|
-
}),
|
|
198
|
-
/* @__PURE__ */ jsx("button", {
|
|
199
|
-
type: "submit",
|
|
200
|
-
disabled: loading,
|
|
201
|
-
className: auth_pages_module_default.submitButton,
|
|
202
|
-
children: loading ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("span", { className: auth_pages_module_default.spinner }), "Signing in..."] }) : "Sign in"
|
|
203
|
-
})
|
|
204
|
-
]
|
|
205
|
-
}),
|
|
206
|
-
footer && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("hr", { className: auth_pages_module_default.divider }), /* @__PURE__ */ jsx("p", {
|
|
207
|
-
className: auth_pages_module_default.authFooter,
|
|
208
|
-
children: footer
|
|
209
|
-
})] })
|
|
210
|
-
]
|
|
211
|
-
})
|
|
212
|
-
});
|
|
213
|
-
}
|
|
214
|
-
function SignUpPage({ title = "Create an account", subtitle, footer, onSubmit, loading = false, brand, className, emailPlaceholder = "Email address", passwordPlaceholder = "Password", confirmPasswordPlaceholder = "Confirm password", checkboxLabel, checkboxLinkText, checkboxLinkHref }) {
|
|
215
|
-
const id = React.useId();
|
|
216
|
-
const [email, setEmail] = React.useState("");
|
|
217
|
-
const [password, setPassword] = React.useState("");
|
|
218
|
-
const [confirmPassword, setConfirmPassword] = React.useState("");
|
|
219
|
-
const [agreed, setAgreed] = React.useState(false);
|
|
220
|
-
const [errors, setErrors] = React.useState({});
|
|
221
|
-
const [submitted, setSubmitted] = React.useState(false);
|
|
222
|
-
const validate = () => {
|
|
223
|
-
const newErrors = {};
|
|
224
|
-
if (!email.trim()) newErrors.email = "Email is required";
|
|
225
|
-
else if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email)) newErrors.email = "Enter a valid email";
|
|
226
|
-
if (!password) newErrors.password = "Password is required";
|
|
227
|
-
else if (password.length < 8) newErrors.password = "At least 8 characters";
|
|
228
|
-
if (password !== confirmPassword) newErrors.confirmPassword = "Passwords do not match";
|
|
229
|
-
if (!agreed) newErrors.agreed = "You must agree to continue";
|
|
230
|
-
setErrors(newErrors);
|
|
231
|
-
return Object.keys(newErrors).length === 0;
|
|
232
|
-
};
|
|
233
|
-
const handleSubmit = (e) => {
|
|
234
|
-
e.preventDefault();
|
|
235
|
-
setSubmitted(true);
|
|
236
|
-
if (!validate()) return;
|
|
237
|
-
onSubmit?.({
|
|
238
|
-
email,
|
|
239
|
-
password,
|
|
240
|
-
agreed
|
|
241
|
-
});
|
|
242
|
-
};
|
|
243
|
-
return /* @__PURE__ */ jsx("div", {
|
|
244
|
-
className: cx(auth_pages_module_default.authLayout, className),
|
|
245
|
-
children: /* @__PURE__ */ jsxs("div", {
|
|
246
|
-
className: auth_pages_module_default.authCard,
|
|
247
|
-
children: [
|
|
248
|
-
brand && /* @__PURE__ */ jsx("div", {
|
|
249
|
-
className: auth_pages_module_default.authBrand,
|
|
250
|
-
children: brand
|
|
251
|
-
}),
|
|
252
|
-
/* @__PURE__ */ jsxs("div", {
|
|
253
|
-
className: auth_pages_module_default.authHeader,
|
|
254
|
-
children: [/* @__PURE__ */ jsx("h1", {
|
|
255
|
-
className: auth_pages_module_default.authTitle,
|
|
256
|
-
children: title
|
|
257
|
-
}), subtitle && /* @__PURE__ */ jsx("p", {
|
|
258
|
-
className: auth_pages_module_default.authSubtitle,
|
|
259
|
-
children: subtitle
|
|
260
|
-
})]
|
|
261
|
-
}),
|
|
262
|
-
/* @__PURE__ */ jsxs("form", {
|
|
263
|
-
onSubmit: handleSubmit,
|
|
264
|
-
className: auth_pages_module_default.authForm,
|
|
265
|
-
children: [
|
|
266
|
-
/* @__PURE__ */ jsx(Field, {
|
|
267
|
-
label: emailPlaceholder,
|
|
268
|
-
id: id + "-email",
|
|
269
|
-
error: submitted ? errors.email : void 0,
|
|
270
|
-
children: /* @__PURE__ */ jsx("input", {
|
|
271
|
-
id: id + "-email",
|
|
272
|
-
type: "email",
|
|
273
|
-
placeholder: "you@example.com",
|
|
274
|
-
value: email,
|
|
275
|
-
onChange: (e) => {
|
|
276
|
-
setEmail(e.target.value);
|
|
277
|
-
if (submitted) setSubmitted(false);
|
|
278
|
-
},
|
|
279
|
-
className: auth_pages_module_default.input,
|
|
280
|
-
autoComplete: "email",
|
|
281
|
-
autoFocus: true
|
|
282
|
-
})
|
|
283
|
-
}),
|
|
284
|
-
/* @__PURE__ */ jsx(PasswordField, {
|
|
285
|
-
label: passwordPlaceholder,
|
|
286
|
-
id: id + "-password",
|
|
287
|
-
placeholder: passwordPlaceholder,
|
|
288
|
-
value: password,
|
|
289
|
-
onChange: (e) => {
|
|
290
|
-
setPassword(e.target.value);
|
|
291
|
-
if (submitted) setSubmitted(false);
|
|
292
|
-
},
|
|
293
|
-
error: submitted ? errors.password : void 0
|
|
294
|
-
}),
|
|
295
|
-
/* @__PURE__ */ jsx(PasswordField, {
|
|
296
|
-
label: confirmPasswordPlaceholder,
|
|
297
|
-
id: id + "-confirm",
|
|
298
|
-
placeholder: confirmPasswordPlaceholder,
|
|
299
|
-
value: confirmPassword,
|
|
300
|
-
onChange: (e) => {
|
|
301
|
-
setConfirmPassword(e.target.value);
|
|
302
|
-
if (submitted) setSubmitted(false);
|
|
303
|
-
},
|
|
304
|
-
error: submitted ? errors.confirmPassword : void 0
|
|
305
|
-
}),
|
|
306
|
-
checkboxLabel && /* @__PURE__ */ jsx("div", {
|
|
307
|
-
className: auth_pages_module_default.checkboxRow,
|
|
308
|
-
children: /* @__PURE__ */ jsxs("label", {
|
|
309
|
-
className: auth_pages_module_default.checkboxLabel,
|
|
310
|
-
children: [/* @__PURE__ */ jsx("input", {
|
|
311
|
-
id: id + "-agreed",
|
|
312
|
-
type: "checkbox",
|
|
313
|
-
checked: agreed,
|
|
314
|
-
onChange: (e) => {
|
|
315
|
-
setAgreed(e.target.checked);
|
|
316
|
-
if (submitted) setSubmitted(false);
|
|
317
|
-
},
|
|
318
|
-
className: auth_pages_module_default.checkbox
|
|
319
|
-
}), /* @__PURE__ */ jsx("span", { children: checkboxLinkText ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
320
|
-
"I agree to the",
|
|
321
|
-
" ",
|
|
322
|
-
/* @__PURE__ */ jsx("a", {
|
|
323
|
-
href: checkboxLinkHref,
|
|
324
|
-
className: auth_pages_module_default.checkboxLink,
|
|
325
|
-
children: checkboxLinkText
|
|
326
|
-
})
|
|
327
|
-
] }) : checkboxLabel })]
|
|
328
|
-
})
|
|
329
|
-
}),
|
|
330
|
-
submitted && errors.agreed && /* @__PURE__ */ jsx("span", {
|
|
331
|
-
className: auth_pages_module_default.error,
|
|
332
|
-
children: errors.agreed
|
|
333
|
-
}),
|
|
334
|
-
/* @__PURE__ */ jsx("button", {
|
|
335
|
-
type: "submit",
|
|
336
|
-
disabled: loading,
|
|
337
|
-
className: auth_pages_module_default.submitButton,
|
|
338
|
-
children: loading ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("span", { className: auth_pages_module_default.spinner }), "Creating account..."] }) : "Create account"
|
|
339
|
-
})
|
|
340
|
-
]
|
|
341
|
-
}),
|
|
342
|
-
footer && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("hr", { className: auth_pages_module_default.divider }), /* @__PURE__ */ jsx("p", {
|
|
343
|
-
className: auth_pages_module_default.authFooter,
|
|
344
|
-
children: footer
|
|
345
|
-
})] })
|
|
346
|
-
]
|
|
347
|
-
})
|
|
348
|
-
});
|
|
349
|
-
}
|
|
350
|
-
function ForgotPasswordPage({ title = "Reset password", subtitle = "Enter your email and we'll send a reset link", footer, onSubmit, loading = false, brand, className, emailPlaceholder = "Email address", buttonText = "Send reset link", backLinkText = "Back to sign in", backLinkHref = "/signin" }) {
|
|
351
|
-
const id = React.useId();
|
|
352
|
-
const [email, setEmail] = React.useState("");
|
|
353
|
-
const [error, setError] = React.useState("");
|
|
354
|
-
const [sent, setSent] = React.useState(false);
|
|
355
|
-
const handleSubmit = (e) => {
|
|
356
|
-
e.preventDefault();
|
|
357
|
-
if (!email.trim()) {
|
|
358
|
-
setError("Email is required");
|
|
359
|
-
return;
|
|
360
|
-
}
|
|
361
|
-
if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email)) {
|
|
362
|
-
setError("Enter a valid email");
|
|
363
|
-
return;
|
|
364
|
-
}
|
|
365
|
-
onSubmit?.({ email });
|
|
366
|
-
setSent(true);
|
|
367
|
-
};
|
|
368
|
-
return /* @__PURE__ */ jsx("div", {
|
|
369
|
-
className: cx(auth_pages_module_default.authLayout, className),
|
|
370
|
-
children: /* @__PURE__ */ jsxs("div", {
|
|
371
|
-
className: auth_pages_module_default.authCard,
|
|
372
|
-
children: [
|
|
373
|
-
brand && /* @__PURE__ */ jsx("div", {
|
|
374
|
-
className: auth_pages_module_default.authBrand,
|
|
375
|
-
children: brand
|
|
376
|
-
}),
|
|
377
|
-
/* @__PURE__ */ jsxs("div", {
|
|
378
|
-
className: auth_pages_module_default.authHeader,
|
|
379
|
-
children: [/* @__PURE__ */ jsx("h1", {
|
|
380
|
-
className: auth_pages_module_default.authTitle,
|
|
381
|
-
children: title
|
|
382
|
-
}), subtitle && /* @__PURE__ */ jsx("p", {
|
|
383
|
-
className: auth_pages_module_default.authSubtitle,
|
|
384
|
-
children: subtitle
|
|
385
|
-
})]
|
|
386
|
-
}),
|
|
387
|
-
sent ? /* @__PURE__ */ jsxs("div", {
|
|
388
|
-
className: auth_pages_module_default.sentMessage,
|
|
389
|
-
children: [/* @__PURE__ */ jsxs("p", {
|
|
390
|
-
className: auth_pages_module_default.sentText,
|
|
391
|
-
children: [
|
|
392
|
-
"If an account exists for ",
|
|
393
|
-
/* @__PURE__ */ jsx("strong", { children: email }),
|
|
394
|
-
", you'll receive a reset link shortly."
|
|
395
|
-
]
|
|
396
|
-
}), /* @__PURE__ */ jsx("a", {
|
|
397
|
-
href: backLinkHref,
|
|
398
|
-
className: auth_pages_module_default.backLink,
|
|
399
|
-
children: backLinkText
|
|
400
|
-
})]
|
|
401
|
-
}) : /* @__PURE__ */ jsxs("form", {
|
|
402
|
-
onSubmit: handleSubmit,
|
|
403
|
-
className: auth_pages_module_default.authForm,
|
|
404
|
-
children: [/* @__PURE__ */ jsx(Field, {
|
|
405
|
-
label: emailPlaceholder,
|
|
406
|
-
id: id + "-email",
|
|
407
|
-
error,
|
|
408
|
-
children: /* @__PURE__ */ jsx("input", {
|
|
409
|
-
id: id + "-email",
|
|
410
|
-
type: "email",
|
|
411
|
-
placeholder: "you@example.com",
|
|
412
|
-
value: email,
|
|
413
|
-
onChange: (e) => {
|
|
414
|
-
setEmail(e.target.value);
|
|
415
|
-
setError("");
|
|
416
|
-
},
|
|
417
|
-
className: auth_pages_module_default.input,
|
|
418
|
-
autoComplete: "email",
|
|
419
|
-
autoFocus: true
|
|
420
|
-
})
|
|
421
|
-
}), /* @__PURE__ */ jsx("button", {
|
|
422
|
-
type: "submit",
|
|
423
|
-
disabled: loading,
|
|
424
|
-
className: auth_pages_module_default.submitButton,
|
|
425
|
-
children: loading ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("span", { className: auth_pages_module_default.spinner }), "Sending..."] }) : buttonText
|
|
426
|
-
})]
|
|
34
|
+
/* @__PURE__ */ jsx("div", {
|
|
35
|
+
className: auth_card_module_default.authBody,
|
|
36
|
+
children
|
|
427
37
|
}),
|
|
428
|
-
footer && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("hr", { className:
|
|
429
|
-
className:
|
|
38
|
+
footer && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("hr", { className: auth_card_module_default.divider }), /* @__PURE__ */ jsx("p", {
|
|
39
|
+
className: auth_card_module_default.authFooter,
|
|
430
40
|
children: footer
|
|
431
41
|
})] })
|
|
432
42
|
]
|
|
433
43
|
})
|
|
434
44
|
});
|
|
435
|
-
}
|
|
45
|
+
});
|
|
46
|
+
AuthCard.displayName = "AuthCard";
|
|
436
47
|
//#endregion
|
|
437
|
-
export {
|
|
48
|
+
export { AuthCard };
|
|
438
49
|
|
|
439
50
|
//# sourceMappingURL=index66.js.map
|