@tomny-dev/uzi 0.13.0 → 0.14.0-pr.109.379.1.3f7230e

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.
@@ -3,6 +3,25 @@ import { type AuthMode } from "../auth-form/AuthForm";
3
3
  export interface AuthCredentials {
4
4
  email: string;
5
5
  password: string;
6
+ identifier?: string;
7
+ fields?: Record<string, string>;
8
+ }
9
+ export interface AuthAdditionalField {
10
+ name: string;
11
+ label: string;
12
+ type?: "text" | "email";
13
+ placeholder?: string;
14
+ autoComplete?: string;
15
+ required?: boolean;
16
+ minLength?: number;
17
+ maxLength?: number;
18
+ }
19
+ export interface AuthIdentifierOptions {
20
+ label?: string;
21
+ type?: "text" | "email";
22
+ placeholder?: string;
23
+ autoComplete?: string;
24
+ maxLength?: number;
6
25
  }
7
26
  export interface AuthPageProps {
8
27
  /** Brand/logo above the form. */
@@ -12,6 +31,15 @@ export interface AuthPageProps {
12
31
  signUpTitle?: string;
13
32
  signInSubtitle?: string;
14
33
  signUpSubtitle?: string;
34
+ signInIdentifier?: AuthIdentifierOptions;
35
+ signUpFields?: AuthAdditionalField[];
36
+ /** Optional confirmation field; defaults to true. */
37
+ requirePasswordConfirmation?: boolean;
38
+ /** An app-supplied session verification error. */
39
+ initialError?: string;
40
+ footer?: React.ReactNode;
41
+ minSignInPasswordLength?: number;
42
+ passwordMaxLength?: number;
15
43
  /** Initial tab; changes to this prop after mount do not reset the selected tab. */
16
44
  defaultMode?: AuthMode;
17
45
  /** Optional controlled tab, e.g. when sign-in and sign-up use separate routes. */
@@ -42,5 +70,5 @@ export interface AuthPageProps {
42
70
  * Complete app-neutral authentication UX. Uzi owns UI state and validation;
43
71
  * the consuming application owns credentials, sessions, API calls and redirects.
44
72
  */
45
- export declare function AuthPage({ brand, signInTitle, signUpTitle, signInSubtitle, signUpSubtitle, defaultMode, mode: controlledMode, onModeChange, onSignIn, onSignUp, onError, initialEmail, disabled, minPasswordLength, signUpOptions, forgotPasswordHref, className, layout, }: AuthPageProps): import("react/jsx-runtime").JSX.Element;
73
+ export declare function AuthPage({ brand, signInTitle, signUpTitle, signInSubtitle, signUpSubtitle, signInIdentifier, signUpFields, requirePasswordConfirmation, initialError, footer, minSignInPasswordLength, passwordMaxLength, defaultMode, mode: controlledMode, onModeChange, onSignIn, onSignUp, onError, initialEmail, disabled, minPasswordLength, signUpOptions, forgotPasswordHref, className, layout, }: AuthPageProps): import("react/jsx-runtime").JSX.Element;
46
74
  //# sourceMappingURL=AuthPage.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AuthPage.d.ts","sourceRoot":"","sources":["../../../src/components/auth-page/AuthPage.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAuC,KAAK,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAK3F,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,aAAa;IAC5B,iCAAiC;IACjC,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,2BAA2B;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,mFAAmF;IACnF,WAAW,CAAC,EAAE,QAAQ,CAAC;IACvB,kFAAkF;IAClF,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,QAAQ,KAAK,IAAI,CAAC;IACxC,iFAAiF;IACjF,QAAQ,CAAC,EAAE,CAAC,WAAW,EAAE,eAAe,KAAK,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;IACxE,QAAQ,CAAC,EAAE,CAAC,WAAW,EAAE,eAAe,KAAK,OAAO,CAAC,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lf"}
package/dist/index.d.ts CHANGED
@@ -59,7 +59,7 @@ export type { SelectProps, SelectOption } from "./components/select/Select";
59
59
  export { Select } from "./components/select/Select";
60
60
  export type { SegmentedToggleProps, SegmentedToggleOption } from "./components/segmented-toggle/SegmentedToggle";
61
61
  export { SegmentedToggle } from "./components/segmented-toggle/SegmentedToggle";
62
- export type { AuthPageProps, AuthCredentials } from "./components/auth-page/AuthPage";
62
+ export type { AuthPageProps, AuthCredentials, AuthAdditionalField, AuthIdentifierOptions } from "./components/auth-page/AuthPage";
63
63
  export { AuthPage } from "./components/auth-page/AuthPage";
64
64
  export type { AuthFormProps, AuthFieldProps, AuthMode, AuthModeSwitchProps } from "./components/auth-form/AuthForm";
65
65
  export { AuthForm, AuthField, AuthModeSwitch } from "./components/auth-form/AuthForm";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,mBAAmB,CAAC;AAG3B,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACzF,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAEpD,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAC1E,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAEjF,YAAY,EAAE,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAC/E,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAE9C,YAAY,EACV,YAAY,EACZ,cAAc,EACd,YAAY,EACZ,aAAa,GACd,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AAEvD,YAAY,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAC5E,OAAO,EAAE,IAA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,OAAO,EAAE,cAAc,EAAE,MAAM,8CAA8C,CAAC;AAG9E,YAAY,EACV,WAAW,EACX,aAAa,EACb,eAAe,EACf,uBAAuB,EACvB,wBAAwB,EACxB,oBAAoB,EACpB,yBAAyB,EACzB,uBAAuB,EACvB,gBAAgB,EAChB,0BAA0B,EAC1B,4BAA4B,EAC5B,YAAY,EACZ,yBAAyB,EACzB,uBAAuB,EACvB,wBAAwB,GACzB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AACtF,YAAY,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AAC5E,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC7D,YAAY,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAEvE,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,wDAAwD,CAAC;AACnH,YAAY,EAAE,wBAAwB,EAAE,yBAAyB,EAAE,MAAM,wDAAwD,CAAC"}
package/dist/index68.js CHANGED
@@ -10,26 +10,39 @@ import { jsx, jsxs } from "react/jsx-runtime";
10
10
  * Complete app-neutral authentication UX. Uzi owns UI state and validation;
11
11
  * the consuming application owns credentials, sessions, API calls and redirects.
12
12
  */
13
- function AuthPage({ brand, signInTitle = "Welcome back", signUpTitle = "Create your account", signInSubtitle, signUpSubtitle, defaultMode = "signin", mode: controlledMode, onModeChange, onSignIn, onSignUp, onError, initialEmail = "", disabled = false, minPasswordLength = 8, signUpOptions, forgotPasswordHref, className, layout = "fullscreen" }) {
13
+ function AuthPage({ brand, signInTitle = "Welcome back", signUpTitle = "Create your account", signInSubtitle, signUpSubtitle, signInIdentifier, signUpFields = [], requirePasswordConfirmation = true, initialError, footer, minSignInPasswordLength = 0, passwordMaxLength, defaultMode = "signin", mode: controlledMode, onModeChange, onSignIn, onSignUp, onError, initialEmail = "", disabled = false, minPasswordLength = 8, signUpOptions, forgotPasswordHref, className, layout = "fullscreen" }) {
14
14
  const [internalMode, setInternalMode] = React.useState(defaultMode);
15
15
  const mode = controlledMode ?? internalMode;
16
16
  const [email, setEmail] = React.useState(initialEmail);
17
17
  const [password, setPassword] = React.useState("");
18
- const [confirmPassword, setConfirmPassword] = React.useState("");
18
+ const [confirmPasswordValue, setConfirmPassword] = React.useState("");
19
+ const [extraValues, setExtraValues] = React.useState({});
19
20
  const [acceptedTerms, setAcceptedTerms] = React.useState(false);
20
21
  const [showPassword, setShowPassword] = React.useState(false);
21
22
  const [pending, setPending] = React.useState(false);
22
23
  const pendingRef = React.useRef(false);
23
24
  const [errors, setErrors] = React.useState({});
24
- const [serverError, setServerError] = React.useState("");
25
+ const [serverError, setServerError] = React.useState(initialError ?? "");
25
26
  const id = React.useId();
26
27
  const emailId = id + "-email";
27
28
  const passwordId = id + "-password";
28
29
  const confirmId = id + "-confirm";
29
30
  const termsId = id + "-terms";
30
31
  const signup = mode === "signup";
32
+ const identifierIsEmail = signup || (signInIdentifier?.type ?? "email") === "email";
31
33
  const termsRequired = signup && !!signUpOptions?.requireTerms;
32
34
  const canSwitch = !!onModeChange || !!onSignIn && !!onSignUp;
35
+ const fieldNames = signUpFields.map((field) => field.name).join("\\u0000");
36
+ React.useEffect(() => {
37
+ const activeNames = new Set(fieldNames.split("\\u0000").filter(Boolean));
38
+ setExtraValues((previous) => {
39
+ if (Object.keys(previous).every((name) => activeNames.has(name))) return previous;
40
+ return Object.fromEntries(Object.entries(previous).filter(([name]) => activeNames.has(name)));
41
+ });
42
+ }, [fieldNames]);
43
+ React.useEffect(() => {
44
+ setServerError(initialError ?? "");
45
+ }, [initialError]);
33
46
  React.useEffect(() => {
34
47
  if (initialEmail) setEmail((previous) => previous || initialEmail);
35
48
  }, [initialEmail]);
@@ -48,11 +61,21 @@ function AuthPage({ brand, signInTitle = "Welcome back", signUpTitle = "Create y
48
61
  if (pendingRef.current || disabled) return;
49
62
  const nextErrors = {};
50
63
  const normalizedEmail = email.trim();
51
- if (!normalizedEmail) nextErrors.email = "Email is required";
52
- else if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(normalizedEmail)) nextErrors.email = "Enter a valid email address";
64
+ if (!normalizedEmail) nextErrors.email = (signup ? "Email" : signInIdentifier?.label ?? "Email") + " is required";
65
+ else if (identifierIsEmail && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(normalizedEmail)) nextErrors.email = "Enter a valid email address";
66
+ if (!signup && signInIdentifier?.maxLength && normalizedEmail.length > signInIdentifier.maxLength) nextErrors.email = "Identifier is too long";
53
67
  if (!password) nextErrors.password = "Password is required";
54
68
  else if (signup && password.length < minPasswordLength) nextErrors.password = `Use at least ${minPasswordLength} characters`;
55
- if (signup && password !== confirmPassword) nextErrors.confirm = "Passwords do not match";
69
+ if (signup && requirePasswordConfirmation && password !== confirmPasswordValue) nextErrors.confirm = "Passwords do not match";
70
+ if (!signup && minSignInPasswordLength && password.length < minSignInPasswordLength) nextErrors.password = `Use at least ${minSignInPasswordLength} characters`;
71
+ if (passwordMaxLength && password.length > passwordMaxLength) nextErrors.password = "Password is too long";
72
+ if (signup) for (const field of signUpFields) {
73
+ const value = (extraValues[field.name] ?? "").trim();
74
+ if (field.required && !value) nextErrors[field.name] = field.label + " is required";
75
+ else if (value && field.minLength && value.length < field.minLength) nextErrors[field.name] = field.label + " is too short";
76
+ else if (field.maxLength && value.length > field.maxLength) nextErrors[field.name] = field.label + " is too long";
77
+ else if (field.type === "email" && value && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value)) nextErrors[field.name] = "Enter a valid email address";
78
+ }
56
79
  if (termsRequired && !acceptedTerms) nextErrors.terms = "Accept the terms to continue";
57
80
  setErrors(nextErrors);
58
81
  setServerError("");
@@ -64,6 +87,8 @@ function AuthPage({ brand, signInTitle = "Welcome back", signUpTitle = "Create y
64
87
  email: normalizedEmail,
65
88
  password
66
89
  };
90
+ if (!signup && signInIdentifier) credentials.identifier = normalizedEmail;
91
+ if (signup && signUpFields.length) credentials.fields = Object.fromEntries(signUpFields.map((field) => [field.name, (extraValues[field.name] ?? "").trim()]));
67
92
  if (signup) {
68
93
  if (!onSignUp) return;
69
94
  await onSignUp(credentials);
@@ -73,6 +98,7 @@ function AuthPage({ brand, signInTitle = "Welcome back", signUpTitle = "Create y
73
98
  }
74
99
  setPassword("");
75
100
  setConfirmPassword("");
101
+ setExtraValues({});
76
102
  } catch (error) {
77
103
  setServerError(error instanceof Error && error.message ? error.message : "Unable to complete the request. Try again.");
78
104
  onError?.(error, mode);
@@ -87,6 +113,7 @@ function AuthPage({ brand, signInTitle = "Welcome back", signUpTitle = "Create y
87
113
  brand,
88
114
  title: signup ? signUpTitle : signInTitle,
89
115
  subtitle: signup ? signUpSubtitle : signInSubtitle,
116
+ footer,
90
117
  children: [canSwitch && /* @__PURE__ */ jsx(AuthModeSwitch, {
91
118
  mode,
92
119
  onModeChange: switchMode
@@ -97,14 +124,15 @@ function AuthPage({ brand, signInTitle = "Welcome back", signUpTitle = "Create y
97
124
  children: [
98
125
  /* @__PURE__ */ jsx(AuthField, {
99
126
  htmlFor: emailId,
100
- label: "Email",
127
+ label: signup ? "Email" : signInIdentifier?.label ?? "Email",
101
128
  error: errors.email,
102
129
  children: /* @__PURE__ */ jsx(Input, {
103
130
  id: emailId,
104
- type: "email",
105
- placeholder: "you@example.com",
131
+ type: signup ? "email" : signInIdentifier?.type ?? "email",
132
+ placeholder: signup ? "you@example.com" : signInIdentifier?.placeholder ?? "you@example.com",
106
133
  value: email,
107
- autoComplete: "email",
134
+ autoComplete: signup ? "email" : signInIdentifier?.autoComplete ?? "email",
135
+ maxLength: signup ? 254 : signInIdentifier?.maxLength,
108
136
  required: true,
109
137
  disabled: disabled || pending,
110
138
  "aria-invalid": !!errors.email,
@@ -130,6 +158,7 @@ function AuthPage({ brand, signInTitle = "Welcome back", signUpTitle = "Create y
130
158
  placeholder: signup ? "At least " + minPasswordLength + " characters" : "Enter your password",
131
159
  value: password,
132
160
  required: true,
161
+ maxLength: passwordMaxLength,
133
162
  disabled: disabled || pending,
134
163
  autoComplete: signup ? "new-password" : "current-password",
135
164
  "aria-invalid": !!errors.password,
@@ -153,7 +182,7 @@ function AuthPage({ brand, signInTitle = "Welcome back", signUpTitle = "Create y
153
182
  })]
154
183
  })
155
184
  }),
156
- signup && /* @__PURE__ */ jsx(AuthField, {
185
+ signup && requirePasswordConfirmation && /* @__PURE__ */ jsx(AuthField, {
157
186
  htmlFor: confirmId,
158
187
  label: "Confirm password",
159
188
  error: errors.confirm,
@@ -161,7 +190,7 @@ function AuthPage({ brand, signInTitle = "Welcome back", signUpTitle = "Create y
161
190
  id: confirmId,
162
191
  type: "password",
163
192
  placeholder: "Re-enter password",
164
- value: confirmPassword,
193
+ value: confirmPasswordValue,
165
194
  autoComplete: "new-password",
166
195
  required: true,
167
196
  disabled: disabled || pending,
@@ -176,6 +205,37 @@ function AuthPage({ brand, signInTitle = "Welcome back", signUpTitle = "Create y
176
205
  }
177
206
  })
178
207
  }),
208
+ signup && signUpFields.map((field) => {
209
+ const fieldId = id + "-" + field.name;
210
+ return /* @__PURE__ */ jsx(AuthField, {
211
+ htmlFor: fieldId,
212
+ label: field.label,
213
+ error: errors[field.name],
214
+ children: /* @__PURE__ */ jsx(Input, {
215
+ id: fieldId,
216
+ type: field.type ?? "text",
217
+ value: extraValues[field.name] ?? "",
218
+ placeholder: field.placeholder,
219
+ autoComplete: field.autoComplete,
220
+ required: field.required,
221
+ minLength: field.minLength,
222
+ maxLength: field.maxLength,
223
+ disabled: disabled || pending,
224
+ "aria-invalid": !!errors[field.name],
225
+ "aria-describedby": errors[field.name] ? fieldId + "-error" : void 0,
226
+ onChange: (event) => {
227
+ setExtraValues((old) => ({
228
+ ...old,
229
+ [field.name]: event.target.value
230
+ }));
231
+ setErrors((old) => ({
232
+ ...old,
233
+ [field.name]: ""
234
+ }));
235
+ }
236
+ })
237
+ }, field.name);
238
+ }),
179
239
  termsRequired && /* @__PURE__ */ jsxs("div", {
180
240
  className: auth_page_module_default.terms,
181
241
  children: [/* @__PURE__ */ jsxs("label", {
@@ -1 +1 @@
1
- {"version":3,"file":"index68.js","names":[],"sources":["../src/components/auth-page/AuthPage.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { AuthCard } from \"../auth-card/AuthCard\";\nimport { AuthField, AuthForm, AuthModeSwitch, type AuthMode } from \"../auth-form/AuthForm\";\nimport { Input } from \"../input/Input\";\nimport { Button } from \"../button/Button\";\nimport styles from \"./auth-page.module.css\";\n\nexport interface AuthCredentials {\n email: string;\n password: string;\n}\n\nexport interface AuthPageProps {\n /** Brand/logo above the form. */\n brand?: React.ReactNode;\n /** Title for each mode. */\n signInTitle?: string;\n signUpTitle?: string;\n signInSubtitle?: string;\n signUpSubtitle?: string;\n /** Initial tab; changes to this prop after mount do not reset the selected tab. */\n defaultMode?: AuthMode;\n /** Optional controlled tab, e.g. when sign-in and sign-up use separate routes. */\n mode?: AuthMode;\n onModeChange?: (mode: AuthMode) => void;\n /** App-specific auth callbacks; throwing an Error displays an inline failure. */\n onSignIn?: (credentials: AuthCredentials) => Promise<unknown> | unknown;\n onSignUp?: (credentials: AuthCredentials) => Promise<unknown> | unknown;\n onError?: (error: unknown, mode: AuthMode) => void;\n /** Prefill email without ever populating a password. */\n initialEmail?: string;\n /** Prevent submission until the app's authentication provider is ready. */\n disabled?: boolean;\n /** Minimum password length for account creation; default 8. */\n minPasswordLength?: number;\n /** Optional terms requirement for sign-up only. */\n signUpOptions?: {\n requireTerms?: boolean;\n termsHref?: string;\n termsLabel?: string;\n };\n /** Optional app-owned password recovery route. */\n forgotPasswordHref?: string;\n className?: string;\n layout?: \"fullscreen\" | \"embedded\";\n}\n\n/**\n * Complete app-neutral authentication UX. Uzi owns UI state and validation;\n * the consuming application owns credentials, sessions, API calls and redirects.\n */\nexport function AuthPage({\n brand,\n signInTitle = \"Welcome back\",\n signUpTitle = \"Create your account\",\n signInSubtitle,\n signUpSubtitle,\n defaultMode = \"signin\",\n mode: controlledMode,\n onModeChange,\n onSignIn,\n onSignUp,\n onError,\n initialEmail = \"\",\n disabled = false,\n minPasswordLength = 8,\n signUpOptions,\n forgotPasswordHref,\n className,\n layout = \"fullscreen\",\n}: AuthPageProps) {\n const [internalMode, setInternalMode] = React.useState<AuthMode>(defaultMode);\n const mode = controlledMode ?? internalMode;\n const [email, setEmail] = React.useState(initialEmail);\n const [password, setPassword] = React.useState(\"\");\n const [confirmPassword, setConfirmPassword] = React.useState(\"\");\n const [acceptedTerms, setAcceptedTerms] = React.useState(false);\n const [showPassword, setShowPassword] = React.useState(false);\n const [pending, setPending] = React.useState(false);\n const pendingRef = React.useRef(false);\n const [errors, setErrors] = React.useState<Record<string, string>>({});\n const [serverError, setServerError] = React.useState(\"\");\n const id = React.useId();\n const emailId = id + \"-email\";\n const passwordId = id + \"-password\";\n const confirmId = id + \"-confirm\";\n const termsId = id + \"-terms\";\n const signup = mode === \"signup\";\n const termsRequired = signup && !!signUpOptions?.requireTerms;\n const canSwitch = !!onModeChange || (!!onSignIn && !!onSignUp);\n\n React.useEffect(() => {\n // Changes from an authenticated account may prefill the email after hydration.\n if (initialEmail) setEmail((previous) => previous || initialEmail);\n }, [initialEmail]);\n\n const switchMode = (next: AuthMode) => {\n if (pendingRef.current || next === mode) return;\n setInternalMode(next);\n setPassword(\"\");\n setConfirmPassword(\"\");\n setShowPassword(false);\n setErrors({});\n setServerError(\"\");\n onModeChange?.(next);\n };\n\n const submit = async (event: React.FormEvent<HTMLFormElement>) => {\n event.preventDefault();\n if (pendingRef.current || disabled) return;\n const nextErrors: Record<string, string> = {};\n const normalizedEmail = email.trim();\n if (!normalizedEmail) nextErrors.email = \"Email is required\";\n else if (!/^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test(normalizedEmail)) nextErrors.email = \"Enter a valid email address\";\n if (!password) nextErrors.password = \"Password is required\";\n else if (signup && password.length < minPasswordLength) nextErrors.password = `Use at least ${minPasswordLength} characters`;\n if (signup && password !== confirmPassword) nextErrors.confirm = \"Passwords do not match\";\n if (termsRequired && !acceptedTerms) nextErrors.terms = \"Accept the terms to continue\";\n setErrors(nextErrors);\n setServerError(\"\");\n if (Object.keys(nextErrors).length) return;\n\n pendingRef.current = true;\n setPending(true);\n try {\n const credentials = { email: normalizedEmail, password };\n if (signup) {\n if (!onSignUp) return;\n await onSignUp(credentials);\n } else {\n if (!onSignIn) return;\n await onSignIn(credentials);\n }\n setPassword(\"\");\n setConfirmPassword(\"\");\n } catch (error) {\n setServerError(error instanceof Error && error.message ? error.message : \"Unable to complete the request. Try again.\");\n onError?.(error, mode);\n } finally {\n pendingRef.current = false;\n setPending(false);\n }\n };\n\n return (\n <AuthCard\n className={className}\n layout={layout}\n brand={brand}\n title={signup ? signUpTitle : signInTitle}\n subtitle={signup ? signUpSubtitle : signInSubtitle}\n >\n {canSwitch && <AuthModeSwitch mode={mode} onModeChange={switchMode} />}\n <AuthForm onSubmit={submit} noValidate aria-busy={pending}>\n <AuthField htmlFor={emailId} label=\"Email\" error={errors.email}>\n <Input\n id={emailId} type=\"email\" placeholder=\"you@example.com\" value={email}\n autoComplete=\"email\" required disabled={disabled || pending}\n aria-invalid={!!errors.email} aria-describedby={errors.email ? emailId + \"-error\" : undefined}\n onChange={(event) => { setEmail(event.target.value); setErrors((old) => ({ ...old, email: \"\" })); }}\n />\n </AuthField>\n <AuthField htmlFor={passwordId} label=\"Password\" error={errors.password}>\n <div className={styles.passwordRow}>\n <Input\n id={passwordId} type={showPassword ? \"text\" : \"password\"}\n placeholder={signup ? \"At least \" + minPasswordLength + \" characters\" : \"Enter your password\"}\n value={password} required disabled={disabled || pending}\n autoComplete={signup ? \"new-password\" : \"current-password\"}\n aria-invalid={!!errors.password} aria-describedby={errors.password ? passwordId + \"-error\" : undefined}\n onChange={(event) => { setPassword(event.target.value); setErrors((old) => ({ ...old, password: \"\" })); }}\n />\n <button type=\"button\" className={styles.visibility} disabled={disabled || pending}\n aria-label={showPassword ? \"Hide password\" : \"Show password\"}\n aria-controls={passwordId} aria-pressed={showPassword}\n onClick={() => setShowPassword((old) => !old)}>\n {showPassword ? \"Hide\" : \"Show\"}\n </button>\n </div>\n </AuthField>\n {signup && (\n <AuthField htmlFor={confirmId} label=\"Confirm password\" error={errors.confirm}>\n <Input id={confirmId} type=\"password\" placeholder=\"Re-enter password\" value={confirmPassword}\n autoComplete=\"new-password\" required disabled={disabled || pending}\n aria-invalid={!!errors.confirm} aria-describedby={errors.confirm ? confirmId + \"-error\" : undefined}\n onChange={(event) => { setConfirmPassword(event.target.value); setErrors((old) => ({ ...old, confirm: \"\" })); }} />\n </AuthField>\n )}\n {termsRequired && (\n <div className={styles.terms}>\n <label htmlFor={termsId} className={styles.termsLabel}>\n <input id={termsId} type=\"checkbox\" checked={acceptedTerms} disabled={disabled || pending}\n aria-invalid={!!errors.terms} aria-describedby={errors.terms ? termsId + \"-error\" : undefined}\n onChange={(event) => { setAcceptedTerms(event.target.checked); setErrors((old) => ({ ...old, terms: \"\" })); }} />\n <span>{signUpOptions?.termsLabel ?? \"I agree to the \"}\n {signUpOptions?.termsHref ? <a href={signUpOptions.termsHref}>Terms of Service</a> : \"Terms of Service\"}\n </span>\n </label>\n {errors.terms && <p className={styles.error} id={termsId + \"-error\"} role=\"alert\">{errors.terms}</p>}\n </div>\n )}\n {!signup && forgotPasswordHref && <a className={styles.forgot} href={forgotPasswordHref}>Forgot password?</a>}\n {serverError && <p className={styles.error} role=\"alert\">{serverError}</p>}\n {!(signup ? onSignUp : onSignIn) && (\n <p className={styles.error} role=\"status\">\n {signup ? \"Sign-up is not available.\" : \"Sign-in is not available.\"}\n </p>\n )}\n <Button type=\"submit\" variant=\"primary\" size=\"lg\" disabled={disabled || pending || (signup ? !onSignUp : !onSignIn)}>\n {pending ? (signup ? \"Creating account...\" : \"Signing in...\") : (signup ? \"Create account\" : \"Sign in\")}\n </Button>\n </AuthForm>\n </AuthCard>\n );\n}\n"],"mappings":";;;;;;;;;;;;AAmDA,SAAgB,SAAS,EAC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AAA;GACA;IACF;;AAEd"}
1
+ {"version":3,"file":"index68.js","names":[],"sources":["../src/components/auth-page/AuthPage.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { AuthCard } from \"../auth-card/AuthCard\";\nimport { AuthField, AuthForm, AuthModeSwitch, type AuthMode } from \"../auth-form/AuthForm\";\nimport { Input } from \"../input/Input\";\nimport { Button } from \"../button/Button\";\nimport styles from \"./auth-page.module.css\";\n\nexport interface AuthCredentials {\n email: string;\n password: string;\n identifier?: string;\n fields?: Record<string, string>;\n}\n\nexport interface AuthAdditionalField {\n name: string;\n label: string;\n type?: \"text\" | \"email\";\n placeholder?: string;\n autoComplete?: string;\n required?: boolean;\n minLength?: number;\n maxLength?: number;\n}\n\nexport interface AuthIdentifierOptions {\n label?: string;\n type?: \"text\" | \"email\";\n placeholder?: string;\n autoComplete?: string;\n maxLength?: number;\n}\n\nexport interface AuthPageProps {\n /** Brand/logo above the form. */\n brand?: React.ReactNode;\n /** Title for each mode. */\n signInTitle?: string;\n signUpTitle?: string;\n signInSubtitle?: string;\n signUpSubtitle?: string;\n signInIdentifier?: AuthIdentifierOptions;\n signUpFields?: AuthAdditionalField[];\n /** Optional confirmation field; defaults to true. */\n requirePasswordConfirmation?: boolean;\n /** An app-supplied session verification error. */\n initialError?: string;\n footer?: React.ReactNode;\n minSignInPasswordLength?: number;\n passwordMaxLength?: number;\n /** Initial tab; changes to this prop after mount do not reset the selected tab. */\n defaultMode?: AuthMode;\n /** Optional controlled tab, e.g. when sign-in and sign-up use separate routes. */\n mode?: AuthMode;\n onModeChange?: (mode: AuthMode) => void;\n /** App-specific auth callbacks; throwing an Error displays an inline failure. */\n onSignIn?: (credentials: AuthCredentials) => Promise<unknown> | unknown;\n onSignUp?: (credentials: AuthCredentials) => Promise<unknown> | unknown;\n onError?: (error: unknown, mode: AuthMode) => void;\n /** Prefill email without ever populating a password. */\n initialEmail?: string;\n /** Prevent submission until the app's authentication provider is ready. */\n disabled?: boolean;\n /** Minimum password length for account creation; default 8. */\n minPasswordLength?: number;\n /** Optional terms requirement for sign-up only. */\n signUpOptions?: {\n requireTerms?: boolean;\n termsHref?: string;\n termsLabel?: string;\n };\n /** Optional app-owned password recovery route. */\n forgotPasswordHref?: string;\n className?: string;\n layout?: \"fullscreen\" | \"embedded\";\n}\n\n/**\n * Complete app-neutral authentication UX. Uzi owns UI state and validation;\n * the consuming application owns credentials, sessions, API calls and redirects.\n */\nexport function AuthPage({\n brand,\n signInTitle = \"Welcome back\",\n signUpTitle = \"Create your account\",\n signInSubtitle,\n signUpSubtitle,\n signInIdentifier,\n signUpFields = [],\n requirePasswordConfirmation = true,\n initialError,\n footer,\n minSignInPasswordLength = 0,\n passwordMaxLength,\n defaultMode = \"signin\",\n mode: controlledMode,\n onModeChange,\n onSignIn,\n onSignUp,\n onError,\n initialEmail = \"\",\n disabled = false,\n minPasswordLength = 8,\n signUpOptions,\n forgotPasswordHref,\n className,\n layout = \"fullscreen\",\n}: AuthPageProps) {\n const [internalMode, setInternalMode] = React.useState<AuthMode>(defaultMode);\n const mode = controlledMode ?? internalMode;\n const [email, setEmail] = React.useState(initialEmail);\n const [password, setPassword] = React.useState(\"\");\n const [confirmPasswordValue, setConfirmPassword] = React.useState(\"\");\n const [extraValues, setExtraValues] = React.useState<Record<string, string>>({});\n const [acceptedTerms, setAcceptedTerms] = React.useState(false);\n const [showPassword, setShowPassword] = React.useState(false);\n const [pending, setPending] = React.useState(false);\n const pendingRef = React.useRef(false);\n const [errors, setErrors] = React.useState<Record<string, string>>({});\n const [serverError, setServerError] = React.useState(initialError ?? \"\");\n const id = React.useId();\n const emailId = id + \"-email\";\n const passwordId = id + \"-password\";\n const confirmId = id + \"-confirm\";\n const termsId = id + \"-terms\";\n const signup = mode === \"signup\";\n const identifierIsEmail = signup || (signInIdentifier?.type ?? \"email\") === \"email\";\n const termsRequired = signup && !!signUpOptions?.requireTerms;\n const canSwitch = !!onModeChange || (!!onSignIn && !!onSignUp);\n\n const fieldNames = signUpFields.map((field) => field.name).join(\"\\\\u0000\");\n React.useEffect(() => {\n const activeNames = new Set(fieldNames.split(\"\\\\u0000\").filter(Boolean));\n setExtraValues((previous) => {\n if (Object.keys(previous).every((name) => activeNames.has(name))) return previous;\n return Object.fromEntries(Object.entries(previous).filter(([name]) => activeNames.has(name)));\n });\n }, [fieldNames]);\n\n React.useEffect(() => { setServerError(initialError ?? \"\"); }, [initialError]);\n\n React.useEffect(() => {\n // Changes from an authenticated account may prefill the email after hydration.\n if (initialEmail) setEmail((previous) => previous || initialEmail);\n }, [initialEmail]);\n\n const switchMode = (next: AuthMode) => {\n if (pendingRef.current || next === mode) return;\n setInternalMode(next);\n setPassword(\"\");\n setConfirmPassword(\"\");\n setShowPassword(false);\n setErrors({});\n setServerError(\"\");\n onModeChange?.(next);\n };\n\n const submit = async (event: React.FormEvent<HTMLFormElement>) => {\n event.preventDefault();\n if (pendingRef.current || disabled) return;\n const nextErrors: Record<string, string> = {};\n const normalizedEmail = email.trim();\n if (!normalizedEmail) nextErrors.email = (signup ? \"Email\" : signInIdentifier?.label ?? \"Email\") + \" is required\";\n else if (identifierIsEmail && !/^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test(normalizedEmail)) nextErrors.email = \"Enter a valid email address\";\n if (!signup && signInIdentifier?.maxLength && normalizedEmail.length > signInIdentifier.maxLength) nextErrors.email = \"Identifier is too long\";\n if (!password) nextErrors.password = \"Password is required\";\n else if (signup && password.length < minPasswordLength) nextErrors.password = `Use at least ${minPasswordLength} characters`;\n if (signup && requirePasswordConfirmation && password !== confirmPasswordValue) nextErrors.confirm = \"Passwords do not match\";\n if (!signup && minSignInPasswordLength && password.length < minSignInPasswordLength) nextErrors.password = `Use at least ${minSignInPasswordLength} characters`;\n if (passwordMaxLength && password.length > passwordMaxLength) nextErrors.password = \"Password is too long\";\n if (signup) {\n for (const field of signUpFields) {\n const value = (extraValues[field.name] ?? \"\").trim();\n if (field.required && !value) nextErrors[field.name] = field.label + \" is required\";\n else if (value && field.minLength && value.length < field.minLength) nextErrors[field.name] = field.label + \" is too short\";\n else if (field.maxLength && value.length > field.maxLength) nextErrors[field.name] = field.label + \" is too long\";\n else if (field.type === \"email\" && value && !/^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test(value)) nextErrors[field.name] = \"Enter a valid email address\";\n }\n }\n if (termsRequired && !acceptedTerms) nextErrors.terms = \"Accept the terms to continue\";\n setErrors(nextErrors);\n setServerError(\"\");\n if (Object.keys(nextErrors).length) return;\n\n pendingRef.current = true;\n setPending(true);\n try {\n const credentials: AuthCredentials = { email: normalizedEmail, password };\n if (!signup && signInIdentifier) credentials.identifier = normalizedEmail;\n if (signup && signUpFields.length) {\n credentials.fields = Object.fromEntries(signUpFields.map((field) => [field.name, (extraValues[field.name] ?? \"\").trim()]));\n }\n if (signup) {\n if (!onSignUp) return;\n await onSignUp(credentials);\n } else {\n if (!onSignIn) return;\n await onSignIn(credentials);\n }\n setPassword(\"\");\n setConfirmPassword(\"\");\n setExtraValues({});\n } catch (error) {\n setServerError(error instanceof Error && error.message ? error.message : \"Unable to complete the request. Try again.\");\n onError?.(error, mode);\n } finally {\n pendingRef.current = false;\n setPending(false);\n }\n };\n\n return (\n <AuthCard\n className={className}\n layout={layout}\n brand={brand}\n title={signup ? signUpTitle : signInTitle}\n subtitle={signup ? signUpSubtitle : signInSubtitle}\n footer={footer}\n >\n {canSwitch && <AuthModeSwitch mode={mode} onModeChange={switchMode} />}\n <AuthForm onSubmit={submit} noValidate aria-busy={pending}>\n <AuthField htmlFor={emailId} label={signup ? \"Email\" : signInIdentifier?.label ?? \"Email\"} error={errors.email}>\n <Input\n id={emailId} type={signup ? \"email\" : signInIdentifier?.type ?? \"email\"} placeholder={signup ? \"you@example.com\" : signInIdentifier?.placeholder ?? \"you@example.com\"} value={email}\n autoComplete={signup ? \"email\" : signInIdentifier?.autoComplete ?? \"email\"} maxLength={signup ? 254 : signInIdentifier?.maxLength} required disabled={disabled || pending}\n aria-invalid={!!errors.email} aria-describedby={errors.email ? emailId + \"-error\" : undefined}\n onChange={(event) => { setEmail(event.target.value); setErrors((old) => ({ ...old, email: \"\" })); }}\n />\n </AuthField>\n <AuthField htmlFor={passwordId} label=\"Password\" error={errors.password}>\n <div className={styles.passwordRow}>\n <Input\n id={passwordId} type={showPassword ? \"text\" : \"password\"}\n placeholder={signup ? \"At least \" + minPasswordLength + \" characters\" : \"Enter your password\"}\n value={password} required maxLength={passwordMaxLength} disabled={disabled || pending}\n autoComplete={signup ? \"new-password\" : \"current-password\"}\n aria-invalid={!!errors.password} aria-describedby={errors.password ? passwordId + \"-error\" : undefined}\n onChange={(event) => { setPassword(event.target.value); setErrors((old) => ({ ...old, password: \"\" })); }}\n />\n <button type=\"button\" className={styles.visibility} disabled={disabled || pending}\n aria-label={showPassword ? \"Hide password\" : \"Show password\"}\n aria-controls={passwordId} aria-pressed={showPassword}\n onClick={() => setShowPassword((old) => !old)}>\n {showPassword ? \"Hide\" : \"Show\"}\n </button>\n </div>\n </AuthField>\n {signup && requirePasswordConfirmation && (\n <AuthField htmlFor={confirmId} label=\"Confirm password\" error={errors.confirm}>\n <Input id={confirmId} type=\"password\" placeholder=\"Re-enter password\" value={confirmPasswordValue}\n autoComplete=\"new-password\" required disabled={disabled || pending}\n aria-invalid={!!errors.confirm} aria-describedby={errors.confirm ? confirmId + \"-error\" : undefined}\n onChange={(event) => { setConfirmPassword(event.target.value); setErrors((old) => ({ ...old, confirm: \"\" })); }} />\n </AuthField>\n )}\n {signup && signUpFields.map((field) => {\n const fieldId = id + \"-\" + field.name;\n return (\n <AuthField key={field.name} htmlFor={fieldId} label={field.label} error={errors[field.name]}>\n <Input id={fieldId} type={field.type ?? \"text\"} value={extraValues[field.name] ?? \"\"}\n placeholder={field.placeholder} autoComplete={field.autoComplete} required={field.required}\n minLength={field.minLength} maxLength={field.maxLength} disabled={disabled || pending}\n aria-invalid={!!errors[field.name]} aria-describedby={errors[field.name] ? fieldId + \"-error\" : undefined}\n onChange={(event) => { setExtraValues((old) => ({ ...old, [field.name]: event.target.value })); setErrors((old) => ({ ...old, [field.name]: \"\" })); }} />\n </AuthField>\n );\n })}\n {termsRequired && (\n <div className={styles.terms}>\n <label htmlFor={termsId} className={styles.termsLabel}>\n <input id={termsId} type=\"checkbox\" checked={acceptedTerms} disabled={disabled || pending}\n aria-invalid={!!errors.terms} aria-describedby={errors.terms ? termsId + \"-error\" : undefined}\n onChange={(event) => { setAcceptedTerms(event.target.checked); setErrors((old) => ({ ...old, terms: \"\" })); }} />\n <span>{signUpOptions?.termsLabel ?? \"I agree to the \"}\n {signUpOptions?.termsHref ? <a href={signUpOptions.termsHref}>Terms of Service</a> : \"Terms of Service\"}\n </span>\n </label>\n {errors.terms && <p className={styles.error} id={termsId + \"-error\"} role=\"alert\">{errors.terms}</p>}\n </div>\n )}\n {!signup && forgotPasswordHref && <a className={styles.forgot} href={forgotPasswordHref}>Forgot password?</a>}\n {serverError && <p className={styles.error} role=\"alert\">{serverError}</p>}\n {!(signup ? onSignUp : onSignIn) && (\n <p className={styles.error} role=\"status\">\n {signup ? \"Sign-up is not available.\" : \"Sign-in is not available.\"}\n </p>\n )}\n <Button type=\"submit\" variant=\"primary\" size=\"lg\" disabled={disabled || pending || (signup ? !onSignUp : !onSignIn)}>\n {pending ? (signup ? \"Creating account...\" : \"Signing in...\") : (signup ? \"Create account\" : \"Sign in\")}\n </Button>\n </AuthForm>\n </AuthCard>\n );\n}\n"],"mappings":";;;;;;;;;;;;AAiFA,SAAgB,SAAS,EACvB,OACA,cAAc,gBACd,cAAc,uBACd,gBACA,gBACA,kBACA,eAAe,CAAC,GAChB,8BAA8B,MAC9B,cACA,QACA,0BAA0B,GAC1B,mBACA,cAAc,UACd,MAAM,gBACN,cACA,UACA,UACA,SACA,eAAe,IACf,WAAW,OACX,oBAAoB,GACpB,eACA,oBACA,WACA,SAAS,gBACO;CAChB,MAAM,CAAC,cAAc,mBAAmB,MAAM,SAAmB,WAAW;CAC5E,MAAM,OAAO,kBAAk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CAAC,OAAO;OAAO,oBAAkB,OAAO,QAAQ,UAAU,WAAW,KAAA;OACpF,WAAW,UAAU;QAAE,iBAAiB,MAAM,OAAO,OAAO;QAAG,WAAW,SAAS;SAAE,GAAG;SAAK,OAAO;QAAG,EAAE;OAAG;MAAI,CAAA,GAClH,qBAAC,QAAD,EAAA,UAAA,CAAO,eAAe,cAAc,mBACjC,eAAe,YAAY,oBAAC,KAAD;OAAG,MAAM,cAAc;iBAAW;MAAmB,CAAA,IAAI,kBACjF,EAAA,CAAA,CACD;SACN,OAAO,SAAS,oBAAC,KAAD;MAAG,WAAW,yBAAO;MAAO,IAAI,UAAU;MAAU,MAAK;gBAAS,OAAO;KAAS,CAAA,CAChG;;IAEN,CAAC,UAAU,sBAAsB,oBAAC,KAAD;KAAG,WAAW,yBAAO;KAAQ,MAAM;eAAoB;IAAmB,CAAA;IAC3G,eAAe,oBAAC,KAAD;KAAG,WAAW,yBAAO;KAAO,MAAK;eAAS;IAAe,CAAA;IACxE,EAAE,SAAS,WAAW,aACrB,oBAAC,KAAD;KAAG,WAAW,yBAAO;KAAO,MAAK;eAC9B,SAAS,8BAA8B;IACvC,CAAA;IAEL,oBAAC,QAAD;KAAQ,MAAK;KAAS,SAAQ;KAAU,MAAK;KAAK,UAAU,YAAY,YAAY,SAAS,CAAC,WAAW,CAAC;eACvG,UAAW,SAAS,wBAAwB,kBAAoB,SAAS,mBAAmB;IACvF,CAAA;GACA;IACF;;AAEd"}
package/dist/index69.cjs CHANGED
@@ -12,26 +12,39 @@ let react_jsx_runtime = require("react/jsx-runtime");
12
12
  * Complete app-neutral authentication UX. Uzi owns UI state and validation;
13
13
  * the consuming application owns credentials, sessions, API calls and redirects.
14
14
  */
15
- function AuthPage({ brand, signInTitle = "Welcome back", signUpTitle = "Create your account", signInSubtitle, signUpSubtitle, defaultMode = "signin", mode: controlledMode, onModeChange, onSignIn, onSignUp, onError, initialEmail = "", disabled = false, minPasswordLength = 8, signUpOptions, forgotPasswordHref, className, layout = "fullscreen" }) {
15
+ function AuthPage({ brand, signInTitle = "Welcome back", signUpTitle = "Create your account", signInSubtitle, signUpSubtitle, signInIdentifier, signUpFields = [], requirePasswordConfirmation = true, initialError, footer, minSignInPasswordLength = 0, passwordMaxLength, defaultMode = "signin", mode: controlledMode, onModeChange, onSignIn, onSignUp, onError, initialEmail = "", disabled = false, minPasswordLength = 8, signUpOptions, forgotPasswordHref, className, layout = "fullscreen" }) {
16
16
  const [internalMode, setInternalMode] = react.useState(defaultMode);
17
17
  const mode = controlledMode ?? internalMode;
18
18
  const [email, setEmail] = react.useState(initialEmail);
19
19
  const [password, setPassword] = react.useState("");
20
- const [confirmPassword, setConfirmPassword] = react.useState("");
20
+ const [confirmPasswordValue, setConfirmPassword] = react.useState("");
21
+ const [extraValues, setExtraValues] = react.useState({});
21
22
  const [acceptedTerms, setAcceptedTerms] = react.useState(false);
22
23
  const [showPassword, setShowPassword] = react.useState(false);
23
24
  const [pending, setPending] = react.useState(false);
24
25
  const pendingRef = react.useRef(false);
25
26
  const [errors, setErrors] = react.useState({});
26
- const [serverError, setServerError] = react.useState("");
27
+ const [serverError, setServerError] = react.useState(initialError ?? "");
27
28
  const id = react.useId();
28
29
  const emailId = id + "-email";
29
30
  const passwordId = id + "-password";
30
31
  const confirmId = id + "-confirm";
31
32
  const termsId = id + "-terms";
32
33
  const signup = mode === "signup";
34
+ const identifierIsEmail = signup || (signInIdentifier?.type ?? "email") === "email";
33
35
  const termsRequired = signup && !!signUpOptions?.requireTerms;
34
36
  const canSwitch = !!onModeChange || !!onSignIn && !!onSignUp;
37
+ const fieldNames = signUpFields.map((field) => field.name).join("\\u0000");
38
+ react.useEffect(() => {
39
+ const activeNames = new Set(fieldNames.split("\\u0000").filter(Boolean));
40
+ setExtraValues((previous) => {
41
+ if (Object.keys(previous).every((name) => activeNames.has(name))) return previous;
42
+ return Object.fromEntries(Object.entries(previous).filter(([name]) => activeNames.has(name)));
43
+ });
44
+ }, [fieldNames]);
45
+ react.useEffect(() => {
46
+ setServerError(initialError ?? "");
47
+ }, [initialError]);
35
48
  react.useEffect(() => {
36
49
  if (initialEmail) setEmail((previous) => previous || initialEmail);
37
50
  }, [initialEmail]);
@@ -50,11 +63,21 @@ function AuthPage({ brand, signInTitle = "Welcome back", signUpTitle = "Create y
50
63
  if (pendingRef.current || disabled) return;
51
64
  const nextErrors = {};
52
65
  const normalizedEmail = email.trim();
53
- if (!normalizedEmail) nextErrors.email = "Email is required";
54
- else if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(normalizedEmail)) nextErrors.email = "Enter a valid email address";
66
+ if (!normalizedEmail) nextErrors.email = (signup ? "Email" : signInIdentifier?.label ?? "Email") + " is required";
67
+ else if (identifierIsEmail && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(normalizedEmail)) nextErrors.email = "Enter a valid email address";
68
+ if (!signup && signInIdentifier?.maxLength && normalizedEmail.length > signInIdentifier.maxLength) nextErrors.email = "Identifier is too long";
55
69
  if (!password) nextErrors.password = "Password is required";
56
70
  else if (signup && password.length < minPasswordLength) nextErrors.password = `Use at least ${minPasswordLength} characters`;
57
- if (signup && password !== confirmPassword) nextErrors.confirm = "Passwords do not match";
71
+ if (signup && requirePasswordConfirmation && password !== confirmPasswordValue) nextErrors.confirm = "Passwords do not match";
72
+ if (!signup && minSignInPasswordLength && password.length < minSignInPasswordLength) nextErrors.password = `Use at least ${minSignInPasswordLength} characters`;
73
+ if (passwordMaxLength && password.length > passwordMaxLength) nextErrors.password = "Password is too long";
74
+ if (signup) for (const field of signUpFields) {
75
+ const value = (extraValues[field.name] ?? "").trim();
76
+ if (field.required && !value) nextErrors[field.name] = field.label + " is required";
77
+ else if (value && field.minLength && value.length < field.minLength) nextErrors[field.name] = field.label + " is too short";
78
+ else if (field.maxLength && value.length > field.maxLength) nextErrors[field.name] = field.label + " is too long";
79
+ else if (field.type === "email" && value && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value)) nextErrors[field.name] = "Enter a valid email address";
80
+ }
58
81
  if (termsRequired && !acceptedTerms) nextErrors.terms = "Accept the terms to continue";
59
82
  setErrors(nextErrors);
60
83
  setServerError("");
@@ -66,6 +89,8 @@ function AuthPage({ brand, signInTitle = "Welcome back", signUpTitle = "Create y
66
89
  email: normalizedEmail,
67
90
  password
68
91
  };
92
+ if (!signup && signInIdentifier) credentials.identifier = normalizedEmail;
93
+ if (signup && signUpFields.length) credentials.fields = Object.fromEntries(signUpFields.map((field) => [field.name, (extraValues[field.name] ?? "").trim()]));
69
94
  if (signup) {
70
95
  if (!onSignUp) return;
71
96
  await onSignUp(credentials);
@@ -75,6 +100,7 @@ function AuthPage({ brand, signInTitle = "Welcome back", signUpTitle = "Create y
75
100
  }
76
101
  setPassword("");
77
102
  setConfirmPassword("");
103
+ setExtraValues({});
78
104
  } catch (error) {
79
105
  setServerError(error instanceof Error && error.message ? error.message : "Unable to complete the request. Try again.");
80
106
  onError?.(error, mode);
@@ -89,6 +115,7 @@ function AuthPage({ brand, signInTitle = "Welcome back", signUpTitle = "Create y
89
115
  brand,
90
116
  title: signup ? signUpTitle : signInTitle,
91
117
  subtitle: signup ? signUpSubtitle : signInSubtitle,
118
+ footer,
92
119
  children: [canSwitch && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_AuthForm.AuthModeSwitch, {
93
120
  mode,
94
121
  onModeChange: switchMode
@@ -99,14 +126,15 @@ function AuthPage({ brand, signInTitle = "Welcome back", signUpTitle = "Create y
99
126
  children: [
100
127
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_AuthForm.AuthField, {
101
128
  htmlFor: emailId,
102
- label: "Email",
129
+ label: signup ? "Email" : signInIdentifier?.label ?? "Email",
103
130
  error: errors.email,
104
131
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Input.Input, {
105
132
  id: emailId,
106
- type: "email",
107
- placeholder: "you@example.com",
133
+ type: signup ? "email" : signInIdentifier?.type ?? "email",
134
+ placeholder: signup ? "you@example.com" : signInIdentifier?.placeholder ?? "you@example.com",
108
135
  value: email,
109
- autoComplete: "email",
136
+ autoComplete: signup ? "email" : signInIdentifier?.autoComplete ?? "email",
137
+ maxLength: signup ? 254 : signInIdentifier?.maxLength,
110
138
  required: true,
111
139
  disabled: disabled || pending,
112
140
  "aria-invalid": !!errors.email,
@@ -132,6 +160,7 @@ function AuthPage({ brand, signInTitle = "Welcome back", signUpTitle = "Create y
132
160
  placeholder: signup ? "At least " + minPasswordLength + " characters" : "Enter your password",
133
161
  value: password,
134
162
  required: true,
163
+ maxLength: passwordMaxLength,
135
164
  disabled: disabled || pending,
136
165
  autoComplete: signup ? "new-password" : "current-password",
137
166
  "aria-invalid": !!errors.password,
@@ -155,7 +184,7 @@ function AuthPage({ brand, signInTitle = "Welcome back", signUpTitle = "Create y
155
184
  })]
156
185
  })
157
186
  }),
158
- signup && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_AuthForm.AuthField, {
187
+ signup && requirePasswordConfirmation && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_AuthForm.AuthField, {
159
188
  htmlFor: confirmId,
160
189
  label: "Confirm password",
161
190
  error: errors.confirm,
@@ -163,7 +192,7 @@ function AuthPage({ brand, signInTitle = "Welcome back", signUpTitle = "Create y
163
192
  id: confirmId,
164
193
  type: "password",
165
194
  placeholder: "Re-enter password",
166
- value: confirmPassword,
195
+ value: confirmPasswordValue,
167
196
  autoComplete: "new-password",
168
197
  required: true,
169
198
  disabled: disabled || pending,
@@ -178,6 +207,37 @@ function AuthPage({ brand, signInTitle = "Welcome back", signUpTitle = "Create y
178
207
  }
179
208
  })
180
209
  }),
210
+ signup && signUpFields.map((field) => {
211
+ const fieldId = id + "-" + field.name;
212
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_AuthForm.AuthField, {
213
+ htmlFor: fieldId,
214
+ label: field.label,
215
+ error: errors[field.name],
216
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Input.Input, {
217
+ id: fieldId,
218
+ type: field.type ?? "text",
219
+ value: extraValues[field.name] ?? "",
220
+ placeholder: field.placeholder,
221
+ autoComplete: field.autoComplete,
222
+ required: field.required,
223
+ minLength: field.minLength,
224
+ maxLength: field.maxLength,
225
+ disabled: disabled || pending,
226
+ "aria-invalid": !!errors[field.name],
227
+ "aria-describedby": errors[field.name] ? fieldId + "-error" : void 0,
228
+ onChange: (event) => {
229
+ setExtraValues((old) => ({
230
+ ...old,
231
+ [field.name]: event.target.value
232
+ }));
233
+ setErrors((old) => ({
234
+ ...old,
235
+ [field.name]: ""
236
+ }));
237
+ }
238
+ })
239
+ }, field.name);
240
+ }),
181
241
  termsRequired && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
182
242
  className: require_auth_page_module.default.terms,
183
243
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
@@ -1 +1 @@
1
- {"version":3,"file":"index69.cjs","names":[],"sources":["../src/components/auth-page/AuthPage.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { AuthCard } from \"../auth-card/AuthCard\";\nimport { AuthField, AuthForm, AuthModeSwitch, type AuthMode } from \"../auth-form/AuthForm\";\nimport { Input } from \"../input/Input\";\nimport { Button } from \"../button/Button\";\nimport styles from \"./auth-page.module.css\";\n\nexport interface AuthCredentials {\n email: string;\n password: string;\n}\n\nexport interface AuthPageProps {\n /** Brand/logo above the form. */\n brand?: React.ReactNode;\n /** Title for each mode. */\n signInTitle?: string;\n signUpTitle?: string;\n signInSubtitle?: string;\n signUpSubtitle?: string;\n /** Initial tab; changes to this prop after mount do not reset the selected tab. */\n defaultMode?: AuthMode;\n /** Optional controlled tab, e.g. when sign-in and sign-up use separate routes. */\n mode?: AuthMode;\n onModeChange?: (mode: AuthMode) => void;\n /** App-specific auth callbacks; throwing an Error displays an inline failure. */\n onSignIn?: (credentials: AuthCredentials) => Promise<unknown> | unknown;\n onSignUp?: (credentials: AuthCredentials) => Promise<unknown> | unknown;\n onError?: (error: unknown, mode: AuthMode) => void;\n /** Prefill email without ever populating a password. */\n initialEmail?: string;\n /** Prevent submission until the app's authentication provider is ready. */\n disabled?: boolean;\n /** Minimum password length for account creation; default 8. */\n minPasswordLength?: number;\n /** Optional terms requirement for sign-up only. */\n signUpOptions?: {\n requireTerms?: boolean;\n termsHref?: string;\n termsLabel?: string;\n };\n /** Optional app-owned password recovery route. */\n forgotPasswordHref?: string;\n className?: string;\n layout?: \"fullscreen\" | \"embedded\";\n}\n\n/**\n * Complete app-neutral authentication UX. Uzi owns UI state and validation;\n * the consuming application owns credentials, sessions, API calls and redirects.\n */\nexport function AuthPage({\n brand,\n signInTitle = \"Welcome back\",\n signUpTitle = \"Create your account\",\n signInSubtitle,\n signUpSubtitle,\n defaultMode = \"signin\",\n mode: controlledMode,\n onModeChange,\n onSignIn,\n onSignUp,\n onError,\n initialEmail = \"\",\n disabled = false,\n minPasswordLength = 8,\n signUpOptions,\n forgotPasswordHref,\n className,\n layout = \"fullscreen\",\n}: AuthPageProps) {\n const [internalMode, setInternalMode] = React.useState<AuthMode>(defaultMode);\n const mode = controlledMode ?? internalMode;\n const [email, setEmail] = React.useState(initialEmail);\n const [password, setPassword] = React.useState(\"\");\n const [confirmPassword, setConfirmPassword] = React.useState(\"\");\n const [acceptedTerms, setAcceptedTerms] = React.useState(false);\n const [showPassword, setShowPassword] = React.useState(false);\n const [pending, setPending] = React.useState(false);\n const pendingRef = React.useRef(false);\n const [errors, setErrors] = React.useState<Record<string, string>>({});\n const [serverError, setServerError] = React.useState(\"\");\n const id = React.useId();\n const emailId = id + \"-email\";\n const passwordId = id + \"-password\";\n const confirmId = id + \"-confirm\";\n const termsId = id + \"-terms\";\n const signup = mode === \"signup\";\n const termsRequired = signup && !!signUpOptions?.requireTerms;\n const canSwitch = !!onModeChange || (!!onSignIn && !!onSignUp);\n\n React.useEffect(() => {\n // Changes from an authenticated account may prefill the email after hydration.\n if (initialEmail) setEmail((previous) => previous || initialEmail);\n }, [initialEmail]);\n\n const switchMode = (next: AuthMode) => {\n if (pendingRef.current || next === mode) return;\n setInternalMode(next);\n setPassword(\"\");\n setConfirmPassword(\"\");\n setShowPassword(false);\n setErrors({});\n setServerError(\"\");\n onModeChange?.(next);\n };\n\n const submit = async (event: React.FormEvent<HTMLFormElement>) => {\n event.preventDefault();\n if (pendingRef.current || disabled) return;\n const nextErrors: Record<string, string> = {};\n const normalizedEmail = email.trim();\n if (!normalizedEmail) nextErrors.email = \"Email is required\";\n else if (!/^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test(normalizedEmail)) nextErrors.email = \"Enter a valid email address\";\n if (!password) nextErrors.password = \"Password is required\";\n else if (signup && password.length < minPasswordLength) nextErrors.password = `Use at least ${minPasswordLength} characters`;\n if (signup && password !== confirmPassword) nextErrors.confirm = \"Passwords do not match\";\n if (termsRequired && !acceptedTerms) nextErrors.terms = \"Accept the terms to continue\";\n setErrors(nextErrors);\n setServerError(\"\");\n if (Object.keys(nextErrors).length) return;\n\n pendingRef.current = true;\n setPending(true);\n try {\n const credentials = { email: normalizedEmail, password };\n if (signup) {\n if (!onSignUp) return;\n await onSignUp(credentials);\n } else {\n if (!onSignIn) return;\n await onSignIn(credentials);\n }\n setPassword(\"\");\n setConfirmPassword(\"\");\n } catch (error) {\n setServerError(error instanceof Error && error.message ? error.message : \"Unable to complete the request. Try again.\");\n onError?.(error, mode);\n } finally {\n pendingRef.current = false;\n setPending(false);\n }\n };\n\n return (\n <AuthCard\n className={className}\n layout={layout}\n brand={brand}\n title={signup ? signUpTitle : signInTitle}\n subtitle={signup ? signUpSubtitle : signInSubtitle}\n >\n {canSwitch && <AuthModeSwitch mode={mode} onModeChange={switchMode} />}\n <AuthForm onSubmit={submit} noValidate aria-busy={pending}>\n <AuthField htmlFor={emailId} label=\"Email\" error={errors.email}>\n <Input\n id={emailId} type=\"email\" placeholder=\"you@example.com\" value={email}\n autoComplete=\"email\" required disabled={disabled || pending}\n aria-invalid={!!errors.email} aria-describedby={errors.email ? emailId + \"-error\" : undefined}\n onChange={(event) => { setEmail(event.target.value); setErrors((old) => ({ ...old, email: \"\" })); }}\n />\n </AuthField>\n <AuthField htmlFor={passwordId} label=\"Password\" error={errors.password}>\n <div className={styles.passwordRow}>\n <Input\n id={passwordId} type={showPassword ? \"text\" : \"password\"}\n placeholder={signup ? \"At least \" + minPasswordLength + \" characters\" : \"Enter your password\"}\n value={password} required disabled={disabled || pending}\n autoComplete={signup ? \"new-password\" : \"current-password\"}\n aria-invalid={!!errors.password} aria-describedby={errors.password ? passwordId + \"-error\" : undefined}\n onChange={(event) => { setPassword(event.target.value); setErrors((old) => ({ ...old, password: \"\" })); }}\n />\n <button type=\"button\" className={styles.visibility} disabled={disabled || pending}\n aria-label={showPassword ? \"Hide password\" : \"Show password\"}\n aria-controls={passwordId} aria-pressed={showPassword}\n onClick={() => setShowPassword((old) => !old)}>\n {showPassword ? \"Hide\" : \"Show\"}\n </button>\n </div>\n </AuthField>\n {signup && (\n <AuthField htmlFor={confirmId} label=\"Confirm password\" error={errors.confirm}>\n <Input id={confirmId} type=\"password\" placeholder=\"Re-enter password\" value={confirmPassword}\n autoComplete=\"new-password\" required disabled={disabled || pending}\n aria-invalid={!!errors.confirm} aria-describedby={errors.confirm ? confirmId + \"-error\" : undefined}\n onChange={(event) => { setConfirmPassword(event.target.value); setErrors((old) => ({ ...old, confirm: \"\" })); }} />\n </AuthField>\n )}\n {termsRequired && (\n <div className={styles.terms}>\n <label htmlFor={termsId} className={styles.termsLabel}>\n <input id={termsId} type=\"checkbox\" checked={acceptedTerms} disabled={disabled || pending}\n aria-invalid={!!errors.terms} aria-describedby={errors.terms ? termsId + \"-error\" : undefined}\n onChange={(event) => { setAcceptedTerms(event.target.checked); setErrors((old) => ({ ...old, terms: \"\" })); }} />\n <span>{signUpOptions?.termsLabel ?? \"I agree to the \"}\n {signUpOptions?.termsHref ? <a href={signUpOptions.termsHref}>Terms of Service</a> : \"Terms of Service\"}\n </span>\n </label>\n {errors.terms && <p className={styles.error} id={termsId + \"-error\"} role=\"alert\">{errors.terms}</p>}\n </div>\n )}\n {!signup && forgotPasswordHref && <a className={styles.forgot} href={forgotPasswordHref}>Forgot password?</a>}\n {serverError && <p className={styles.error} role=\"alert\">{serverError}</p>}\n {!(signup ? onSignUp : onSignIn) && (\n <p className={styles.error} role=\"status\">\n {signup ? \"Sign-up is not available.\" : \"Sign-in is not available.\"}\n </p>\n )}\n <Button type=\"submit\" variant=\"primary\" size=\"lg\" disabled={disabled || pending || (signup ? !onSignUp : !onSignIn)}>\n {pending ? (signup ? \"Creating account...\" : \"Signing in...\") : (signup ? \"Create account\" : \"Sign in\")}\n </Button>\n </AuthForm>\n </AuthCard>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AAmDA,SAAgB,SAAS,EACvB,OACA,cAAc,gBACd,cAAc,uBACd,gBACA,gBACA,cAAc,UACd,MAAM,gBACN,cACA,UACA,UACA,SACA,eAAe,IACf,WAAW,OACX,oBAAoB,GACpB,eACA,oBACA,WACA,SAAS,gBACO;CAChB,MAAM,CAAC,cAAc,mBAAmB,MAAM,SAAmB,WAAW;CAC5E,MAAM,OAAO,kBAAkB;CAC/B,MAAM,CAAC,OAAO,YAAY,MAAM,SAAS,YAAY;CACrD,MAAM,CAAC,UAAU,eAAe,MAAM,SAAS,EAAE;CACjD,MAAM,CAAC,iBAAiB,sBAAsB,MAAM,SAAS,EAAE;CAC/D,MAAM,CAAC,eAAe,oBAAoB,MAAM,SAAS,KAAK;CAC9D,MAAM,CAAC,cAAc,mBAAmB,MAAM,SAAS,KAAK;CAC5D,MAAM,CAAC,SAAS,cAAc,MAAM,SAAS,KAAK;CAClD,MAAM,aAAa,MAAM,OAAO,KAAK;CACrC,MAAM,CAAC,QAAQ,aAAa,MAAM,SAAiC,CAAC,CAAC;CACrE,MAAM,CAAC,aAAa,kBAAkB,MAAM,SAAS,EAAE;CACvD,MAAM,KAAK,MAAM,MAAM;CACvB,MAAM,UAAU,KAAK;CACrB,MAAM,aAAa,KAAK;CACxB,MAAM,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AY;OAChF,gBAAc,CAAC,CAAC,OAAO;OAAO,oBAAkB,OAAO,QAAQ,UAAU,WAAW,KAAA;OACpF,WAAW,UAAU;QAAE,iBAAiB,MAAM,OAAO,OAAO;QAAG,WAAW,SAAS;SAAE,GAAG;SAAK,OAAO;QAAG,EAAE;OAAG;MAAI,CAAA,GAClH,iBAAA,GAAA,kBAAA,KAAA,CAAC,QAAD,EAAA,UAAA,CAAO,eAAe,cAAc,mBACjC,eAAe,YAAY,iBAAA,GAAA,kBAAA,IAAA,CAAC,KAAD;OAAG,MAAM,cAAc;iBAAW;MAAmB,CAAA,IAAI,kBACjF,EAAA,CAAA,CACD;SACN,OAAO,SAAS,iBAAA,GAAA,kBAAA,IAAA,CAAC,KAAD;MAAG,WAAW,yBAAA,QAAO;MAAO,IAAI,UAAU;MAAU,MAAK;gBAAS,OAAO;KAAS,CAAA,CAChG;;IAEN,CAAC,UAAU,sBAAsB,iBAAA,GAAA,kBAAA,IAAA,CAAC,KAAD;KAAG,WAAW,yBAAA,QAAO;KAAQ,MAAM;eAAoB;IAAmB,CAAA;IAC3G,eAAe,iBAAA,GAAA,kBAAA,IAAA,CAAC,KAAD;KAAG,WAAW,yBAAA,QAAO;KAAO,MAAK;eAAS;IAAe,CAAA;IACxE,EAAE,SAAS,WAAW,aACrB,iBAAA,GAAA,kBAAA,IAAA,CAAC,KAAD;KAAG,WAAW,yBAAA,QAAO;KAAO,MAAK;eAC9B,SAAS,8BAA8B;IACvC,CAAA;IAEL,iBAAA,GAAA,kBAAA,IAAA,CAAC,eAAA,QAAD;KAAQ,MAAK;KAAS,SAAQ;KAAU,MAAK;KAAK,UAAU,YAAY,YAAY,SAAS,CAAC,WAAW,CAAC;eACvG,UAAW,SAAS,wBAAwB,kBAAoB,SAAS,mBAAmB;IACvF,CAAA;GACA;IACF;;AAEd"}
1
+ {"version":3,"file":"index69.cjs","names":[],"sources":["../src/components/auth-page/AuthPage.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { AuthCard } from \"../auth-card/AuthCard\";\nimport { AuthField, AuthForm, AuthModeSwitch, type AuthMode } from \"../auth-form/AuthForm\";\nimport { Input } from \"../input/Input\";\nimport { Button } from \"../button/Button\";\nimport styles from \"./auth-page.module.css\";\n\nexport interface AuthCredentials {\n email: string;\n password: string;\n identifier?: string;\n fields?: Record<string, string>;\n}\n\nexport interface AuthAdditionalField {\n name: string;\n label: string;\n type?: \"text\" | \"email\";\n placeholder?: string;\n autoComplete?: string;\n required?: boolean;\n minLength?: number;\n maxLength?: number;\n}\n\nexport interface AuthIdentifierOptions {\n label?: string;\n type?: \"text\" | \"email\";\n placeholder?: string;\n autoComplete?: string;\n maxLength?: number;\n}\n\nexport interface AuthPageProps {\n /** Brand/logo above the form. */\n brand?: React.ReactNode;\n /** Title for each mode. */\n signInTitle?: string;\n signUpTitle?: string;\n signInSubtitle?: string;\n signUpSubtitle?: string;\n signInIdentifier?: AuthIdentifierOptions;\n signUpFields?: AuthAdditionalField[];\n /** Optional confirmation field; defaults to true. */\n requirePasswordConfirmation?: boolean;\n /** An app-supplied session verification error. */\n initialError?: string;\n footer?: React.ReactNode;\n minSignInPasswordLength?: number;\n passwordMaxLength?: number;\n /** Initial tab; changes to this prop after mount do not reset the selected tab. */\n defaultMode?: AuthMode;\n /** Optional controlled tab, e.g. when sign-in and sign-up use separate routes. */\n mode?: AuthMode;\n onModeChange?: (mode: AuthMode) => void;\n /** App-specific auth callbacks; throwing an Error displays an inline failure. */\n onSignIn?: (credentials: AuthCredentials) => Promise<unknown> | unknown;\n onSignUp?: (credentials: AuthCredentials) => Promise<unknown> | unknown;\n onError?: (error: unknown, mode: AuthMode) => void;\n /** Prefill email without ever populating a password. */\n initialEmail?: string;\n /** Prevent submission until the app's authentication provider is ready. */\n disabled?: boolean;\n /** Minimum password length for account creation; default 8. */\n minPasswordLength?: number;\n /** Optional terms requirement for sign-up only. */\n signUpOptions?: {\n requireTerms?: boolean;\n termsHref?: string;\n termsLabel?: string;\n };\n /** Optional app-owned password recovery route. */\n forgotPasswordHref?: string;\n className?: string;\n layout?: \"fullscreen\" | \"embedded\";\n}\n\n/**\n * Complete app-neutral authentication UX. Uzi owns UI state and validation;\n * the consuming application owns credentials, sessions, API calls and redirects.\n */\nexport function AuthPage({\n brand,\n signInTitle = \"Welcome back\",\n signUpTitle = \"Create your account\",\n signInSubtitle,\n signUpSubtitle,\n signInIdentifier,\n signUpFields = [],\n requirePasswordConfirmation = true,\n initialError,\n footer,\n minSignInPasswordLength = 0,\n passwordMaxLength,\n defaultMode = \"signin\",\n mode: controlledMode,\n onModeChange,\n onSignIn,\n onSignUp,\n onError,\n initialEmail = \"\",\n disabled = false,\n minPasswordLength = 8,\n signUpOptions,\n forgotPasswordHref,\n className,\n layout = \"fullscreen\",\n}: AuthPageProps) {\n const [internalMode, setInternalMode] = React.useState<AuthMode>(defaultMode);\n const mode = controlledMode ?? internalMode;\n const [email, setEmail] = React.useState(initialEmail);\n const [password, setPassword] = React.useState(\"\");\n const [confirmPasswordValue, setConfirmPassword] = React.useState(\"\");\n const [extraValues, setExtraValues] = React.useState<Record<string, string>>({});\n const [acceptedTerms, setAcceptedTerms] = React.useState(false);\n const [showPassword, setShowPassword] = React.useState(false);\n const [pending, setPending] = React.useState(false);\n const pendingRef = React.useRef(false);\n const [errors, setErrors] = React.useState<Record<string, string>>({});\n const [serverError, setServerError] = React.useState(initialError ?? \"\");\n const id = React.useId();\n const emailId = id + \"-email\";\n const passwordId = id + \"-password\";\n const confirmId = id + \"-confirm\";\n const termsId = id + \"-terms\";\n const signup = mode === \"signup\";\n const identifierIsEmail = signup || (signInIdentifier?.type ?? \"email\") === \"email\";\n const termsRequired = signup && !!signUpOptions?.requireTerms;\n const canSwitch = !!onModeChange || (!!onSignIn && !!onSignUp);\n\n const fieldNames = signUpFields.map((field) => field.name).join(\"\\\\u0000\");\n React.useEffect(() => {\n const activeNames = new Set(fieldNames.split(\"\\\\u0000\").filter(Boolean));\n setExtraValues((previous) => {\n if (Object.keys(previous).every((name) => activeNames.has(name))) return previous;\n return Object.fromEntries(Object.entries(previous).filter(([name]) => activeNames.has(name)));\n });\n }, [fieldNames]);\n\n React.useEffect(() => { setServerError(initialError ?? \"\"); }, [initialError]);\n\n React.useEffect(() => {\n // Changes from an authenticated account may prefill the email after hydration.\n if (initialEmail) setEmail((previous) => previous || initialEmail);\n }, [initialEmail]);\n\n const switchMode = (next: AuthMode) => {\n if (pendingRef.current || next === mode) return;\n setInternalMode(next);\n setPassword(\"\");\n setConfirmPassword(\"\");\n setShowPassword(false);\n setErrors({});\n setServerError(\"\");\n onModeChange?.(next);\n };\n\n const submit = async (event: React.FormEvent<HTMLFormElement>) => {\n event.preventDefault();\n if (pendingRef.current || disabled) return;\n const nextErrors: Record<string, string> = {};\n const normalizedEmail = email.trim();\n if (!normalizedEmail) nextErrors.email = (signup ? \"Email\" : signInIdentifier?.label ?? \"Email\") + \" is required\";\n else if (identifierIsEmail && !/^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test(normalizedEmail)) nextErrors.email = \"Enter a valid email address\";\n if (!signup && signInIdentifier?.maxLength && normalizedEmail.length > signInIdentifier.maxLength) nextErrors.email = \"Identifier is too long\";\n if (!password) nextErrors.password = \"Password is required\";\n else if (signup && password.length < minPasswordLength) nextErrors.password = `Use at least ${minPasswordLength} characters`;\n if (signup && requirePasswordConfirmation && password !== confirmPasswordValue) nextErrors.confirm = \"Passwords do not match\";\n if (!signup && minSignInPasswordLength && password.length < minSignInPasswordLength) nextErrors.password = `Use at least ${minSignInPasswordLength} characters`;\n if (passwordMaxLength && password.length > passwordMaxLength) nextErrors.password = \"Password is too long\";\n if (signup) {\n for (const field of signUpFields) {\n const value = (extraValues[field.name] ?? \"\").trim();\n if (field.required && !value) nextErrors[field.name] = field.label + \" is required\";\n else if (value && field.minLength && value.length < field.minLength) nextErrors[field.name] = field.label + \" is too short\";\n else if (field.maxLength && value.length > field.maxLength) nextErrors[field.name] = field.label + \" is too long\";\n else if (field.type === \"email\" && value && !/^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test(value)) nextErrors[field.name] = \"Enter a valid email address\";\n }\n }\n if (termsRequired && !acceptedTerms) nextErrors.terms = \"Accept the terms to continue\";\n setErrors(nextErrors);\n setServerError(\"\");\n if (Object.keys(nextErrors).length) return;\n\n pendingRef.current = true;\n setPending(true);\n try {\n const credentials: AuthCredentials = { email: normalizedEmail, password };\n if (!signup && signInIdentifier) credentials.identifier = normalizedEmail;\n if (signup && signUpFields.length) {\n credentials.fields = Object.fromEntries(signUpFields.map((field) => [field.name, (extraValues[field.name] ?? \"\").trim()]));\n }\n if (signup) {\n if (!onSignUp) return;\n await onSignUp(credentials);\n } else {\n if (!onSignIn) return;\n await onSignIn(credentials);\n }\n setPassword(\"\");\n setConfirmPassword(\"\");\n setExtraValues({});\n } catch (error) {\n setServerError(error instanceof Error && error.message ? error.message : \"Unable to complete the request. Try again.\");\n onError?.(error, mode);\n } finally {\n pendingRef.current = false;\n setPending(false);\n }\n };\n\n return (\n <AuthCard\n className={className}\n layout={layout}\n brand={brand}\n title={signup ? signUpTitle : signInTitle}\n subtitle={signup ? signUpSubtitle : signInSubtitle}\n footer={footer}\n >\n {canSwitch && <AuthModeSwitch mode={mode} onModeChange={switchMode} />}\n <AuthForm onSubmit={submit} noValidate aria-busy={pending}>\n <AuthField htmlFor={emailId} label={signup ? \"Email\" : signInIdentifier?.label ?? \"Email\"} error={errors.email}>\n <Input\n id={emailId} type={signup ? \"email\" : signInIdentifier?.type ?? \"email\"} placeholder={signup ? \"you@example.com\" : signInIdentifier?.placeholder ?? \"you@example.com\"} value={email}\n autoComplete={signup ? \"email\" : signInIdentifier?.autoComplete ?? \"email\"} maxLength={signup ? 254 : signInIdentifier?.maxLength} required disabled={disabled || pending}\n aria-invalid={!!errors.email} aria-describedby={errors.email ? emailId + \"-error\" : undefined}\n onChange={(event) => { setEmail(event.target.value); setErrors((old) => ({ ...old, email: \"\" })); }}\n />\n </AuthField>\n <AuthField htmlFor={passwordId} label=\"Password\" error={errors.password}>\n <div className={styles.passwordRow}>\n <Input\n id={passwordId} type={showPassword ? \"text\" : \"password\"}\n placeholder={signup ? \"At least \" + minPasswordLength + \" characters\" : \"Enter your password\"}\n value={password} required maxLength={passwordMaxLength} disabled={disabled || pending}\n autoComplete={signup ? \"new-password\" : \"current-password\"}\n aria-invalid={!!errors.password} aria-describedby={errors.password ? passwordId + \"-error\" : undefined}\n onChange={(event) => { setPassword(event.target.value); setErrors((old) => ({ ...old, password: \"\" })); }}\n />\n <button type=\"button\" className={styles.visibility} disabled={disabled || pending}\n aria-label={showPassword ? \"Hide password\" : \"Show password\"}\n aria-controls={passwordId} aria-pressed={showPassword}\n onClick={() => setShowPassword((old) => !old)}>\n {showPassword ? \"Hide\" : \"Show\"}\n </button>\n </div>\n </AuthField>\n {signup && requirePasswordConfirmation && (\n <AuthField htmlFor={confirmId} label=\"Confirm password\" error={errors.confirm}>\n <Input id={confirmId} type=\"password\" placeholder=\"Re-enter password\" value={confirmPasswordValue}\n autoComplete=\"new-password\" required disabled={disabled || pending}\n aria-invalid={!!errors.confirm} aria-describedby={errors.confirm ? confirmId + \"-error\" : undefined}\n onChange={(event) => { setConfirmPassword(event.target.value); setErrors((old) => ({ ...old, confirm: \"\" })); }} />\n </AuthField>\n )}\n {signup && signUpFields.map((field) => {\n const fieldId = id + \"-\" + field.name;\n return (\n <AuthField key={field.name} htmlFor={fieldId} label={field.label} error={errors[field.name]}>\n <Input id={fieldId} type={field.type ?? \"text\"} value={extraValues[field.name] ?? \"\"}\n placeholder={field.placeholder} autoComplete={field.autoComplete} required={field.required}\n minLength={field.minLength} maxLength={field.maxLength} disabled={disabled || pending}\n aria-invalid={!!errors[field.name]} aria-describedby={errors[field.name] ? fieldId + \"-error\" : undefined}\n onChange={(event) => { setExtraValues((old) => ({ ...old, [field.name]: event.target.value })); setErrors((old) => ({ ...old, [field.name]: \"\" })); }} />\n </AuthField>\n );\n })}\n {termsRequired && (\n <div className={styles.terms}>\n <label htmlFor={termsId} className={styles.termsLabel}>\n <input id={termsId} type=\"checkbox\" checked={acceptedTerms} disabled={disabled || pending}\n aria-invalid={!!errors.terms} aria-describedby={errors.terms ? termsId + \"-error\" : undefined}\n onChange={(event) => { setAcceptedTerms(event.target.checked); setErrors((old) => ({ ...old, terms: \"\" })); }} />\n <span>{signUpOptions?.termsLabel ?? \"I agree to the \"}\n {signUpOptions?.termsHref ? <a href={signUpOptions.termsHref}>Terms of Service</a> : \"Terms of Service\"}\n </span>\n </label>\n {errors.terms && <p className={styles.error} id={termsId + \"-error\"} role=\"alert\">{errors.terms}</p>}\n </div>\n )}\n {!signup && forgotPasswordHref && <a className={styles.forgot} href={forgotPasswordHref}>Forgot password?</a>}\n {serverError && <p className={styles.error} role=\"alert\">{serverError}</p>}\n {!(signup ? onSignUp : onSignIn) && (\n <p className={styles.error} role=\"status\">\n {signup ? \"Sign-up is not available.\" : \"Sign-in is not available.\"}\n </p>\n )}\n <Button type=\"submit\" variant=\"primary\" size=\"lg\" disabled={disabled || pending || (signup ? !onSignUp : !onSignIn)}>\n {pending ? (signup ? \"Creating account...\" : \"Signing in...\") : (signup ? \"Create account\" : \"Sign in\")}\n </Button>\n </AuthForm>\n </AuthCard>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AAiFA,SAAgB,SAAS,EACvB,OACA,cAAc,gBACd,cAAc,uBACd,gBACA,gBACA,kBACA,eAAe,CAAC,GAChB,8BAA8B,MAC9B,cACA,QACA,0BAA0B,GAC1B,mBACA,cAAc,UACd,MAAM,gBACN,cACA,UACA,UACA,SACA,eAAe,IACf,WAAW,OACX,oBAAoB,GACpB,eACA,oBACA,WACA,SAAS,gBACO;CAChB,MAAM,CAAC,cAAc,mBAAmB,MAAM,SAAmB,WAAW;CAC5E,MAAM,OAAO,kBAAkB;CAC/B,MAAM,CAAC,OAAO,YAAY,MAAM,SAAS,YAAY;CACrD,MAAM,CAAC,UAAU,eAAe,MAAM,SAAS,EAAE;CACjD,MAAM,CAA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AAO;KAAO,MAAK;eAC9B,SAAS,8BAA8B;IACvC,CAAA;IAEL,iBAAA,GAAA,kBAAA,IAAA,CAAC,eAAA,QAAD;KAAQ,MAAK;KAAS,SAAQ;KAAU,MAAK;KAAK,UAAU,YAAY,YAAY,SAAS,CAAC,WAAW,CAAC;eACvG,UAAW,SAAS,wBAAwB,kBAAoB,SAAS,mBAAmB;IACvF,CAAA;GACA;IACF;;AAEd"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tomny-dev/uzi",
3
- "version": "0.13.0",
3
+ "version": "0.14.0-pr.109.379.1.3f7230e",
4
4
  "description": "Rapid-fire React UI components. Ship faster, build more.",
5
5
  "type": "module",
6
6
  "repository": {