orbital-ds 0.28.0 → 0.29.1
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 +289 -273
- package/components.manifest.json +410 -7
- package/dist/hooks/use-ds-messages.d.ts +196 -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 +59 -0
- package/dist/lib/auth-flow.js +135 -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/i18n.d.ts +196 -0
- package/dist/lib/i18n.js +597 -3
- package/dist/styles.css +419 -3
- package/dist/themes/lagoon.css +8 -8
- package/dist/themes/lagoon.meta.json +3 -2
- package/dist/themes/lagoon.scoped.css +8 -8
- package/dist/ui/auth-backdrop.d.ts +20 -0
- package/dist/ui/auth-backdrop.js +137 -0
- package/dist/ui/auth-form.d.ts +107 -0
- package/dist/ui/auth-form.js +526 -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/connected-accounts.d.ts +25 -0
- package/dist/ui/connected-accounts.js +89 -0
- 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/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/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 +12 -4
- package/dist/ui/sidebar.js +35 -5
- 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/docs/designer/patrones.md +21 -0
- package/docs/designer/revision.md +8 -0
- package/package.json +187 -187
- package/scripts/brand-core.d.mts +2 -0
- package/scripts/brand-core.mjs +21 -1
- package/scripts/doctor.mjs +3 -0
- package/scripts/init.mjs +7 -3
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { cn } from "../lib/utils.js";
|
|
5
|
+
const INERTIA = 0.06;
|
|
6
|
+
function AuthBackdrop({
|
|
7
|
+
variant = "dots",
|
|
8
|
+
interactive = false,
|
|
9
|
+
ink = "canvas",
|
|
10
|
+
animated = true,
|
|
11
|
+
media,
|
|
12
|
+
mediaTint = "brand",
|
|
13
|
+
glass = false,
|
|
14
|
+
className,
|
|
15
|
+
...props
|
|
16
|
+
}) {
|
|
17
|
+
const ref = React.useRef(null);
|
|
18
|
+
React.useEffect(() => {
|
|
19
|
+
const el = ref.current;
|
|
20
|
+
const host = el?.parentElement;
|
|
21
|
+
if (!interactive || !animated || !el || !host || typeof window === "undefined") return;
|
|
22
|
+
const quiet = window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;
|
|
23
|
+
const fine = window.matchMedia?.("(pointer: fine)").matches;
|
|
24
|
+
if (quiet || fine === false) return;
|
|
25
|
+
const target = { x: 0, y: 0 };
|
|
26
|
+
const now = { x: 0, y: 0 };
|
|
27
|
+
let frame = 0;
|
|
28
|
+
const tick = () => {
|
|
29
|
+
now.x += (target.x - now.x) * INERTIA;
|
|
30
|
+
now.y += (target.y - now.y) * INERTIA;
|
|
31
|
+
el.style.setProperty("--ds-auth-px", now.x.toFixed(4));
|
|
32
|
+
el.style.setProperty("--ds-auth-py", now.y.toFixed(4));
|
|
33
|
+
frame = Math.abs(target.x - now.x) + Math.abs(target.y - now.y) > 1e-3 ? requestAnimationFrame(tick) : 0;
|
|
34
|
+
};
|
|
35
|
+
const kick = () => {
|
|
36
|
+
if (!frame) frame = requestAnimationFrame(tick);
|
|
37
|
+
};
|
|
38
|
+
const move = (event) => {
|
|
39
|
+
const box = host.getBoundingClientRect();
|
|
40
|
+
target.x = (event.clientX - box.left) / box.width * 2 - 1;
|
|
41
|
+
target.y = (event.clientY - box.top) / box.height * 2 - 1;
|
|
42
|
+
kick();
|
|
43
|
+
};
|
|
44
|
+
const leave = () => {
|
|
45
|
+
target.x = 0;
|
|
46
|
+
target.y = 0;
|
|
47
|
+
kick();
|
|
48
|
+
};
|
|
49
|
+
host.addEventListener("pointermove", move);
|
|
50
|
+
host.addEventListener("pointerleave", leave);
|
|
51
|
+
return () => {
|
|
52
|
+
cancelAnimationFrame(frame);
|
|
53
|
+
host.removeEventListener("pointermove", move);
|
|
54
|
+
host.removeEventListener("pointerleave", leave);
|
|
55
|
+
};
|
|
56
|
+
}, [interactive, animated]);
|
|
57
|
+
if (variant === "none") return null;
|
|
58
|
+
const still = animated ? "motion-reduce:animate-none" : "animate-none";
|
|
59
|
+
const pattern = variant === "dots" ? "ds-auth-fx-dots" : "ds-auth-fx-grid";
|
|
60
|
+
return /* @__PURE__ */ jsxs(
|
|
61
|
+
"div",
|
|
62
|
+
{
|
|
63
|
+
ref,
|
|
64
|
+
"aria-hidden": "true",
|
|
65
|
+
"data-slot": "auth-backdrop",
|
|
66
|
+
"data-variant": variant,
|
|
67
|
+
className: cn(
|
|
68
|
+
"pointer-events-none absolute inset-0 -z-0 overflow-hidden",
|
|
69
|
+
ink === "brand" ? "[--ds-auth-fx-ink:var(--ds-auth-aside-fg)]" : "[--ds-auth-fx-ink:var(--foreground)]",
|
|
70
|
+
className
|
|
71
|
+
),
|
|
72
|
+
...props,
|
|
73
|
+
children: [
|
|
74
|
+
/* @__PURE__ */ jsxs("div", { "data-slot": "auth-backdrop-depth", className: "absolute -inset-(--ds-auth-parallax) ds-auth-fx-depth", children: [
|
|
75
|
+
variant === "image" && media ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
76
|
+
/* @__PURE__ */ jsx(
|
|
77
|
+
"div",
|
|
78
|
+
{
|
|
79
|
+
"data-slot": "auth-backdrop-media",
|
|
80
|
+
"data-tint": mediaTint,
|
|
81
|
+
className: cn(
|
|
82
|
+
"absolute inset-0 [&>*]:size-full [&>img]:object-cover [&>video]:object-cover animate-ds-auth-zoom",
|
|
83
|
+
mediaTint === "duotone" && "grayscale contrast-125",
|
|
84
|
+
still
|
|
85
|
+
),
|
|
86
|
+
children: media
|
|
87
|
+
}
|
|
88
|
+
),
|
|
89
|
+
mediaTint === "brand" ? /* @__PURE__ */ jsx("div", { className: "absolute inset-0 bg-(--ds-auth-media-tint) mix-blend-color" }) : null,
|
|
90
|
+
mediaTint === "duotone" ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
91
|
+
/* @__PURE__ */ jsx("div", { className: "absolute inset-0 bg-(--ds-auth-media-duo-dark) mix-blend-screen" }),
|
|
92
|
+
/* @__PURE__ */ jsx("div", { className: "absolute inset-0 bg-(--ds-auth-media-duo-light) mix-blend-multiply" })
|
|
93
|
+
] }) : null,
|
|
94
|
+
/* @__PURE__ */ jsx("div", { className: "absolute inset-0 bg-(--ds-auth-fx-image-veil)" })
|
|
95
|
+
] }) : null,
|
|
96
|
+
variant === "dots" || variant === "grid" ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
97
|
+
/* @__PURE__ */ jsx("div", { className: cn("absolute inset-0", pattern) }),
|
|
98
|
+
/* @__PURE__ */ jsx("div", { className: cn("absolute inset-0 ds-auth-fx-sweep animate-ds-auth-sweep", pattern, still) })
|
|
99
|
+
] }) : null,
|
|
100
|
+
variant === "aurora" ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
101
|
+
/* @__PURE__ */ jsx("div", { className: cn("ds-auth-fx-ribbon top-[5%] animate-ds-auth-wave", still) }),
|
|
102
|
+
/* @__PURE__ */ jsx("div", { className: cn("ds-auth-fx-ribbon top-[35%] animate-ds-auth-wave-reverse", still) }),
|
|
103
|
+
/* @__PURE__ */ jsx("div", { className: cn("ds-auth-fx-blob start-[25%] -bottom-[25%] size-[50%] bg-(--ds-auth-fx-3) animate-ds-auth-float-c", still) })
|
|
104
|
+
] }) : null,
|
|
105
|
+
variant === "mesh" ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
106
|
+
/* @__PURE__ */ jsx("div", { className: cn("ds-auth-fx-blob -start-[10%] -top-[15%] size-[65%] bg-(--ds-auth-fx-1) animate-ds-auth-float-a", still) }),
|
|
107
|
+
/* @__PURE__ */ jsx("div", { className: cn("ds-auth-fx-blob -end-[10%] top-[5%] size-[60%] bg-(--ds-auth-fx-2) animate-ds-auth-float-b", still) }),
|
|
108
|
+
/* @__PURE__ */ jsx("div", { className: cn("ds-auth-fx-blob start-[15%] -bottom-[20%] size-[55%] bg-(--ds-auth-fx-3) animate-ds-auth-float-c", still) }),
|
|
109
|
+
/* @__PURE__ */ jsx("div", { className: cn("ds-auth-fx-blob end-[10%] -bottom-[10%] size-[45%] bg-(--ds-auth-fx-4) animate-ds-auth-float-d", still) })
|
|
110
|
+
] }) : null,
|
|
111
|
+
variant === "glow" ? /* @__PURE__ */ jsx(
|
|
112
|
+
"div",
|
|
113
|
+
{
|
|
114
|
+
className: cn(
|
|
115
|
+
"absolute start-1/2 top-1/2 size-(--ds-auth-glow-size) -translate-x-1/2 -translate-y-1/2 rtl:translate-x-1/2",
|
|
116
|
+
"ds-auth-fx-glow animate-ds-auth-breathe",
|
|
117
|
+
still
|
|
118
|
+
)
|
|
119
|
+
}
|
|
120
|
+
) : null,
|
|
121
|
+
variant === "rings" ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
122
|
+
/* @__PURE__ */ jsx("div", { className: cn("ds-auth-fx-ring w-[45%] min-w-(--ds-auth-glow-size) aspect-square animate-ds-auth-spin", still), children: /* @__PURE__ */ jsx("span", { className: "ds-auth-fx-satellite" }) }),
|
|
123
|
+
/* @__PURE__ */ jsx("div", { className: cn("ds-auth-fx-ring w-[75%] aspect-square animate-ds-auth-spin-reverse", still), children: /* @__PURE__ */ jsx("span", { className: "ds-auth-fx-satellite" }) }),
|
|
124
|
+
/* @__PURE__ */ jsx("div", { className: "ds-auth-fx-ring w-[110%] aspect-square" }),
|
|
125
|
+
/* @__PURE__ */ jsx("div", { className: cn("absolute start-1/2 top-1/2 size-(--ds-auth-glow-size) -translate-x-1/2 -translate-y-1/2 rtl:translate-x-1/2 ds-auth-fx-glow animate-ds-auth-breathe", still) })
|
|
126
|
+
] }) : null,
|
|
127
|
+
variant === "beams" ? /* @__PURE__ */ jsx("div", { className: cn("absolute -inset-[30%] ds-auth-fx-beams animate-ds-auth-spin", still) }) : null
|
|
128
|
+
] }),
|
|
129
|
+
glass ? /* @__PURE__ */ jsx("div", { "data-slot": "auth-backdrop-glass", className: "absolute inset-0 ds-auth-fx-glass" }) : null,
|
|
130
|
+
variant === "aurora" || variant === "mesh" || variant === "beams" || glass ? /* @__PURE__ */ jsx("div", { className: "absolute inset-0 ds-auth-fx-grain" }) : null
|
|
131
|
+
]
|
|
132
|
+
}
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
export {
|
|
136
|
+
AuthBackdrop
|
|
137
|
+
};
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { AuthErrorCode, AuthField, PasswordRules, AuthProviderOption, AuthLink } from '../lib/auth.js';
|
|
3
|
+
import '../lib/i18n.js';
|
|
4
|
+
|
|
5
|
+
type AuthFormPreset = "sign-in" | "social" | "sign-up" | "magic-link" | "email-code" | "sso" | "forgot-password" | "reset-password";
|
|
6
|
+
type AuthIdentifierKind = "email" | "username" | "email-or-username";
|
|
7
|
+
type AuthMessage = AuthErrorCode | React.ReactNode;
|
|
8
|
+
type AuthFormValues = {
|
|
9
|
+
identifier: string;
|
|
10
|
+
password: string;
|
|
11
|
+
name: string;
|
|
12
|
+
confirmPassword: string;
|
|
13
|
+
remember: boolean;
|
|
14
|
+
terms: boolean;
|
|
15
|
+
/** Campos extra (`extraFields`) y todo lo demás del formulario. */
|
|
16
|
+
formData: FormData;
|
|
17
|
+
};
|
|
18
|
+
type AuthOrganization = {
|
|
19
|
+
id: string;
|
|
20
|
+
label: React.ReactNode;
|
|
21
|
+
description?: React.ReactNode;
|
|
22
|
+
icon?: React.ReactNode;
|
|
23
|
+
};
|
|
24
|
+
/** Lo que devuelve un callback: error general, errores por campo o la vista siguiente. */
|
|
25
|
+
type AuthResult = void | undefined | {
|
|
26
|
+
error?: AuthMessage;
|
|
27
|
+
fieldErrors?: Partial<Record<AuthField, AuthMessage>>;
|
|
28
|
+
next?: "password" | "code" | "sent" | "sso" | "redirecting";
|
|
29
|
+
};
|
|
30
|
+
/** Ruta que decide la app para un identificador (home realm discovery). */
|
|
31
|
+
type AuthRoute = void | undefined | {
|
|
32
|
+
method: "password" | "sso" | "passkey" | "email-code" | "magic-link";
|
|
33
|
+
/** SSO con varias organizaciones para el mismo dominio: se deja elegir. */
|
|
34
|
+
organizations?: AuthOrganization[];
|
|
35
|
+
error?: AuthMessage;
|
|
36
|
+
};
|
|
37
|
+
declare function AuthForm({ preset, title, description, icon, identifier, defaultIdentifier, identifierFirst, onIdentify, fields, extraFields, passwordRules, showStrength, remember, providers, onProvider, providersPlacement, providersLayout, onPasskey, onSso, ssoBy, lastUsed, onSubmit, onVerifyCode, onResend, resendAfter, codeLength, error: errorProp, fieldErrors: fieldErrorsProp, links, submitLabel, footer, className, ...props }: Omit<React.ComponentProps<"div">, "title" | "onSubmit"> & {
|
|
38
|
+
preset?: AuthFormPreset;
|
|
39
|
+
title?: React.ReactNode;
|
|
40
|
+
description?: React.ReactNode;
|
|
41
|
+
/** Icono sobre el título (IconTile, logo de la app…). */
|
|
42
|
+
icon?: React.ReactNode;
|
|
43
|
+
/** Qué identifica a la persona. */
|
|
44
|
+
identifier?: AuthIdentifierKind;
|
|
45
|
+
defaultIdentifier?: string;
|
|
46
|
+
/** sign-in: primero el identificador; luego el método que toque. */
|
|
47
|
+
identifierFirst?: boolean;
|
|
48
|
+
/** Home realm discovery: la app dice qué método le toca a ese identificador. */
|
|
49
|
+
onIdentify?: (identifier: string) => AuthRoute | Promise<AuthRoute>;
|
|
50
|
+
/** Campos y orden (sign-up y reset-password). */
|
|
51
|
+
fields?: AuthField[];
|
|
52
|
+
/** Campos propios de la app, antes del botón (llegan en `formData`). */
|
|
53
|
+
extraFields?: React.ReactNode;
|
|
54
|
+
passwordRules?: PasswordRules;
|
|
55
|
+
/** Barra de fuerza de la contraseña (sign-up y reset-password por defecto). */
|
|
56
|
+
showStrength?: boolean;
|
|
57
|
+
/** Casilla «mantener la sesión iniciada». */
|
|
58
|
+
remember?: boolean;
|
|
59
|
+
/** SSO o redes sociales (la app pone nombre e icono). */
|
|
60
|
+
providers?: AuthProviderOption[];
|
|
61
|
+
onProvider?: (id: string) => void | Promise<AuthResult>;
|
|
62
|
+
providersPlacement?: "top" | "bottom";
|
|
63
|
+
providersLayout?: "stack" | "grid" | "icons";
|
|
64
|
+
/** Entrar con passkey (y autocompletado de passkeys en el campo del identificador). */
|
|
65
|
+
onPasskey?: () => void | Promise<AuthResult>;
|
|
66
|
+
/** SSO de empresa: enlace «usar SSO» en sign-in y envío del preset sso. */
|
|
67
|
+
onSso?: (input: {
|
|
68
|
+
identifier: string;
|
|
69
|
+
organization?: string;
|
|
70
|
+
}) => AuthResult | Promise<AuthResult | {
|
|
71
|
+
organizations: AuthOrganization[];
|
|
72
|
+
}>;
|
|
73
|
+
/** sso: se identifica por correo de trabajo o por organización. */
|
|
74
|
+
ssoBy?: "email" | "organization";
|
|
75
|
+
/** Último método usado en este dispositivo: id de proveedor, "passkey", "sso" o "password". */
|
|
76
|
+
lastUsed?: string | null;
|
|
77
|
+
onSubmit?: (values: AuthFormValues) => AuthResult | Promise<AuthResult>;
|
|
78
|
+
/** email-code: verifica el código (se llama al completarse). */
|
|
79
|
+
onVerifyCode?: (code: string, values: {
|
|
80
|
+
identifier: string;
|
|
81
|
+
}) => AuthResult | Promise<AuthResult>;
|
|
82
|
+
/** Reenviar enlace o código. */
|
|
83
|
+
onResend?: (values: {
|
|
84
|
+
identifier: string;
|
|
85
|
+
}) => void | Promise<void>;
|
|
86
|
+
/** Segundos hasta poder reenviar. */
|
|
87
|
+
resendAfter?: number;
|
|
88
|
+
codeLength?: number;
|
|
89
|
+
/** Error controlado por la app. */
|
|
90
|
+
error?: AuthMessage;
|
|
91
|
+
fieldErrors?: Partial<Record<AuthField, AuthMessage>>;
|
|
92
|
+
/** Enlaces: URL o función del router. */
|
|
93
|
+
links?: {
|
|
94
|
+
signIn?: AuthLink;
|
|
95
|
+
email?: AuthLink;
|
|
96
|
+
signUp?: AuthLink;
|
|
97
|
+
requestAccess?: AuthLink;
|
|
98
|
+
forgotPassword?: AuthLink;
|
|
99
|
+
terms?: AuthLink;
|
|
100
|
+
privacy?: AuthLink;
|
|
101
|
+
};
|
|
102
|
+
submitLabel?: React.ReactNode;
|
|
103
|
+
/** Sustituye el pie de enlaces. */
|
|
104
|
+
footer?: React.ReactNode;
|
|
105
|
+
}): React.JSX.Element;
|
|
106
|
+
|
|
107
|
+
export { AuthForm, type AuthFormPreset, type AuthFormValues, type AuthOrganization, type AuthResult, type AuthRoute };
|