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,194 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { AuthProviderOption } from './auth.js';
|
|
3
|
+
import './i18n.js';
|
|
4
|
+
|
|
5
|
+
type AuthProviderKind = "social" | "enterprise";
|
|
6
|
+
type AuthProviderInfo = {
|
|
7
|
+
/** Identificador de Better Auth. */
|
|
8
|
+
id: string;
|
|
9
|
+
/** Nombre propio de la marca (no se traduce). */
|
|
10
|
+
label: string;
|
|
11
|
+
kind: AuthProviderKind;
|
|
12
|
+
};
|
|
13
|
+
/** Proveedores sociales de Better Auth (`socialProviders`). */
|
|
14
|
+
declare const AUTH_SOCIAL_PROVIDERS: readonly [{
|
|
15
|
+
readonly id: "google";
|
|
16
|
+
readonly label: "Google";
|
|
17
|
+
readonly kind: "social";
|
|
18
|
+
}, {
|
|
19
|
+
readonly id: "microsoft";
|
|
20
|
+
readonly label: "Microsoft";
|
|
21
|
+
readonly kind: "social";
|
|
22
|
+
}, {
|
|
23
|
+
readonly id: "apple";
|
|
24
|
+
readonly label: "Apple";
|
|
25
|
+
readonly kind: "social";
|
|
26
|
+
}, {
|
|
27
|
+
readonly id: "github";
|
|
28
|
+
readonly label: "GitHub";
|
|
29
|
+
readonly kind: "social";
|
|
30
|
+
}, {
|
|
31
|
+
readonly id: "gitlab";
|
|
32
|
+
readonly label: "GitLab";
|
|
33
|
+
readonly kind: "social";
|
|
34
|
+
}, {
|
|
35
|
+
readonly id: "facebook";
|
|
36
|
+
readonly label: "Facebook";
|
|
37
|
+
readonly kind: "social";
|
|
38
|
+
}, {
|
|
39
|
+
readonly id: "twitter";
|
|
40
|
+
readonly label: "X";
|
|
41
|
+
readonly kind: "social";
|
|
42
|
+
}, {
|
|
43
|
+
readonly id: "linkedin";
|
|
44
|
+
readonly label: "LinkedIn";
|
|
45
|
+
readonly kind: "social";
|
|
46
|
+
}, {
|
|
47
|
+
readonly id: "discord";
|
|
48
|
+
readonly label: "Discord";
|
|
49
|
+
readonly kind: "social";
|
|
50
|
+
}, {
|
|
51
|
+
readonly id: "slack";
|
|
52
|
+
readonly label: "Slack";
|
|
53
|
+
readonly kind: "social";
|
|
54
|
+
}, {
|
|
55
|
+
readonly id: "atlassian";
|
|
56
|
+
readonly label: "Atlassian";
|
|
57
|
+
readonly kind: "social";
|
|
58
|
+
}, {
|
|
59
|
+
readonly id: "notion";
|
|
60
|
+
readonly label: "Notion";
|
|
61
|
+
readonly kind: "social";
|
|
62
|
+
}, {
|
|
63
|
+
readonly id: "linear";
|
|
64
|
+
readonly label: "Linear";
|
|
65
|
+
readonly kind: "social";
|
|
66
|
+
}, {
|
|
67
|
+
readonly id: "figma";
|
|
68
|
+
readonly label: "Figma";
|
|
69
|
+
readonly kind: "social";
|
|
70
|
+
}, {
|
|
71
|
+
readonly id: "salesforce";
|
|
72
|
+
readonly label: "Salesforce";
|
|
73
|
+
readonly kind: "social";
|
|
74
|
+
}, {
|
|
75
|
+
readonly id: "dropbox";
|
|
76
|
+
readonly label: "Dropbox";
|
|
77
|
+
readonly kind: "social";
|
|
78
|
+
}, {
|
|
79
|
+
readonly id: "zoom";
|
|
80
|
+
readonly label: "Zoom";
|
|
81
|
+
readonly kind: "social";
|
|
82
|
+
}, {
|
|
83
|
+
readonly id: "spotify";
|
|
84
|
+
readonly label: "Spotify";
|
|
85
|
+
readonly kind: "social";
|
|
86
|
+
}, {
|
|
87
|
+
readonly id: "twitch";
|
|
88
|
+
readonly label: "Twitch";
|
|
89
|
+
readonly kind: "social";
|
|
90
|
+
}, {
|
|
91
|
+
readonly id: "tiktok";
|
|
92
|
+
readonly label: "TikTok";
|
|
93
|
+
readonly kind: "social";
|
|
94
|
+
}, {
|
|
95
|
+
readonly id: "reddit";
|
|
96
|
+
readonly label: "Reddit";
|
|
97
|
+
readonly kind: "social";
|
|
98
|
+
}, {
|
|
99
|
+
readonly id: "paypal";
|
|
100
|
+
readonly label: "PayPal";
|
|
101
|
+
readonly kind: "social";
|
|
102
|
+
}, {
|
|
103
|
+
readonly id: "huggingface";
|
|
104
|
+
readonly label: "Hugging Face";
|
|
105
|
+
readonly kind: "social";
|
|
106
|
+
}, {
|
|
107
|
+
readonly id: "vercel";
|
|
108
|
+
readonly label: "Vercel";
|
|
109
|
+
readonly kind: "social";
|
|
110
|
+
}, {
|
|
111
|
+
readonly id: "cognito";
|
|
112
|
+
readonly label: "Amazon Cognito";
|
|
113
|
+
readonly kind: "social";
|
|
114
|
+
}, {
|
|
115
|
+
readonly id: "roblox";
|
|
116
|
+
readonly label: "Roblox";
|
|
117
|
+
readonly kind: "social";
|
|
118
|
+
}, {
|
|
119
|
+
readonly id: "kick";
|
|
120
|
+
readonly label: "Kick";
|
|
121
|
+
readonly kind: "social";
|
|
122
|
+
}, {
|
|
123
|
+
readonly id: "vk";
|
|
124
|
+
readonly label: "VK";
|
|
125
|
+
readonly kind: "social";
|
|
126
|
+
}, {
|
|
127
|
+
readonly id: "kakao";
|
|
128
|
+
readonly label: "Kakao";
|
|
129
|
+
readonly kind: "social";
|
|
130
|
+
}, {
|
|
131
|
+
readonly id: "naver";
|
|
132
|
+
readonly label: "Naver";
|
|
133
|
+
readonly kind: "social";
|
|
134
|
+
}, {
|
|
135
|
+
readonly id: "line";
|
|
136
|
+
readonly label: "LINE";
|
|
137
|
+
readonly kind: "social";
|
|
138
|
+
}];
|
|
139
|
+
/**
|
|
140
|
+
* Proveedores de identidad de empresa (Better Auth `sso` con OIDC o SAML, o `genericOAuth`).
|
|
141
|
+
* En el formulario van por la vista SSO (correo de trabajo u organización), no como botones
|
|
142
|
+
* sueltos; se listan como botón solo si la app tiene un único IdP conocido.
|
|
143
|
+
*/
|
|
144
|
+
declare const AUTH_ENTERPRISE_PROVIDERS: readonly [{
|
|
145
|
+
readonly id: "entra-id";
|
|
146
|
+
readonly label: "Microsoft Entra ID";
|
|
147
|
+
readonly kind: "enterprise";
|
|
148
|
+
}, {
|
|
149
|
+
readonly id: "google-workspace";
|
|
150
|
+
readonly label: "Google Workspace";
|
|
151
|
+
readonly kind: "enterprise";
|
|
152
|
+
}, {
|
|
153
|
+
readonly id: "okta";
|
|
154
|
+
readonly label: "Okta";
|
|
155
|
+
readonly kind: "enterprise";
|
|
156
|
+
}, {
|
|
157
|
+
readonly id: "auth0";
|
|
158
|
+
readonly label: "Auth0";
|
|
159
|
+
readonly kind: "enterprise";
|
|
160
|
+
}, {
|
|
161
|
+
readonly id: "keycloak";
|
|
162
|
+
readonly label: "Keycloak";
|
|
163
|
+
readonly kind: "enterprise";
|
|
164
|
+
}, {
|
|
165
|
+
readonly id: "onelogin";
|
|
166
|
+
readonly label: "OneLogin";
|
|
167
|
+
readonly kind: "enterprise";
|
|
168
|
+
}, {
|
|
169
|
+
readonly id: "jumpcloud";
|
|
170
|
+
readonly label: "JumpCloud";
|
|
171
|
+
readonly kind: "enterprise";
|
|
172
|
+
}, {
|
|
173
|
+
readonly id: "ping";
|
|
174
|
+
readonly label: "Ping Identity";
|
|
175
|
+
readonly kind: "enterprise";
|
|
176
|
+
}, {
|
|
177
|
+
readonly id: "adfs";
|
|
178
|
+
readonly label: "AD FS";
|
|
179
|
+
readonly kind: "enterprise";
|
|
180
|
+
}];
|
|
181
|
+
/** Ids conocidos (autocompletado); se acepta cualquier otro texto. */
|
|
182
|
+
type AuthProviderId = (typeof AUTH_SOCIAL_PROVIDERS)[number]["id"] | (typeof AUTH_ENTERPRISE_PROVIDERS)[number]["id"] | (string & {});
|
|
183
|
+
/** Ficha de un proveedor (o `undefined` si no está en el catálogo). */
|
|
184
|
+
declare function authProviderInfo(id: string): AuthProviderInfo | undefined;
|
|
185
|
+
/**
|
|
186
|
+
* Lista de opciones para `AuthForm`/`AuthProviders` en el orden pedido. `icons` y `labels` los
|
|
187
|
+
* pone la app; `disabled` desactiva algunos (p. ej. mientras no hay credenciales en ese entorno).
|
|
188
|
+
*/
|
|
189
|
+
declare function authProviders(ids: readonly AuthProviderId[], icons?: Partial<Record<string, React.ReactNode>>, options?: {
|
|
190
|
+
labels?: Partial<Record<string, string>>;
|
|
191
|
+
disabled?: readonly string[];
|
|
192
|
+
}): AuthProviderOption[];
|
|
193
|
+
|
|
194
|
+
export { AUTH_ENTERPRISE_PROVIDERS, AUTH_SOCIAL_PROVIDERS, type AuthProviderId, type AuthProviderInfo, type AuthProviderKind, authProviderInfo, authProviders };
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
const AUTH_SOCIAL_PROVIDERS = [
|
|
2
|
+
{ id: "google", label: "Google", kind: "social" },
|
|
3
|
+
{ id: "microsoft", label: "Microsoft", kind: "social" },
|
|
4
|
+
{ id: "apple", label: "Apple", kind: "social" },
|
|
5
|
+
{ id: "github", label: "GitHub", kind: "social" },
|
|
6
|
+
{ id: "gitlab", label: "GitLab", kind: "social" },
|
|
7
|
+
{ id: "facebook", label: "Facebook", kind: "social" },
|
|
8
|
+
{ id: "twitter", label: "X", kind: "social" },
|
|
9
|
+
{ id: "linkedin", label: "LinkedIn", kind: "social" },
|
|
10
|
+
{ id: "discord", label: "Discord", kind: "social" },
|
|
11
|
+
{ id: "slack", label: "Slack", kind: "social" },
|
|
12
|
+
{ id: "atlassian", label: "Atlassian", kind: "social" },
|
|
13
|
+
{ id: "notion", label: "Notion", kind: "social" },
|
|
14
|
+
{ id: "linear", label: "Linear", kind: "social" },
|
|
15
|
+
{ id: "figma", label: "Figma", kind: "social" },
|
|
16
|
+
{ id: "salesforce", label: "Salesforce", kind: "social" },
|
|
17
|
+
{ id: "dropbox", label: "Dropbox", kind: "social" },
|
|
18
|
+
{ id: "zoom", label: "Zoom", kind: "social" },
|
|
19
|
+
{ id: "spotify", label: "Spotify", kind: "social" },
|
|
20
|
+
{ id: "twitch", label: "Twitch", kind: "social" },
|
|
21
|
+
{ id: "tiktok", label: "TikTok", kind: "social" },
|
|
22
|
+
{ id: "reddit", label: "Reddit", kind: "social" },
|
|
23
|
+
{ id: "paypal", label: "PayPal", kind: "social" },
|
|
24
|
+
{ id: "huggingface", label: "Hugging Face", kind: "social" },
|
|
25
|
+
{ id: "vercel", label: "Vercel", kind: "social" },
|
|
26
|
+
{ id: "cognito", label: "Amazon Cognito", kind: "social" },
|
|
27
|
+
{ id: "roblox", label: "Roblox", kind: "social" },
|
|
28
|
+
{ id: "kick", label: "Kick", kind: "social" },
|
|
29
|
+
{ id: "vk", label: "VK", kind: "social" },
|
|
30
|
+
{ id: "kakao", label: "Kakao", kind: "social" },
|
|
31
|
+
{ id: "naver", label: "Naver", kind: "social" },
|
|
32
|
+
{ id: "line", label: "LINE", kind: "social" }
|
|
33
|
+
];
|
|
34
|
+
const AUTH_ENTERPRISE_PROVIDERS = [
|
|
35
|
+
{ id: "entra-id", label: "Microsoft Entra ID", kind: "enterprise" },
|
|
36
|
+
{ id: "google-workspace", label: "Google Workspace", kind: "enterprise" },
|
|
37
|
+
{ id: "okta", label: "Okta", kind: "enterprise" },
|
|
38
|
+
{ id: "auth0", label: "Auth0", kind: "enterprise" },
|
|
39
|
+
{ id: "keycloak", label: "Keycloak", kind: "enterprise" },
|
|
40
|
+
{ id: "onelogin", label: "OneLogin", kind: "enterprise" },
|
|
41
|
+
{ id: "jumpcloud", label: "JumpCloud", kind: "enterprise" },
|
|
42
|
+
{ id: "ping", label: "Ping Identity", kind: "enterprise" },
|
|
43
|
+
{ id: "adfs", label: "AD FS", kind: "enterprise" }
|
|
44
|
+
];
|
|
45
|
+
const CATALOG = new Map(
|
|
46
|
+
[...AUTH_SOCIAL_PROVIDERS, ...AUTH_ENTERPRISE_PROVIDERS].map((p) => [p.id, p])
|
|
47
|
+
);
|
|
48
|
+
function authProviderInfo(id) {
|
|
49
|
+
return CATALOG.get(id);
|
|
50
|
+
}
|
|
51
|
+
function authProviders(ids, icons = {}, options = {}) {
|
|
52
|
+
return ids.map((id) => ({
|
|
53
|
+
id,
|
|
54
|
+
label: options.labels?.[id] ?? CATALOG.get(id)?.label ?? id,
|
|
55
|
+
icon: icons[id],
|
|
56
|
+
disabled: options.disabled?.includes(id) || void 0
|
|
57
|
+
}));
|
|
58
|
+
}
|
|
59
|
+
export {
|
|
60
|
+
AUTH_ENTERPRISE_PROVIDERS,
|
|
61
|
+
AUTH_SOCIAL_PROVIDERS,
|
|
62
|
+
authProviderInfo,
|
|
63
|
+
authProviders
|
|
64
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { DsMessages } from './i18n.js';
|
|
3
|
+
|
|
4
|
+
/** Errores de acceso con texto propio en los catálogos (en, es, pt-BR). */
|
|
5
|
+
type AuthErrorCode = "invalid-credentials" | "account-locked" | "too-many-attempts" | "email-not-verified" | "email-taken" | "weak-password" | "password-reused" | "invalid-code" | "expired-code" | "link-expired" | "session-expired" | "provider-failed" | "passkey-failed" | "network" | "unknown";
|
|
6
|
+
/** Campos que validan los formularios de acceso. */
|
|
7
|
+
type AuthField = "identifier" | "name" | "password" | "confirmPassword" | "terms" | "code" | "phone";
|
|
8
|
+
/** Proveedor externo (SSO, social). El icono y el nombre los pone la app: nada de marcas en el paquete. */
|
|
9
|
+
type AuthProviderOption = {
|
|
10
|
+
id: string;
|
|
11
|
+
label: React.ReactNode;
|
|
12
|
+
icon?: React.ReactNode;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
};
|
|
15
|
+
/** Métodos de segundo factor. */
|
|
16
|
+
type MfaMethod = "totp" | "sms" | "email" | "backup-code" | "passkey";
|
|
17
|
+
/** Enlace de navegación: una URL (se pinta como <a>) o una función (router de la app). */
|
|
18
|
+
type AuthLink = string | (() => void);
|
|
19
|
+
/** Reglas de contraseña nueva (sign-up, reset-password). */
|
|
20
|
+
type PasswordRules = {
|
|
21
|
+
minLength?: number;
|
|
22
|
+
lowercase?: boolean;
|
|
23
|
+
uppercase?: boolean;
|
|
24
|
+
number?: boolean;
|
|
25
|
+
symbol?: boolean;
|
|
26
|
+
};
|
|
27
|
+
declare const DEFAULT_PASSWORD_RULES: Required<PasswordRules>;
|
|
28
|
+
/** Texto de un error de acceso en el idioma activo. */
|
|
29
|
+
declare function authErrorMessage(t: DsMessages, code: AuthErrorCode): string;
|
|
30
|
+
/** Es un código de error conocido (y no un nodo de React con el texto de la app). */
|
|
31
|
+
declare function isAuthErrorCode(value: unknown): value is AuthErrorCode;
|
|
32
|
+
/** Correo con forma válida (la comprobación real es del servidor). */
|
|
33
|
+
declare function isValidEmail(value: string): boolean;
|
|
34
|
+
/** Qué reglas cumple una contraseña. */
|
|
35
|
+
declare function checkPassword(value: string, rules?: PasswordRules): {
|
|
36
|
+
rules: {
|
|
37
|
+
minLength: number;
|
|
38
|
+
lowercase: boolean;
|
|
39
|
+
uppercase: boolean;
|
|
40
|
+
number: boolean;
|
|
41
|
+
symbol: boolean;
|
|
42
|
+
};
|
|
43
|
+
checks: {
|
|
44
|
+
minLength: boolean;
|
|
45
|
+
lowercase: boolean;
|
|
46
|
+
uppercase: boolean;
|
|
47
|
+
number: boolean;
|
|
48
|
+
symbol: boolean;
|
|
49
|
+
};
|
|
50
|
+
valid: boolean;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Fuerza orientativa de 0 a 5 para PasswordStrength (longitud y variedad). Es una pista visual: la
|
|
54
|
+
* política real (listas de contraseñas filtradas, zxcvbn…) la aplica el servidor o la app.
|
|
55
|
+
*/
|
|
56
|
+
declare function passwordScore(value: string): number;
|
|
57
|
+
/** Cuenta atrás en segundos (reenviar código, sesión a punto de caducar). `start(n)` la reinicia. */
|
|
58
|
+
declare function useAuthCountdown(initial?: number): {
|
|
59
|
+
left: number;
|
|
60
|
+
start: (seconds: number) => void;
|
|
61
|
+
running: boolean;
|
|
62
|
+
};
|
|
63
|
+
/** mm:ss para una cuenta atrás. */
|
|
64
|
+
declare function formatCountdown(seconds: number): string;
|
|
65
|
+
/** Fecha de acceso legible en el idioma activo (sesiones, llaves de acceso). Un texto se deja tal cual. */
|
|
66
|
+
declare function formatAuthDate(value: string | number | Date | null | undefined, locale: string): string;
|
|
67
|
+
|
|
68
|
+
export { type AuthErrorCode, type AuthField, type AuthLink, type AuthProviderOption, DEFAULT_PASSWORD_RULES, type MfaMethod, type PasswordRules, authErrorMessage, checkPassword, formatAuthDate, formatCountdown, isAuthErrorCode, isValidEmail, passwordScore, useAuthCountdown };
|
package/dist/lib/auth.js
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
const DEFAULT_PASSWORD_RULES = {
|
|
3
|
+
minLength: 8,
|
|
4
|
+
lowercase: false,
|
|
5
|
+
uppercase: false,
|
|
6
|
+
number: false,
|
|
7
|
+
symbol: false
|
|
8
|
+
};
|
|
9
|
+
function authErrorMessage(t, code) {
|
|
10
|
+
const map = {
|
|
11
|
+
"invalid-credentials": t.authErrorInvalidCredentials,
|
|
12
|
+
"account-locked": t.authErrorAccountLocked,
|
|
13
|
+
"too-many-attempts": t.authErrorTooManyAttempts,
|
|
14
|
+
"email-not-verified": t.authErrorEmailNotVerified,
|
|
15
|
+
"email-taken": t.authErrorEmailTaken,
|
|
16
|
+
"weak-password": t.authErrorWeakPassword,
|
|
17
|
+
"password-reused": t.authErrorPasswordReused,
|
|
18
|
+
"invalid-code": t.authErrorInvalidCode,
|
|
19
|
+
"expired-code": t.authErrorExpiredCode,
|
|
20
|
+
"link-expired": t.authErrorLinkExpired,
|
|
21
|
+
"session-expired": t.authErrorSessionExpired,
|
|
22
|
+
"provider-failed": t.authErrorProviderFailed,
|
|
23
|
+
"passkey-failed": t.authErrorPasskeyFailed,
|
|
24
|
+
network: t.authErrorNetwork,
|
|
25
|
+
unknown: t.authErrorUnknown
|
|
26
|
+
};
|
|
27
|
+
return map[code];
|
|
28
|
+
}
|
|
29
|
+
function isAuthErrorCode(value) {
|
|
30
|
+
return typeof value === "string" && AUTH_ERROR_CODES.has(value);
|
|
31
|
+
}
|
|
32
|
+
const AUTH_ERROR_CODES = /* @__PURE__ */ new Set([
|
|
33
|
+
"invalid-credentials",
|
|
34
|
+
"account-locked",
|
|
35
|
+
"too-many-attempts",
|
|
36
|
+
"email-not-verified",
|
|
37
|
+
"email-taken",
|
|
38
|
+
"weak-password",
|
|
39
|
+
"password-reused",
|
|
40
|
+
"invalid-code",
|
|
41
|
+
"expired-code",
|
|
42
|
+
"link-expired",
|
|
43
|
+
"session-expired",
|
|
44
|
+
"provider-failed",
|
|
45
|
+
"passkey-failed",
|
|
46
|
+
"network",
|
|
47
|
+
"unknown"
|
|
48
|
+
]);
|
|
49
|
+
function isValidEmail(value) {
|
|
50
|
+
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value.trim());
|
|
51
|
+
}
|
|
52
|
+
function checkPassword(value, rules = {}) {
|
|
53
|
+
const r = { ...DEFAULT_PASSWORD_RULES, ...rules };
|
|
54
|
+
const checks = {
|
|
55
|
+
minLength: value.length >= r.minLength,
|
|
56
|
+
lowercase: !r.lowercase || /[a-z]/.test(value),
|
|
57
|
+
uppercase: !r.uppercase || /[A-Z]/.test(value),
|
|
58
|
+
number: !r.number || /\d/.test(value),
|
|
59
|
+
symbol: !r.symbol || /[^A-Za-z0-9]/.test(value)
|
|
60
|
+
};
|
|
61
|
+
return { rules: r, checks, valid: Object.values(checks).every(Boolean) };
|
|
62
|
+
}
|
|
63
|
+
function passwordScore(value) {
|
|
64
|
+
if (!value) return 0;
|
|
65
|
+
let score = 0;
|
|
66
|
+
if (value.length >= 8) score++;
|
|
67
|
+
if (value.length >= 12) score++;
|
|
68
|
+
if (/[a-z]/.test(value) && /[A-Z]/.test(value)) score++;
|
|
69
|
+
if (/\d/.test(value)) score++;
|
|
70
|
+
if (/[^A-Za-z0-9]/.test(value)) score++;
|
|
71
|
+
return Math.max(1, Math.min(5, score));
|
|
72
|
+
}
|
|
73
|
+
function useAuthCountdown(initial = 0) {
|
|
74
|
+
const [left, setLeft] = React.useState(initial);
|
|
75
|
+
React.useEffect(() => {
|
|
76
|
+
if (left <= 0) return;
|
|
77
|
+
const id = setTimeout(() => setLeft((s) => s - 1), 1e3);
|
|
78
|
+
return () => clearTimeout(id);
|
|
79
|
+
}, [left]);
|
|
80
|
+
const start = React.useCallback((seconds) => setLeft(Math.max(0, Math.round(seconds))), []);
|
|
81
|
+
return { left, start, running: left > 0 };
|
|
82
|
+
}
|
|
83
|
+
function formatCountdown(seconds) {
|
|
84
|
+
const s = Math.max(0, Math.round(seconds));
|
|
85
|
+
return `${Math.floor(s / 60)}:${String(s % 60).padStart(2, "0")}`;
|
|
86
|
+
}
|
|
87
|
+
function formatAuthDate(value, locale) {
|
|
88
|
+
if (value == null || value === "") return "";
|
|
89
|
+
if (typeof value === "string" && Number.isNaN(Date.parse(value))) return value;
|
|
90
|
+
const date = value instanceof Date ? value : new Date(value);
|
|
91
|
+
const diff = (date.getTime() - Date.now()) / 1e3;
|
|
92
|
+
const abs = Math.abs(diff);
|
|
93
|
+
const rtf = new Intl.RelativeTimeFormat(locale, { numeric: "auto" });
|
|
94
|
+
if (abs < 60) return rtf.format(0, "second");
|
|
95
|
+
if (abs < 3600) return rtf.format(Math.round(diff / 60), "minute");
|
|
96
|
+
if (abs < 86400) return rtf.format(Math.round(diff / 3600), "hour");
|
|
97
|
+
if (abs < 86400 * 7) return rtf.format(Math.round(diff / 86400), "day");
|
|
98
|
+
return new Intl.DateTimeFormat(locale, { dateStyle: "medium" }).format(date);
|
|
99
|
+
}
|
|
100
|
+
export {
|
|
101
|
+
DEFAULT_PASSWORD_RULES,
|
|
102
|
+
authErrorMessage,
|
|
103
|
+
checkPassword,
|
|
104
|
+
formatAuthDate,
|
|
105
|
+
formatCountdown,
|
|
106
|
+
isAuthErrorCode,
|
|
107
|
+
isValidEmail,
|
|
108
|
+
passwordScore,
|
|
109
|
+
useAuthCountdown
|
|
110
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const TONES = {
|
|
2
|
+
neutral: "",
|
|
3
|
+
brand: "[--ds-header-control-fg:var(--ds-header-control-brand-fg)] [--ds-header-control-bg:var(--ds-header-control-brand-bg)] [--ds-header-control-hover-bg:var(--ds-header-control-brand-hover-bg)]",
|
|
4
|
+
soft: "[--ds-header-control-bg:var(--muted)]"
|
|
5
|
+
};
|
|
6
|
+
function headerControlClass(tone = "neutral") {
|
|
7
|
+
return [
|
|
8
|
+
"rounded-(--ds-header-control-radius) bg-(--ds-header-control-bg) text-(--ds-header-control-fg) hover:bg-(--ds-header-control-hover-bg) aria-expanded:bg-(--ds-header-control-hover-bg) active:bg-(--ds-header-control-active-bg)",
|
|
9
|
+
TONES[tone]
|
|
10
|
+
].join(" ");
|
|
11
|
+
}
|
|
12
|
+
export {
|
|
13
|
+
headerControlClass
|
|
14
|
+
};
|
package/dist/lib/i18n.d.ts
CHANGED
|
@@ -29,6 +29,11 @@ declare const en: {
|
|
|
29
29
|
sidebarToggle: string;
|
|
30
30
|
sidebarTitle: string;
|
|
31
31
|
sidebarDescription: string;
|
|
32
|
+
themeToggleLabel: string;
|
|
33
|
+
themeLight: string;
|
|
34
|
+
themeDark: string;
|
|
35
|
+
themeSystem: string;
|
|
36
|
+
localeSwitcherLabel: string;
|
|
32
37
|
questionnairePrevious: string;
|
|
33
38
|
questionnaireSkip: string;
|
|
34
39
|
questionnaireNext: string;
|
|
@@ -125,6 +130,7 @@ declare const en: {
|
|
|
125
130
|
statIncrease: string;
|
|
126
131
|
statDecrease: string;
|
|
127
132
|
statNoChange: string;
|
|
133
|
+
statOfTarget: string;
|
|
128
134
|
notificationsForYou: string;
|
|
129
135
|
notificationsGeneral: string;
|
|
130
136
|
notificationsHistory: string;
|
|
@@ -174,6 +180,205 @@ declare const en: {
|
|
|
174
180
|
weekLabel: string;
|
|
175
181
|
weekPrevious: string;
|
|
176
182
|
weekNext: string;
|
|
183
|
+
authOr: string;
|
|
184
|
+
authContinueWith: string;
|
|
185
|
+
authLastUsed: string;
|
|
186
|
+
authPasskey: string;
|
|
187
|
+
authShowPassword: string;
|
|
188
|
+
authHidePassword: string;
|
|
189
|
+
authCapsLock: string;
|
|
190
|
+
authSignInTitle: string;
|
|
191
|
+
authSignInDescription: string;
|
|
192
|
+
authSignUpTitle: string;
|
|
193
|
+
authSignUpDescription: string;
|
|
194
|
+
authMagicLinkTitle: string;
|
|
195
|
+
authMagicLinkDescription: string;
|
|
196
|
+
authEmailCodeTitle: string;
|
|
197
|
+
authEmailCodeDescription: string;
|
|
198
|
+
authSsoTitle: string;
|
|
199
|
+
authSsoDescription: string;
|
|
200
|
+
authSsoOrgDescription: string;
|
|
201
|
+
authForgotTitle: string;
|
|
202
|
+
authForgotDescription: string;
|
|
203
|
+
authResetTitle: string;
|
|
204
|
+
authResetDescription: string;
|
|
205
|
+
authSignInSubmit: string;
|
|
206
|
+
authSignUpSubmit: string;
|
|
207
|
+
authSendLink: string;
|
|
208
|
+
authSendCode: string;
|
|
209
|
+
authSsoSubmit: string;
|
|
210
|
+
authSendReset: string;
|
|
211
|
+
authResetSubmit: string;
|
|
212
|
+
authContinue: string;
|
|
213
|
+
authEmail: string;
|
|
214
|
+
authUsername: string;
|
|
215
|
+
authEmailOrUsername: string;
|
|
216
|
+
authName: string;
|
|
217
|
+
authPassword: string;
|
|
218
|
+
authNewPassword: string;
|
|
219
|
+
authConfirmPassword: string;
|
|
220
|
+
authWorkEmail: string;
|
|
221
|
+
authOrganization: string;
|
|
222
|
+
authRemember: string;
|
|
223
|
+
authForgotLink: string;
|
|
224
|
+
authTermsAccept: string;
|
|
225
|
+
authTermsLink: string;
|
|
226
|
+
authAnd: string;
|
|
227
|
+
authPrivacyLink: string;
|
|
228
|
+
authRequired: string;
|
|
229
|
+
authInvalidEmail: string;
|
|
230
|
+
authPasswordMismatch: string;
|
|
231
|
+
authTermsRequired: string;
|
|
232
|
+
authPasswordRules: string;
|
|
233
|
+
authRuleMinLength: string;
|
|
234
|
+
authRuleLowercase: string;
|
|
235
|
+
authRuleUppercase: string;
|
|
236
|
+
authRuleNumber: string;
|
|
237
|
+
authRuleSymbol: string;
|
|
238
|
+
authRuleMet: string;
|
|
239
|
+
authRulePending: string;
|
|
240
|
+
authCheckEmailTitle: string;
|
|
241
|
+
authLinkSentBody: string;
|
|
242
|
+
authResetSentBody: string;
|
|
243
|
+
authCodeSentBody: string;
|
|
244
|
+
authResend: string;
|
|
245
|
+
authResendIn: string;
|
|
246
|
+
authUseDifferentEmail: string;
|
|
247
|
+
authCode: string;
|
|
248
|
+
authVerify: string;
|
|
249
|
+
authChooseOrganization: string;
|
|
250
|
+
authSsoRedirecting: string;
|
|
251
|
+
authChange: string;
|
|
252
|
+
authUseSso: string;
|
|
253
|
+
authBackToSignIn: string;
|
|
254
|
+
authNoAccount: string;
|
|
255
|
+
authSignUpLink: string;
|
|
256
|
+
authNoAccess: string;
|
|
257
|
+
authRequestAccessLink: string;
|
|
258
|
+
authAudienceMixed: string;
|
|
259
|
+
authAudienceInternal: string;
|
|
260
|
+
authAccessInternal: string;
|
|
261
|
+
authAccessExternal: string;
|
|
262
|
+
authHaveAccount: string;
|
|
263
|
+
authSignInLink: string;
|
|
264
|
+
authMfaTitle: string;
|
|
265
|
+
authMfaTotpBody: string;
|
|
266
|
+
authMfaSmsBody: string;
|
|
267
|
+
authMfaEmailBody: string;
|
|
268
|
+
authMfaBackupBody: string;
|
|
269
|
+
authMfaPasskeyBody: string;
|
|
270
|
+
authMfaPasskeyAction: string;
|
|
271
|
+
authMfaTrustDevice: string;
|
|
272
|
+
authMfaTryAnother: string;
|
|
273
|
+
authMfaMethodTotp: string;
|
|
274
|
+
authMfaMethodSms: string;
|
|
275
|
+
authMfaMethodEmail: string;
|
|
276
|
+
authMfaMethodBackup: string;
|
|
277
|
+
authMfaMethodPasskey: string;
|
|
278
|
+
authBackupCode: string;
|
|
279
|
+
authBack: string;
|
|
280
|
+
authCancel: string;
|
|
281
|
+
authMfaBackupTitle: string;
|
|
282
|
+
authMfaBackupSetupBody: string;
|
|
283
|
+
authCopyAll: string;
|
|
284
|
+
authDownload: string;
|
|
285
|
+
authMfaBackupConfirm: string;
|
|
286
|
+
authDone: string;
|
|
287
|
+
authMfaSetupTotpTitle: string;
|
|
288
|
+
authMfaSetupTotpStep1: string;
|
|
289
|
+
authMfaSetupManual: string;
|
|
290
|
+
authMfaSetupTotpStep2: string;
|
|
291
|
+
authActivate: string;
|
|
292
|
+
authMfaSetupSmsTitle: string;
|
|
293
|
+
authMfaSetupSmsBody: string;
|
|
294
|
+
authPhone: string;
|
|
295
|
+
authSignedOutTitle: string;
|
|
296
|
+
authSignedOutBody: string;
|
|
297
|
+
authSignInAgain: string;
|
|
298
|
+
authSessionExpiredTitle: string;
|
|
299
|
+
authSessionExpiredBody: string;
|
|
300
|
+
authVerifyEmailTitle: string;
|
|
301
|
+
authVerifyEmailBody: string;
|
|
302
|
+
authEmailVerifiedTitle: string;
|
|
303
|
+
authEmailVerifiedBody: string;
|
|
304
|
+
authPasswordChangedTitle: string;
|
|
305
|
+
authPasswordChangedBody: string;
|
|
306
|
+
authAccountLockedTitle: string;
|
|
307
|
+
authAccountLockedBody: string;
|
|
308
|
+
authResetPasswordAction: string;
|
|
309
|
+
authLinkExpiredTitle: string;
|
|
310
|
+
authLinkExpiredBody: string;
|
|
311
|
+
authRequestNewLink: string;
|
|
312
|
+
authAccessDeniedTitle: string;
|
|
313
|
+
authAccessDeniedBody: string;
|
|
314
|
+
authBackHome: string;
|
|
315
|
+
authSignOutTitle: string;
|
|
316
|
+
authSignOutBody: string;
|
|
317
|
+
authSignOutAllDevices: string;
|
|
318
|
+
authSignOut: string;
|
|
319
|
+
authSessionTimeoutTitle: string;
|
|
320
|
+
authSessionTimeoutBody: string;
|
|
321
|
+
authSessionTimeoutLeft: string;
|
|
322
|
+
authSocialDescription: string;
|
|
323
|
+
authContinueWithEmail: string;
|
|
324
|
+
authOauthTitle: string;
|
|
325
|
+
authOauthBody: string;
|
|
326
|
+
authOauthMcpTitle: string;
|
|
327
|
+
authOauthMcpBody: string;
|
|
328
|
+
authOauthDeviceTitle: string;
|
|
329
|
+
authOauthDeviceBody: string;
|
|
330
|
+
authOauthDeviceCode: string;
|
|
331
|
+
authOauthDeviceConfirm: string;
|
|
332
|
+
authOauthVerified: string;
|
|
333
|
+
authOauthSwitchAccount: string;
|
|
334
|
+
authOauthUnverified: string;
|
|
335
|
+
authOauthPermissions: string;
|
|
336
|
+
authOauthSensitive: string;
|
|
337
|
+
authOauthAllow: string;
|
|
338
|
+
authOauthDeny: string;
|
|
339
|
+
authOauthRedirect: string;
|
|
340
|
+
authOauthRevokeNote: string;
|
|
341
|
+
authConnConnected: string;
|
|
342
|
+
authConnExpired: string;
|
|
343
|
+
authConnError: string;
|
|
344
|
+
authConnNotConnected: string;
|
|
345
|
+
authConnConnect: string;
|
|
346
|
+
authConnPending: string;
|
|
347
|
+
authConnReconnect: string;
|
|
348
|
+
authConnDisconnect: string;
|
|
349
|
+
authConnLastMethod: string;
|
|
350
|
+
authSessionActiveNow: string;
|
|
351
|
+
authSessionLastActive: string;
|
|
352
|
+
authSessionUnknownDevice: string;
|
|
353
|
+
authSessionCurrent: string;
|
|
354
|
+
authSessionRevoke: string;
|
|
355
|
+
authSessionRevokeOthers: string;
|
|
356
|
+
authPasskeysAdd: string;
|
|
357
|
+
authPasskeysEmptyTitle: string;
|
|
358
|
+
authPasskeysEmptyBody: string;
|
|
359
|
+
authPasskeysCreated: string;
|
|
360
|
+
authPasskeysLastUsed: string;
|
|
361
|
+
authPasskeysName: string;
|
|
362
|
+
authPasskeysSave: string;
|
|
363
|
+
authPasskeysRename: string;
|
|
364
|
+
authPasskeysDelete: string;
|
|
365
|
+
authPasskeysSynced: string;
|
|
366
|
+
authStaySignedIn: string;
|
|
367
|
+
authErrorInvalidCredentials: string;
|
|
368
|
+
authErrorAccountLocked: string;
|
|
369
|
+
authErrorTooManyAttempts: string;
|
|
370
|
+
authErrorEmailNotVerified: string;
|
|
371
|
+
authErrorEmailTaken: string;
|
|
372
|
+
authErrorWeakPassword: string;
|
|
373
|
+
authErrorPasswordReused: string;
|
|
374
|
+
authErrorInvalidCode: string;
|
|
375
|
+
authErrorExpiredCode: string;
|
|
376
|
+
authErrorLinkExpired: string;
|
|
377
|
+
authErrorSessionExpired: string;
|
|
378
|
+
authErrorProviderFailed: string;
|
|
379
|
+
authErrorPasskeyFailed: string;
|
|
380
|
+
authErrorNetwork: string;
|
|
381
|
+
authErrorUnknown: string;
|
|
177
382
|
};
|
|
178
383
|
type DsMessages = typeof en;
|
|
179
384
|
type DsMessageKey = keyof DsMessages;
|