orbital-ds 0.28.0 → 0.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +303 -273
- package/components.manifest.json +526 -12
- package/dist/hooks/use-ds-messages.d.ts +205 -0
- package/dist/lib/auth-better-auth.d.ts +29 -0
- package/dist/lib/auth-better-auth.js +60 -0
- package/dist/lib/auth-flow.d.ts +83 -0
- package/dist/lib/auth-flow.js +152 -0
- package/dist/lib/auth-providers.d.ts +194 -0
- package/dist/lib/auth-providers.js +64 -0
- package/dist/lib/auth.d.ts +68 -0
- package/dist/lib/auth.js +110 -0
- package/dist/lib/header-control.d.ts +4 -0
- package/dist/lib/header-control.js +14 -0
- package/dist/lib/i18n.d.ts +205 -0
- package/dist/lib/i18n.js +624 -3
- package/dist/ui/app-bar.d.ts +10 -0
- package/dist/ui/app-bar.js +51 -0
- package/dist/ui/attachment.js +1 -1
- package/dist/ui/auth-backdrop.d.ts +20 -0
- package/dist/ui/auth-backdrop.js +137 -0
- package/dist/ui/auth-form.d.ts +111 -0
- package/dist/ui/auth-form.js +531 -0
- package/dist/ui/auth-layout.d.ts +70 -0
- package/dist/ui/auth-layout.js +283 -0
- package/dist/ui/auth-parts.d.ts +43 -0
- package/dist/ui/auth-parts.js +159 -0
- package/dist/ui/auth-status.d.ts +23 -0
- package/dist/ui/auth-status.js +99 -0
- package/dist/ui/badge.js +2 -2
- package/dist/ui/button.js +1 -1
- package/dist/ui/connected-accounts.d.ts +25 -0
- package/dist/ui/connected-accounts.js +89 -0
- package/dist/ui/content-card.d.ts +6 -2
- package/dist/ui/content-card.js +27 -3
- package/dist/ui/dropzone.js +1 -1
- package/dist/ui/empty-state.d.ts +10 -1
- package/dist/ui/empty-state.js +28 -7
- package/dist/ui/error-page.d.ts +10 -1
- package/dist/ui/error-page.js +74 -28
- package/dist/ui/icon-tile.d.ts +1 -1
- package/dist/ui/input-otp.js +2 -1
- package/dist/ui/item.js +1 -1
- package/dist/ui/legend.js +1 -1
- package/dist/ui/locale-switcher.d.ts +19 -0
- package/dist/ui/locale-switcher.js +54 -0
- package/dist/ui/menubar.js +1 -1
- package/dist/ui/message-scroller.js +1 -1
- package/dist/ui/mfa-challenge.d.ts +33 -0
- package/dist/ui/mfa-challenge.js +214 -0
- package/dist/ui/mfa-setup.d.ts +29 -0
- package/dist/ui/mfa-setup.js +196 -0
- package/dist/ui/navigation-menu.js +2 -2
- package/dist/ui/notice-review.d.ts +1 -0
- package/dist/ui/notifications.d.ts +12 -2
- package/dist/ui/notifications.js +28 -5
- package/dist/ui/oauth-consent.d.ts +54 -0
- package/dist/ui/oauth-consent.js +208 -0
- package/dist/ui/passkey-list.d.ts +17 -0
- package/dist/ui/passkey-list.js +112 -0
- package/dist/ui/password-input.d.ts +5 -0
- package/dist/ui/password-input.js +77 -0
- package/dist/ui/session-list.d.ts +19 -0
- package/dist/ui/session-list.js +70 -0
- package/dist/ui/session-timeout.d.ts +13 -0
- package/dist/ui/session-timeout.js +87 -0
- package/dist/ui/sidebar.d.ts +27 -5
- package/dist/ui/sidebar.js +56 -11
- package/dist/ui/sign-out-dialog.d.ts +17 -0
- package/dist/ui/sign-out-dialog.js +82 -0
- package/dist/ui/stat-group.d.ts +1 -1
- package/dist/ui/stat-group.js +6 -2
- package/dist/ui/stat.d.ts +24 -5
- package/dist/ui/stat.js +124 -19
- package/dist/ui/status-badge.d.ts +1 -1
- package/dist/ui/theme-toggle.d.ts +14 -0
- package/dist/ui/theme-toggle.js +112 -0
- package/dist/ui/toggle.js +2 -2
- package/dist/ui/week-strip.js +1 -1
- package/docs/CONTRACT.md +1 -1
- package/docs/designer/patrones.md +27 -0
- package/docs/designer/revision.md +8 -0
- package/package.json +3 -2
- package/scripts/brand-core.d.mts +2 -0
- package/scripts/brand-core.mjs +21 -1
- package/scripts/cli.mjs +452 -452
- package/scripts/doctor.mjs +3 -0
- package/scripts/init.mjs +7 -3
- package/dist/motion.css +0 -146
- package/dist/styles.css +0 -1240
- package/dist/themes/fractalia.css +0 -549
- package/dist/themes/fractalia.fonts.css +0 -3
- package/dist/themes/fractalia.guide.md +0 -86
- package/dist/themes/fractalia.meta.json +0 -112
- package/dist/themes/fractalia.scoped.css +0 -549
- package/dist/themes/fractalia.tokens.json +0 -39
- package/dist/themes/friendly.css +0 -367
- package/dist/themes/friendly.fonts.css +0 -2
- package/dist/themes/friendly.guide.md +0 -38
- package/dist/themes/friendly.meta.json +0 -82
- package/dist/themes/friendly.scoped.css +0 -367
- package/dist/themes/friendly.tokens.json +0 -45
- package/dist/themes/lagoon.css +0 -348
- package/dist/themes/lagoon.fonts.css +0 -2
- package/dist/themes/lagoon.guide.md +0 -47
- package/dist/themes/lagoon.meta.json +0 -84
- package/dist/themes/lagoon.scoped.css +0 -348
- package/dist/themes/lagoon.tokens.json +0 -49
- package/dist/themes/liquid.css +0 -502
- package/dist/themes/liquid.fonts.css +0 -7
- package/dist/themes/liquid.guide.md +0 -82
- package/dist/themes/liquid.meta.json +0 -134
- package/dist/themes/liquid.scoped.css +0 -502
- package/dist/themes/liquid.tokens.json +0 -47
- package/dist/themes/qratia.css +0 -260
- package/dist/themes/qratia.fonts.css +0 -2
- package/dist/themes/qratia.guide.md +0 -34
- package/dist/themes/qratia.meta.json +0 -49
- package/dist/themes/qratia.scoped.css +0 -260
- package/dist/themes/qratia.tokens.json +0 -49
- package/dist/themes/tactile.css +0 -588
- package/dist/themes/tactile.fonts.css +0 -3
- package/dist/themes/tactile.guide.md +0 -82
- package/dist/themes/tactile.meta.json +0 -182
- package/dist/themes/tactile.scoped.css +0 -588
- package/dist/themes/tactile.tokens.json +0 -42
- package/dist/themes/twitter.css +0 -357
- package/dist/themes/twitter.fonts.css +0 -6
- package/dist/themes/twitter.guide.md +0 -35
- package/dist/themes/twitter.meta.json +0 -90
- package/dist/themes/twitter.scoped.css +0 -357
- package/dist/themes/twitter.tokens.json +0 -45
- package/dist/themes/zyro.css +0 -434
- package/dist/themes/zyro.fonts.css +0 -2
- package/dist/themes/zyro.guide.md +0 -33
- package/dist/themes/zyro.meta.json +0 -74
- package/dist/themes/zyro.scoped.css +0 -434
- package/dist/themes/zyro.tokens.json +0 -46
|
@@ -0,0 +1,531 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { ArrowLeftIcon, Building2Icon, CheckIcon, CircleIcon, MailCheckIcon } from "lucide-react";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { useDsMessages } from "../hooks/use-ds-messages.js";
|
|
6
|
+
import {
|
|
7
|
+
authErrorMessage,
|
|
8
|
+
checkPassword,
|
|
9
|
+
formatCountdown,
|
|
10
|
+
isAuthErrorCode,
|
|
11
|
+
isValidEmail,
|
|
12
|
+
passwordScore,
|
|
13
|
+
useAuthCountdown
|
|
14
|
+
} from "../lib/auth.js";
|
|
15
|
+
import { dsFormat } from "../lib/i18n.js";
|
|
16
|
+
import { dsWarn } from "../lib/presets.js";
|
|
17
|
+
import { cn } from "../lib/utils.js";
|
|
18
|
+
import { AuthAnchor, AuthDivider, AuthError, AuthHeader, AuthPasskeyButton, AuthProviders, AuthStagger } from "./auth-parts.js";
|
|
19
|
+
import { Button } from "./button.js";
|
|
20
|
+
import { Checkbox } from "./checkbox.js";
|
|
21
|
+
import { IconTile } from "./icon-tile.js";
|
|
22
|
+
import { Input } from "./input.js";
|
|
23
|
+
import { InputOTP, InputOTPGroup, InputOTPSlot } from "./input-otp.js";
|
|
24
|
+
import { Label } from "./label.js";
|
|
25
|
+
import { PasswordInput } from "./password-input.js";
|
|
26
|
+
import { PasswordStrength } from "./password-strength.js";
|
|
27
|
+
import { Spinner } from "./spinner.js";
|
|
28
|
+
const PRESETS = {
|
|
29
|
+
"sign-in": { fields: ["identifier", "password"], identifierFirst: false, afterSubmit: null, strength: false },
|
|
30
|
+
social: { fields: [], identifierFirst: false, afterSubmit: null, strength: false },
|
|
31
|
+
"sign-up": { fields: ["name", "identifier", "password", "terms"], identifierFirst: false, afterSubmit: null, strength: true },
|
|
32
|
+
"magic-link": { fields: ["identifier"], identifierFirst: false, afterSubmit: "sent", strength: false },
|
|
33
|
+
"email-code": { fields: ["identifier"], identifierFirst: false, afterSubmit: "code", strength: false },
|
|
34
|
+
sso: { fields: ["identifier"], identifierFirst: false, afterSubmit: "redirecting", strength: false },
|
|
35
|
+
"forgot-password": { fields: ["identifier"], identifierFirst: false, afterSubmit: "sent", strength: false },
|
|
36
|
+
"reset-password": { fields: ["password", "confirmPassword"], identifierFirst: false, afterSubmit: null, strength: true }
|
|
37
|
+
};
|
|
38
|
+
function AuthForm({
|
|
39
|
+
preset = "sign-in",
|
|
40
|
+
title,
|
|
41
|
+
description,
|
|
42
|
+
icon,
|
|
43
|
+
identifier = "email",
|
|
44
|
+
defaultIdentifier = "",
|
|
45
|
+
identifierFirst,
|
|
46
|
+
onIdentify,
|
|
47
|
+
audience,
|
|
48
|
+
fields,
|
|
49
|
+
extraFields,
|
|
50
|
+
passwordRules,
|
|
51
|
+
showStrength,
|
|
52
|
+
remember = false,
|
|
53
|
+
providers,
|
|
54
|
+
onProvider,
|
|
55
|
+
providersPlacement = "top",
|
|
56
|
+
providersLayout,
|
|
57
|
+
onPasskey,
|
|
58
|
+
onSso,
|
|
59
|
+
ssoBy = "email",
|
|
60
|
+
lastUsed,
|
|
61
|
+
onSubmit,
|
|
62
|
+
onVerifyCode,
|
|
63
|
+
onResend,
|
|
64
|
+
resendAfter = 30,
|
|
65
|
+
codeLength = 6,
|
|
66
|
+
error: errorProp,
|
|
67
|
+
fieldErrors: fieldErrorsProp,
|
|
68
|
+
links = {},
|
|
69
|
+
submitLabel,
|
|
70
|
+
footer,
|
|
71
|
+
className,
|
|
72
|
+
...props
|
|
73
|
+
}) {
|
|
74
|
+
const t = useDsMessages();
|
|
75
|
+
const d = PRESETS[preset];
|
|
76
|
+
const list = fields ?? d.fields;
|
|
77
|
+
const [accessKind, setAccessKind] = React.useState(null);
|
|
78
|
+
const stepFirst = preset === "sign-in" && (identifierFirst ?? d.identifierFirst);
|
|
79
|
+
const strength = showStrength ?? d.strength;
|
|
80
|
+
const uid = React.useId();
|
|
81
|
+
const ids = (f) => `${uid}-${f}`;
|
|
82
|
+
const [view, setView] = React.useState(preset === "sso" ? "sso" : "form");
|
|
83
|
+
const [values, setValues] = React.useState({ identifier: defaultIdentifier, password: "", name: "", confirmPassword: "", remember: false, terms: false });
|
|
84
|
+
const [code, setCode] = React.useState("");
|
|
85
|
+
const [errors, setErrors] = React.useState({});
|
|
86
|
+
const [error, setError] = React.useState(null);
|
|
87
|
+
const [fails, setFails] = React.useState(0);
|
|
88
|
+
const [pending, setPending] = React.useState(null);
|
|
89
|
+
const [organizations, setOrganizations] = React.useState([]);
|
|
90
|
+
const countdown = useAuthCountdown(0);
|
|
91
|
+
const formRef = React.useRef(null);
|
|
92
|
+
if (preset === "sign-up" && !list.includes("identifier")) dsWarn("AuthForm", 'preset "sign-up" without "identifier" in `fields`.');
|
|
93
|
+
if (preset === "email-code" && !onVerifyCode) dsWarn("AuthForm", 'preset "email-code" expects `onVerifyCode`.');
|
|
94
|
+
if (preset === "sso" && !onSso) dsWarn("AuthForm", 'preset "sso" expects `onSso`.');
|
|
95
|
+
const shownError = errorProp ?? error;
|
|
96
|
+
const fieldError = (f) => fieldErrorsProp?.[f] ?? errors[f];
|
|
97
|
+
const text = (m) => isAuthErrorCode(m) ? authErrorMessage(t, m) : m;
|
|
98
|
+
const set = (key, value) => {
|
|
99
|
+
setValues((v) => ({ ...v, [key]: value }));
|
|
100
|
+
if (errors[key]) setErrors((e) => ({ ...e, [key]: void 0 }));
|
|
101
|
+
};
|
|
102
|
+
const focusField = (f) => requestAnimationFrame(() => document.getElementById(ids(f))?.focus());
|
|
103
|
+
const go = (next) => {
|
|
104
|
+
setView(next);
|
|
105
|
+
setError(null);
|
|
106
|
+
if (next === "password") focusField("password");
|
|
107
|
+
if (next === "code") focusField("code");
|
|
108
|
+
if (next === "sent" || next === "code") countdown.start(resendAfter);
|
|
109
|
+
};
|
|
110
|
+
async function run(key, task) {
|
|
111
|
+
setPending(key);
|
|
112
|
+
setError(null);
|
|
113
|
+
try {
|
|
114
|
+
return await task();
|
|
115
|
+
} catch {
|
|
116
|
+
setError("network");
|
|
117
|
+
return void 0;
|
|
118
|
+
} finally {
|
|
119
|
+
setPending(null);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
const apply = (result, fallback) => {
|
|
123
|
+
if (result && (result.error || result.fieldErrors)) {
|
|
124
|
+
if (result.error) {
|
|
125
|
+
setError(result.error);
|
|
126
|
+
setFails((n) => n + 1);
|
|
127
|
+
}
|
|
128
|
+
if (result.fieldErrors) {
|
|
129
|
+
setErrors(result.fieldErrors);
|
|
130
|
+
const first = Object.keys(result.fieldErrors)[0];
|
|
131
|
+
if (first) focusField(first);
|
|
132
|
+
}
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
const next = result?.next ?? fallback;
|
|
136
|
+
if (next) go(next);
|
|
137
|
+
};
|
|
138
|
+
const visibleFields = view === "password" ? ["password"] : view === "sso" ? ["identifier"] : stepFirst && view === "form" ? ["identifier"] : list;
|
|
139
|
+
function validate() {
|
|
140
|
+
const next = {};
|
|
141
|
+
for (const f of visibleFields) {
|
|
142
|
+
if (f === "identifier") {
|
|
143
|
+
if (!values.identifier.trim()) next.identifier = t.authRequired;
|
|
144
|
+
else if ((view === "sso" ? ssoBy === "email" : identifier === "email") && !isValidEmail(values.identifier)) next.identifier = t.authInvalidEmail;
|
|
145
|
+
}
|
|
146
|
+
if (f === "name" && !values.name.trim()) next.name = t.authRequired;
|
|
147
|
+
if (f === "password") {
|
|
148
|
+
if (!values.password) next.password = t.authRequired;
|
|
149
|
+
else if (preset !== "sign-in" && !checkPassword(values.password, passwordRules).valid) next.password = authErrorMessage(t, "weak-password");
|
|
150
|
+
}
|
|
151
|
+
if (f === "confirmPassword" && values.confirmPassword !== values.password) next.confirmPassword = t.authPasswordMismatch;
|
|
152
|
+
if (f === "terms" && !values.terms) next.terms = t.authTermsRequired;
|
|
153
|
+
}
|
|
154
|
+
setErrors(next);
|
|
155
|
+
const first = visibleFields.find((f) => next[f]);
|
|
156
|
+
if (first) {
|
|
157
|
+
focusField(first);
|
|
158
|
+
return false;
|
|
159
|
+
}
|
|
160
|
+
return true;
|
|
161
|
+
}
|
|
162
|
+
async function startSso(organization) {
|
|
163
|
+
if (!onSso) return;
|
|
164
|
+
const result = await run("sso", () => onSso({ identifier: values.identifier.trim(), organization }));
|
|
165
|
+
if (result && "organizations" in result && result.organizations?.length) {
|
|
166
|
+
setOrganizations(result.organizations);
|
|
167
|
+
setView("organizations");
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
apply(result, "redirecting");
|
|
171
|
+
}
|
|
172
|
+
async function handleSubmit(event) {
|
|
173
|
+
event.preventDefault();
|
|
174
|
+
if (pending || !validate()) return;
|
|
175
|
+
if (view === "sso") return startSso();
|
|
176
|
+
if (stepFirst && view === "form") {
|
|
177
|
+
if (!onIdentify) return go("password");
|
|
178
|
+
const route = await run("identify", () => onIdentify(values.identifier.trim()));
|
|
179
|
+
if (!route) return go("password");
|
|
180
|
+
if (route.error) return setError(route.error);
|
|
181
|
+
setAccessKind(route.access ?? null);
|
|
182
|
+
if (route.method === "sso") {
|
|
183
|
+
if (route.organizations && route.organizations.length > 1) {
|
|
184
|
+
setOrganizations(route.organizations);
|
|
185
|
+
return setView("organizations");
|
|
186
|
+
}
|
|
187
|
+
return startSso(route.organizations?.[0]?.id);
|
|
188
|
+
}
|
|
189
|
+
if (route.method === "passkey" && onPasskey) {
|
|
190
|
+
const r = await run("passkey", onPasskey);
|
|
191
|
+
return apply(r ?? void 0, null);
|
|
192
|
+
}
|
|
193
|
+
if (route.method === "email-code" || route.method === "magic-link") {
|
|
194
|
+
const r = await run("submit", () => onSubmit?.(collect()));
|
|
195
|
+
return apply(r ?? void 0, route.method === "email-code" ? "code" : "sent");
|
|
196
|
+
}
|
|
197
|
+
return go("password");
|
|
198
|
+
}
|
|
199
|
+
const result = await run("submit", () => onSubmit?.(collect()));
|
|
200
|
+
apply(result ?? void 0, d.afterSubmit);
|
|
201
|
+
}
|
|
202
|
+
const collect = () => ({
|
|
203
|
+
...values,
|
|
204
|
+
identifier: values.identifier.trim(),
|
|
205
|
+
formData: formRef.current ? new FormData(formRef.current) : new FormData()
|
|
206
|
+
});
|
|
207
|
+
async function verify(value) {
|
|
208
|
+
if (!onVerifyCode || pending) return;
|
|
209
|
+
const result = await run("verify", () => onVerifyCode(value, { identifier: values.identifier.trim() }));
|
|
210
|
+
if (result && (result.error || result.fieldErrors)) {
|
|
211
|
+
setCode("");
|
|
212
|
+
focusField("code");
|
|
213
|
+
}
|
|
214
|
+
apply(result ?? void 0, null);
|
|
215
|
+
}
|
|
216
|
+
async function resend() {
|
|
217
|
+
if (countdown.running || !onResend) return;
|
|
218
|
+
await run("resend", () => onResend({ identifier: values.identifier.trim() }));
|
|
219
|
+
countdown.start(resendAfter);
|
|
220
|
+
}
|
|
221
|
+
const identifierLabel = view === "sso" && ssoBy === "organization" ? t.authOrganization : view === "sso" ? t.authWorkEmail : identifier === "email" ? t.authEmail : identifier === "username" ? t.authUsername : t.authEmailOrUsername;
|
|
222
|
+
const errorOf = (f) => {
|
|
223
|
+
const e = fieldError(f);
|
|
224
|
+
return e ? /* @__PURE__ */ jsx("p", { id: ids(`${f}-error`), "data-slot": "auth-form-field-error", className: "animate-ds-auth-reveal text-sm text-destructive", children: text(e) }, String(e)) : null;
|
|
225
|
+
};
|
|
226
|
+
const aria = (f, extra) => ({
|
|
227
|
+
id: ids(f),
|
|
228
|
+
"aria-invalid": fieldError(f) ? true : void 0,
|
|
229
|
+
"aria-describedby": [fieldError(f) ? ids(`${f}-error`) : null, extra].filter(Boolean).join(" ") || void 0
|
|
230
|
+
});
|
|
231
|
+
const fieldWrap = (f, children) => /* @__PURE__ */ jsxs("div", { "data-slot": "auth-form-field", "data-field": f, "data-invalid": fieldError(f) ? "" : void 0, className: "flex flex-col gap-2", children: [
|
|
232
|
+
children,
|
|
233
|
+
errorOf(f)
|
|
234
|
+
] }, f);
|
|
235
|
+
const rules = checkPassword(values.password, passwordRules);
|
|
236
|
+
const ruleItems = [
|
|
237
|
+
{ key: "minLength", label: dsFormat(t.authRuleMinLength, { n: rules.rules.minLength }), on: true },
|
|
238
|
+
{ key: "lowercase", label: t.authRuleLowercase, on: rules.rules.lowercase },
|
|
239
|
+
{ key: "uppercase", label: t.authRuleUppercase, on: rules.rules.uppercase },
|
|
240
|
+
{ key: "number", label: t.authRuleNumber, on: rules.rules.number },
|
|
241
|
+
{ key: "symbol", label: t.authRuleSymbol, on: rules.rules.symbol }
|
|
242
|
+
].filter((r) => r.on);
|
|
243
|
+
const isNew = preset === "sign-up" || preset === "reset-password";
|
|
244
|
+
function renderField(f) {
|
|
245
|
+
switch (f) {
|
|
246
|
+
case "identifier": {
|
|
247
|
+
const passkeyAutofill = onPasskey && preset === "sign-in" ? " webauthn" : "";
|
|
248
|
+
const isEmail = view === "sso" ? ssoBy === "email" : identifier === "email";
|
|
249
|
+
return fieldWrap(
|
|
250
|
+
f,
|
|
251
|
+
/* @__PURE__ */ jsxs(Fragment, { children: [
|
|
252
|
+
/* @__PURE__ */ jsx(Label, { htmlFor: ids(f), children: identifierLabel }),
|
|
253
|
+
/* @__PURE__ */ jsx(
|
|
254
|
+
Input,
|
|
255
|
+
{
|
|
256
|
+
...aria(f),
|
|
257
|
+
name: view === "sso" && ssoBy === "organization" ? "organization" : identifier === "username" ? "username" : "email",
|
|
258
|
+
type: isEmail ? "email" : "text",
|
|
259
|
+
inputMode: isEmail ? "email" : void 0,
|
|
260
|
+
autoComplete: view === "sso" && ssoBy === "organization" ? "organization" : `${identifier === "username" ? "username" : isEmail ? "email" : "username"}${passkeyAutofill}`,
|
|
261
|
+
autoCapitalize: "none",
|
|
262
|
+
spellCheck: false,
|
|
263
|
+
autoFocus: !values.identifier,
|
|
264
|
+
value: values.identifier,
|
|
265
|
+
onChange: (e) => set("identifier", e.target.value)
|
|
266
|
+
}
|
|
267
|
+
)
|
|
268
|
+
] })
|
|
269
|
+
);
|
|
270
|
+
}
|
|
271
|
+
case "name":
|
|
272
|
+
return fieldWrap(
|
|
273
|
+
f,
|
|
274
|
+
/* @__PURE__ */ jsxs(Fragment, { children: [
|
|
275
|
+
/* @__PURE__ */ jsx(Label, { htmlFor: ids(f), children: t.authName }),
|
|
276
|
+
/* @__PURE__ */ jsx(Input, { ...aria(f), name: "name", autoComplete: "name", value: values.name, onChange: (e) => set("name", e.target.value) })
|
|
277
|
+
] })
|
|
278
|
+
);
|
|
279
|
+
case "password":
|
|
280
|
+
return fieldWrap(
|
|
281
|
+
f,
|
|
282
|
+
/* @__PURE__ */ jsxs(Fragment, { children: [
|
|
283
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2", children: [
|
|
284
|
+
/* @__PURE__ */ jsx(Label, { htmlFor: ids(f), children: isNew ? t.authNewPassword : t.authPassword }),
|
|
285
|
+
preset === "sign-in" && links.forgotPassword ? /* @__PURE__ */ jsx(AuthAnchor, { to: links.forgotPassword, className: "text-sm", children: t.authForgotLink }) : null
|
|
286
|
+
] }),
|
|
287
|
+
/* @__PURE__ */ jsx(
|
|
288
|
+
PasswordInput,
|
|
289
|
+
{
|
|
290
|
+
...aria(f, isNew ? ids("rules") : void 0),
|
|
291
|
+
name: "password",
|
|
292
|
+
autoComplete: isNew ? "new-password" : "current-password",
|
|
293
|
+
value: values.password,
|
|
294
|
+
onChange: (e) => set("password", e.target.value)
|
|
295
|
+
}
|
|
296
|
+
),
|
|
297
|
+
isNew ? /* @__PURE__ */ jsxs("div", { id: ids("rules"), "data-slot": "auth-form-rules", className: "flex flex-col gap-2", children: [
|
|
298
|
+
strength && values.password ? /* @__PURE__ */ jsx(PasswordStrength, { value: passwordScore(values.password) }) : null,
|
|
299
|
+
/* @__PURE__ */ jsx("ul", { "aria-label": t.authPasswordRules, className: "grid gap-1 text-xs @[22rem]/auth-form:grid-cols-2", children: ruleItems.map((r) => {
|
|
300
|
+
const ok = rules.checks[r.key];
|
|
301
|
+
return /* @__PURE__ */ jsxs(
|
|
302
|
+
"li",
|
|
303
|
+
{
|
|
304
|
+
"data-met": ok || void 0,
|
|
305
|
+
className: cn("flex items-center gap-1.5 transition-colors duration-(--ds-motion-fast)", ok ? "text-[color:var(--ds-on-soft,var(--success))]" : "text-muted-foreground"),
|
|
306
|
+
children: [
|
|
307
|
+
ok ? /* @__PURE__ */ jsx(CheckIcon, { "aria-hidden": "true", className: "size-3.5" }) : /* @__PURE__ */ jsx(CircleIcon, { "aria-hidden": "true", className: "size-3.5" }),
|
|
308
|
+
/* @__PURE__ */ jsx("span", { children: r.label }),
|
|
309
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: ok ? t.authRuleMet : t.authRulePending })
|
|
310
|
+
]
|
|
311
|
+
},
|
|
312
|
+
r.key
|
|
313
|
+
);
|
|
314
|
+
}) })
|
|
315
|
+
] }) : null
|
|
316
|
+
] })
|
|
317
|
+
);
|
|
318
|
+
case "confirmPassword":
|
|
319
|
+
return fieldWrap(
|
|
320
|
+
f,
|
|
321
|
+
/* @__PURE__ */ jsxs(Fragment, { children: [
|
|
322
|
+
/* @__PURE__ */ jsx(Label, { htmlFor: ids(f), children: t.authConfirmPassword }),
|
|
323
|
+
/* @__PURE__ */ jsx(PasswordInput, { ...aria(f), name: "confirmPassword", autoComplete: "new-password", value: values.confirmPassword, onChange: (e) => set("confirmPassword", e.target.value) })
|
|
324
|
+
] })
|
|
325
|
+
);
|
|
326
|
+
case "terms":
|
|
327
|
+
return fieldWrap(
|
|
328
|
+
f,
|
|
329
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-start gap-2.5", children: [
|
|
330
|
+
/* @__PURE__ */ jsx(
|
|
331
|
+
Checkbox,
|
|
332
|
+
{
|
|
333
|
+
id: ids(f),
|
|
334
|
+
name: "terms",
|
|
335
|
+
checked: values.terms,
|
|
336
|
+
onCheckedChange: (v) => set("terms", v === true),
|
|
337
|
+
"aria-invalid": fieldError(f) ? true : void 0,
|
|
338
|
+
"aria-describedby": fieldError(f) ? ids(`${f}-error`) : void 0,
|
|
339
|
+
className: "mt-0.5"
|
|
340
|
+
}
|
|
341
|
+
),
|
|
342
|
+
/* @__PURE__ */ jsxs(Label, { htmlFor: ids(f), className: "inline text-sm leading-snug font-normal text-muted-foreground", children: [
|
|
343
|
+
t.authTermsAccept,
|
|
344
|
+
" ",
|
|
345
|
+
links.terms ? /* @__PURE__ */ jsx(AuthAnchor, { to: links.terms, children: t.authTermsLink }) : t.authTermsLink,
|
|
346
|
+
links.privacy ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
347
|
+
" ",
|
|
348
|
+
t.authAnd,
|
|
349
|
+
" ",
|
|
350
|
+
/* @__PURE__ */ jsx(AuthAnchor, { to: links.privacy, children: t.authPrivacyLink })
|
|
351
|
+
] }) : null
|
|
352
|
+
] })
|
|
353
|
+
] })
|
|
354
|
+
);
|
|
355
|
+
default:
|
|
356
|
+
return null;
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
const head = {
|
|
360
|
+
"sign-in": [t.authSignInTitle, t.authSignInDescription],
|
|
361
|
+
social: [t.authSignInTitle, t.authSocialDescription],
|
|
362
|
+
"sign-up": [t.authSignUpTitle, t.authSignUpDescription],
|
|
363
|
+
"magic-link": [t.authMagicLinkTitle, t.authMagicLinkDescription],
|
|
364
|
+
"email-code": [t.authEmailCodeTitle, t.authEmailCodeDescription],
|
|
365
|
+
sso: [t.authSsoTitle, ssoBy === "organization" ? t.authSsoOrgDescription : t.authSsoDescription],
|
|
366
|
+
"forgot-password": [t.authForgotTitle, t.authForgotDescription],
|
|
367
|
+
"reset-password": [t.authResetTitle, t.authResetDescription]
|
|
368
|
+
};
|
|
369
|
+
const submitText = {
|
|
370
|
+
"sign-in": t.authSignInSubmit,
|
|
371
|
+
social: t.authContinue,
|
|
372
|
+
"sign-up": t.authSignUpSubmit,
|
|
373
|
+
"magic-link": t.authSendLink,
|
|
374
|
+
"email-code": t.authSendCode,
|
|
375
|
+
sso: t.authSsoSubmit,
|
|
376
|
+
"forgot-password": t.authSendReset,
|
|
377
|
+
"reset-password": t.authResetSubmit
|
|
378
|
+
};
|
|
379
|
+
const email = values.identifier.trim();
|
|
380
|
+
const providersBlock = (providers?.length || onPasskey) && view === "form" && (preset === "sign-in" || preset === "social" || preset === "sign-up") ? /* @__PURE__ */ jsxs(AuthStagger, { index: providersPlacement === "top" ? 1 : 3, className: "flex flex-col gap-2", children: [
|
|
381
|
+
providers?.length ? /* @__PURE__ */ jsx(AuthProviders, { providers, onProvider: (id) => void run(id, async () => apply(await onProvider?.(id) ?? void 0, null)), pending, lastUsed, layout: providersLayout ?? (preset === "social" ? "stack" : void 0) }) : null,
|
|
382
|
+
onPasskey && (preset === "sign-in" || preset === "social") ? /* @__PURE__ */ jsx(AuthPasskeyButton, { pending: pending === "passkey", disabled: pending != null && pending !== "passkey", lastUsed: lastUsed === "passkey", onClick: () => void run("passkey", async () => apply(await onPasskey() ?? void 0, null)) }) : null
|
|
383
|
+
] }) : null;
|
|
384
|
+
const divider = providersBlock && preset !== "social" ? /* @__PURE__ */ jsx(AuthStagger, { index: 2, children: /* @__PURE__ */ jsx(AuthDivider, {}) }) : null;
|
|
385
|
+
const backToForm = /* @__PURE__ */ jsxs(Button, { type: "button", variant: "ghost", size: "sm", className: "self-start", onClick: () => go(preset === "sso" ? "sso" : "form"), children: [
|
|
386
|
+
/* @__PURE__ */ jsx(ArrowLeftIcon, {}),
|
|
387
|
+
t.authUseDifferentEmail
|
|
388
|
+
] });
|
|
389
|
+
let content;
|
|
390
|
+
if (view === "sent") {
|
|
391
|
+
content = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
392
|
+
/* @__PURE__ */ jsx(
|
|
393
|
+
AuthHeader,
|
|
394
|
+
{
|
|
395
|
+
icon: /* @__PURE__ */ jsx(IconTile, { tone: "primary", size: "lg", children: /* @__PURE__ */ jsx(MailCheckIcon, {}) }),
|
|
396
|
+
title: t.authCheckEmailTitle,
|
|
397
|
+
description: dsFormat(preset === "forgot-password" ? t.authResetSentBody : t.authLinkSentBody, { email })
|
|
398
|
+
}
|
|
399
|
+
),
|
|
400
|
+
/* @__PURE__ */ jsx(AuthError, { error: shownError }),
|
|
401
|
+
/* @__PURE__ */ jsxs(AuthStagger, { index: 1, className: "flex flex-col gap-3", children: [
|
|
402
|
+
onResend ? /* @__PURE__ */ jsxs(Button, { type: "button", variant: "outline", className: "w-full", disabled: countdown.running || pending != null, onClick: resend, children: [
|
|
403
|
+
pending === "resend" ? /* @__PURE__ */ jsx(Spinner, {}) : null,
|
|
404
|
+
countdown.running ? dsFormat(t.authResendIn, { time: formatCountdown(countdown.left) }) : t.authResend
|
|
405
|
+
] }) : null,
|
|
406
|
+
backToForm
|
|
407
|
+
] })
|
|
408
|
+
] });
|
|
409
|
+
} else if (view === "code") {
|
|
410
|
+
content = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
411
|
+
/* @__PURE__ */ jsx(AuthHeader, { title: t.authCheckEmailTitle, description: dsFormat(t.authCodeSentBody, { email }) }),
|
|
412
|
+
/* @__PURE__ */ jsx(AuthError, { error: shownError }),
|
|
413
|
+
/* @__PURE__ */ jsxs(AuthStagger, { index: 1, className: "flex flex-col items-center gap-4", children: [
|
|
414
|
+
/* @__PURE__ */ jsx(Label, { htmlFor: ids("code"), className: "sr-only", children: t.authCode }),
|
|
415
|
+
/* @__PURE__ */ jsx("div", { "data-slot": "auth-form-code", className: cn(fails > 0 && "animate-ds-auth-shake"), children: /* @__PURE__ */ jsx(
|
|
416
|
+
InputOTP,
|
|
417
|
+
{
|
|
418
|
+
id: ids("code"),
|
|
419
|
+
maxLength: codeLength,
|
|
420
|
+
value: code,
|
|
421
|
+
onChange: setCode,
|
|
422
|
+
onComplete: verify,
|
|
423
|
+
autoComplete: "one-time-code",
|
|
424
|
+
inputMode: "numeric",
|
|
425
|
+
disabled: pending === "verify",
|
|
426
|
+
"aria-invalid": fieldError("code") || shownError ? true : void 0,
|
|
427
|
+
children: /* @__PURE__ */ jsx(InputOTPGroup, { children: Array.from({ length: codeLength }, (_, i) => /* @__PURE__ */ jsx(InputOTPSlot, { index: i }, i)) })
|
|
428
|
+
}
|
|
429
|
+
) }, fails),
|
|
430
|
+
errorOf("code"),
|
|
431
|
+
/* @__PURE__ */ jsxs(Button, { type: "button", className: "w-full", disabled: code.length < codeLength || pending != null, onClick: () => verify(code), children: [
|
|
432
|
+
pending === "verify" ? /* @__PURE__ */ jsx(Spinner, {}) : null,
|
|
433
|
+
t.authVerify
|
|
434
|
+
] }),
|
|
435
|
+
onResend ? /* @__PURE__ */ jsx(Button, { type: "button", variant: "link", size: "sm", disabled: countdown.running || pending != null, onClick: resend, children: countdown.running ? dsFormat(t.authResendIn, { time: formatCountdown(countdown.left) }) : t.authResend }) : null,
|
|
436
|
+
backToForm
|
|
437
|
+
] })
|
|
438
|
+
] });
|
|
439
|
+
} else if (view === "organizations") {
|
|
440
|
+
content = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
441
|
+
/* @__PURE__ */ jsx(AuthHeader, { title: t.authChooseOrganization, description: email }),
|
|
442
|
+
/* @__PURE__ */ jsx(AuthError, { error: shownError }),
|
|
443
|
+
/* @__PURE__ */ jsx(AuthStagger, { index: 1, children: /* @__PURE__ */ jsx("ul", { "data-slot": "auth-form-organizations", className: "flex flex-col gap-2", children: organizations.map((o) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs(
|
|
444
|
+
"button",
|
|
445
|
+
{
|
|
446
|
+
type: "button",
|
|
447
|
+
disabled: pending != null,
|
|
448
|
+
onClick: () => startSso(o.id),
|
|
449
|
+
className: "flex w-full items-center gap-3 rounded-(--ds-auth-radius) border border-(--ds-auth-border) p-3 text-start outline-none transition-colors duration-(--ds-motion-fast) hover:bg-(--ds-field-bg-hover) focus-visible:ring-(length:--ds-ring-width) focus-visible:ring-(--ds-ring-color) disabled:opacity-(--ds-disabled-opacity)",
|
|
450
|
+
children: [
|
|
451
|
+
o.icon ?? /* @__PURE__ */ jsx(IconTile, { size: "sm", children: /* @__PURE__ */ jsx(Building2Icon, {}) }),
|
|
452
|
+
/* @__PURE__ */ jsxs("span", { className: "flex min-w-0 flex-1 flex-col", children: [
|
|
453
|
+
/* @__PURE__ */ jsx("span", { className: "truncate text-sm font-medium", children: o.label }),
|
|
454
|
+
o.description ? /* @__PURE__ */ jsx("span", { className: "truncate text-xs text-muted-foreground", children: o.description }) : null
|
|
455
|
+
] }),
|
|
456
|
+
pending === "sso" ? /* @__PURE__ */ jsx(Spinner, {}) : null
|
|
457
|
+
]
|
|
458
|
+
}
|
|
459
|
+
) }, o.id)) }) }),
|
|
460
|
+
backToForm
|
|
461
|
+
] });
|
|
462
|
+
} else if (view === "redirecting") {
|
|
463
|
+
content = /* @__PURE__ */ jsxs("div", { "data-slot": "auth-form-redirecting", role: "status", className: "flex flex-col items-center gap-4 py-6 text-center", children: [
|
|
464
|
+
/* @__PURE__ */ jsx(Spinner, { className: "size-6" }),
|
|
465
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: t.authSsoRedirecting })
|
|
466
|
+
] });
|
|
467
|
+
} else {
|
|
468
|
+
const ssoView = view === "sso";
|
|
469
|
+
const [hTitle, hDesc] = ssoView ? head.sso : head[preset];
|
|
470
|
+
content = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
471
|
+
/* @__PURE__ */ jsx(AuthHeader, { icon, title: title ?? hTitle, description: description ?? hDesc }),
|
|
472
|
+
providersPlacement === "top" ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
473
|
+
providersBlock,
|
|
474
|
+
divider
|
|
475
|
+
] }) : null,
|
|
476
|
+
preset === "social" && !ssoView ? /* @__PURE__ */ jsx(AuthError, { error: shownError }) : /* @__PURE__ */ jsx(AuthStagger, { index: 3, children: /* @__PURE__ */ jsxs("form", { ref: formRef, noValidate: true, onSubmit: handleSubmit, className: "flex flex-col gap-4", children: [
|
|
477
|
+
/* @__PURE__ */ jsx(AuthError, { error: shownError }),
|
|
478
|
+
view === "password" ? /* @__PURE__ */ jsxs("div", { "data-slot": "auth-form-identity", className: "flex items-center justify-between gap-2 rounded-(--ds-auth-radius) border border-(--ds-auth-border) px-3 py-2 text-sm", children: [
|
|
479
|
+
/* @__PURE__ */ jsx("span", { className: "min-w-0 truncate", children: email }),
|
|
480
|
+
accessKind ? /* @__PURE__ */ jsx("span", { "data-slot": "auth-form-access", "data-access": accessKind, className: "shrink-0 rounded-full bg-muted px-2 py-0.5 text-xs text-muted-foreground", children: accessKind === "internal" ? t.authAccessInternal : t.authAccessExternal }) : null,
|
|
481
|
+
/* @__PURE__ */ jsx(Button, { type: "button", variant: "link", size: "sm", onClick: () => go("form"), children: t.authChange }),
|
|
482
|
+
/* @__PURE__ */ jsx("input", { type: "hidden", name: "username", autoComplete: "username", value: email })
|
|
483
|
+
] }) : null,
|
|
484
|
+
audience && audience !== "external" && stepFirst && view === "form" ? /* @__PURE__ */ jsx("p", { "data-slot": "auth-form-audience", "data-audience": audience, className: "rounded-(--ds-auth-radius) bg-muted px-3 py-2 text-xs text-pretty text-muted-foreground", children: audience === "mixed" ? t.authAudienceMixed : t.authAudienceInternal }) : null,
|
|
485
|
+
visibleFields.map(renderField),
|
|
486
|
+
!ssoView && extraFields && !(stepFirst && view === "form") ? extraFields : null,
|
|
487
|
+
remember && preset === "sign-in" && !(stepFirst && view === "form") ? /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2.5", children: [
|
|
488
|
+
/* @__PURE__ */ jsx(Checkbox, { id: ids("remember"), name: "remember", checked: values.remember, onCheckedChange: (v) => set("remember", v === true) }),
|
|
489
|
+
/* @__PURE__ */ jsx(Label, { htmlFor: ids("remember"), className: "text-sm font-normal", children: t.authRemember })
|
|
490
|
+
] }) : null,
|
|
491
|
+
/* @__PURE__ */ jsxs(Button, { type: "submit", className: "w-full", disabled: pending != null, "aria-busy": pending === "submit" || pending === "identify" || void 0, children: [
|
|
492
|
+
pending === "submit" || pending === "identify" || pending === "sso" ? /* @__PURE__ */ jsx(Spinner, {}) : null,
|
|
493
|
+
ssoView ? t.authSsoSubmit : stepFirst && view === "form" ? t.authContinue : submitLabel ?? submitText[preset]
|
|
494
|
+
] })
|
|
495
|
+
] }) }),
|
|
496
|
+
preset === "social" && !ssoView && links.email ? /* @__PURE__ */ jsx(AuthStagger, { index: 3, className: "flex justify-center", children: /* @__PURE__ */ jsx(AuthAnchor, { to: links.email, children: t.authContinueWithEmail }) }) : null,
|
|
497
|
+
providersPlacement === "bottom" ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
498
|
+
divider,
|
|
499
|
+
providersBlock
|
|
500
|
+
] }) : null,
|
|
501
|
+
(preset === "sign-in" || preset === "social") && onSso && !ssoView ? /* @__PURE__ */ jsx(AuthStagger, { index: 4, className: "flex justify-center", children: /* @__PURE__ */ jsxs(Button, { type: "button", variant: "ghost", size: "sm", "data-last-used": lastUsed === "sso" || void 0, onClick: () => go("sso"), children: [
|
|
502
|
+
/* @__PURE__ */ jsx(Building2Icon, {}),
|
|
503
|
+
t.authUseSso
|
|
504
|
+
] }) }) : null,
|
|
505
|
+
ssoView && (preset === "sign-in" || preset === "social") ? /* @__PURE__ */ jsxs(Button, { type: "button", variant: "ghost", size: "sm", className: "self-center", onClick: () => go("form"), children: [
|
|
506
|
+
/* @__PURE__ */ jsx(ArrowLeftIcon, {}),
|
|
507
|
+
t.authBackToSignIn
|
|
508
|
+
] }) : null
|
|
509
|
+
] });
|
|
510
|
+
}
|
|
511
|
+
const footerLinks = footer ?? (view === "form" || view === "sso" ? (preset === "sign-in" || preset === "social") && links.signUp ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
512
|
+
t.authNoAccount,
|
|
513
|
+
" ",
|
|
514
|
+
/* @__PURE__ */ jsx(AuthAnchor, { to: links.signUp, children: t.authSignUpLink })
|
|
515
|
+
] }) : (preset === "sign-in" || preset === "social" || preset === "sso") && links.requestAccess ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
516
|
+
t.authNoAccess,
|
|
517
|
+
" ",
|
|
518
|
+
/* @__PURE__ */ jsx(AuthAnchor, { to: links.requestAccess, children: t.authRequestAccessLink })
|
|
519
|
+
] }) : preset === "sign-up" && links.signIn ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
520
|
+
t.authHaveAccount,
|
|
521
|
+
" ",
|
|
522
|
+
/* @__PURE__ */ jsx(AuthAnchor, { to: links.signIn, children: t.authSignInLink })
|
|
523
|
+
] }) : preset !== "sign-in" && preset !== "social" && preset !== "sign-up" && links.signIn ? /* @__PURE__ */ jsx(AuthAnchor, { to: links.signIn, children: t.authBackToSignIn }) : null : null);
|
|
524
|
+
return /* @__PURE__ */ jsxs("div", { "data-slot": "auth-form", "data-preset": preset, "data-view": view, className: cn("@container/auth-form flex flex-col gap-(--ds-auth-gap)", className), ...props, children: [
|
|
525
|
+
content,
|
|
526
|
+
footerLinks ? /* @__PURE__ */ jsx(AuthStagger, { index: 5, "data-slot": "auth-form-footer", className: "text-center text-sm text-muted-foreground", children: footerLinks }) : null
|
|
527
|
+
] });
|
|
528
|
+
}
|
|
529
|
+
export {
|
|
530
|
+
AuthForm
|
|
531
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { AuthBackdropVariant } from './auth-backdrop.js';
|
|
3
|
+
|
|
4
|
+
type AuthLayoutPreset = "centered" | "split" | "cover" | "banner" | "minimal";
|
|
5
|
+
type AuthSurface = "solid" | "glass" | "elevated" | "plain";
|
|
6
|
+
type AuthShape = "rounded" | "soft" | "sharp";
|
|
7
|
+
type AuthMotion = "full" | "entrance" | "off";
|
|
8
|
+
/** Movimiento de la pantalla de acceso (para que el contenido anime igual que la maqueta). */
|
|
9
|
+
declare function useAuthMotion(): AuthMotion;
|
|
10
|
+
/** Cómo se tiñe una imagen o vídeo de fondo con la marca: none = tal cual · brand = tono del
|
|
11
|
+
* primario (conserva luces y sombras) · duotone = blanco y negro en dos tintas de la paleta. */
|
|
12
|
+
type AuthMediaTint = "none" | "brand" | "duotone";
|
|
13
|
+
declare function AuthLayout({ preset, surface, shape, backdrop, backdropMedia, backdropGlass, asideBackdrop, interactive, motion, side, logo, aside, media, mediaTint, toolbar, footer, className, children, ...props }: React.ComponentProps<"div"> & {
|
|
14
|
+
preset?: AuthLayoutPreset;
|
|
15
|
+
/** Superficie de la tarjeta. */
|
|
16
|
+
surface?: AuthSurface;
|
|
17
|
+
/** Forma de la tarjeta. */
|
|
18
|
+
shape?: AuthShape;
|
|
19
|
+
/** Fondo animado del lienzo. */
|
|
20
|
+
backdrop?: AuthBackdropVariant;
|
|
21
|
+
/** backdrop="image": la foto o el vídeo del lienzo (si falta, usa `media`). Se tiñe con `mediaTint`. */
|
|
22
|
+
backdropMedia?: React.ReactNode;
|
|
23
|
+
/** Cristal esmerilado sobre el fondo del lienzo («mesh + glass», «image + glass»). */
|
|
24
|
+
backdropGlass?: boolean;
|
|
25
|
+
/** Fondo animado del panel de marca (split, banner). */
|
|
26
|
+
asideBackdrop?: AuthBackdropVariant;
|
|
27
|
+
/** Foco que sigue al puntero en el fondo. */
|
|
28
|
+
interactive?: boolean;
|
|
29
|
+
/** full = fondo animado y entrada · entrance = solo la entrada · off = quieto. */
|
|
30
|
+
motion?: AuthMotion;
|
|
31
|
+
/** split: lado del panel de marca · cover: lado de la tarjeta. */
|
|
32
|
+
side?: "start" | "end";
|
|
33
|
+
/** Logo de la app (imagen o SVG; su alto lo fija --ds-auth-logo-h). */
|
|
34
|
+
logo?: React.ReactNode;
|
|
35
|
+
/** Panel de marca (split, banner): normalmente <AuthAside>. */
|
|
36
|
+
aside?: React.ReactNode;
|
|
37
|
+
/** cover: imagen o vídeo de fondo (la app lo pone; se recorta a pantalla completa). */
|
|
38
|
+
media?: React.ReactNode;
|
|
39
|
+
/** cover: tinte de marca sobre `media` (la foto se adapta al color de la marca). */
|
|
40
|
+
mediaTint?: AuthMediaTint;
|
|
41
|
+
/** Esquina superior: idioma y tema, siempre visibles. */
|
|
42
|
+
toolbar?: React.ReactNode;
|
|
43
|
+
/** Pie: enlaces legales, versión, soporte. */
|
|
44
|
+
footer?: React.ReactNode;
|
|
45
|
+
}): React.JSX.Element;
|
|
46
|
+
declare function AuthAside({ logo, backdrop, media, mediaTint, className, children, ...props }: React.ComponentProps<"aside"> & {
|
|
47
|
+
/** Logo arriba del panel (en split, la maqueta lo quita del formulario en ancho). */
|
|
48
|
+
logo?: React.ReactNode;
|
|
49
|
+
/** Fondo animado del panel (por defecto, el del preset). */
|
|
50
|
+
backdrop?: AuthBackdropVariant;
|
|
51
|
+
/** Imagen o vídeo del panel (sustituye al degradado; el texto se lee sobre un velo de la marca). */
|
|
52
|
+
media?: React.ReactNode;
|
|
53
|
+
/** Tinte de marca sobre `media` (por defecto brand: la foto toma el color de la marca). */
|
|
54
|
+
mediaTint?: AuthMediaTint;
|
|
55
|
+
}): React.JSX.Element;
|
|
56
|
+
declare function AuthAsideEyebrow({ className, ...props }: React.ComponentProps<"p">): React.JSX.Element;
|
|
57
|
+
declare function AuthAsideTitle({ className, ...props }: React.ComponentProps<"h2">): React.JSX.Element;
|
|
58
|
+
declare function AuthAsideText({ className, ...props }: React.ComponentProps<"p">): React.JSX.Element;
|
|
59
|
+
declare function AuthAsidePoints({ className, ...props }: React.ComponentProps<"ul">): React.JSX.Element;
|
|
60
|
+
declare function AuthAsidePoint({ icon, className, children, ...props }: React.ComponentProps<"li"> & {
|
|
61
|
+
icon?: React.ReactNode;
|
|
62
|
+
}): React.JSX.Element;
|
|
63
|
+
declare function AuthAsideQuote({ author, role, avatar, className, children, ...props }: React.ComponentProps<"figure"> & {
|
|
64
|
+
author?: React.ReactNode;
|
|
65
|
+
role?: React.ReactNode;
|
|
66
|
+
avatar?: React.ReactNode;
|
|
67
|
+
}): React.JSX.Element;
|
|
68
|
+
declare function AuthAsideFooter({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
69
|
+
|
|
70
|
+
export { AuthAside, AuthAsideEyebrow, AuthAsideFooter, AuthAsidePoint, AuthAsidePoints, AuthAsideQuote, AuthAsideText, AuthAsideTitle, AuthLayout, type AuthLayoutPreset, type AuthMediaTint, type AuthMotion, type AuthShape, type AuthSurface, useAuthMotion };
|