@molecule/app-auth-modal-react 4.0.1 → 4.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AuthModal.d.ts.map +1 -1
- package/dist/AuthModal.js +15 -2
- package/package.json +6 -6
package/dist/AuthModal.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthModal.d.ts","sourceRoot":"","sources":["../src/AuthModal.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,KAAK,GAAG,EAAE,KAAK,SAAS,
|
|
1
|
+
{"version":3,"file":"AuthModal.d.ts","sourceRoot":"","sources":["../src/AuthModal.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,KAAK,GAAG,EAAE,KAAK,SAAS,EAA+B,MAAM,OAAO,CAAA;AAY7E,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAI9C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AA0CvD,mCAAmC;AACnC,MAAM,WAAW,cAAc;IAC7B,iCAAiC;IACjC,IAAI,EAAE,OAAO,CAAA;IACb,4DAA4D;IAC5D,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,qDAAqD;IACrD,WAAW,CAAC,EAAE,aAAa,CAAA;IAC3B;;;OAGG;IACH,WAAW,EAAE,UAAU,CAAC,OAAO,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAA;IAC3C;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,IAAI,CAAA;IACzB;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAC5C;;;;;;;;;;;;;;OAcG;IACH,WAAW,CAAC,EAAE,SAAS,CAAA;IACvB;;;;;OAKG;IACH,aAAa,CAAC,EAAE,OAAO,CAAA;CACxB;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,EACxB,IAAI,EACJ,OAAO,EACP,WAAsB,EACtB,WAAW,EACX,YAAY,EACZ,eAAe,EACf,WAAW,EACX,aAAoB,GACrB,EAAE,cAAc,GAAG,GAAG,CAAC,OAAO,CAkR9B;yBA3Re,SAAS"}
|
package/dist/AuthModal.js
CHANGED
|
@@ -17,7 +17,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
17
17
|
*
|
|
18
18
|
* @module
|
|
19
19
|
*/
|
|
20
|
-
import { useEffect, useState } from 'react';
|
|
20
|
+
import { useEffect, useRef, useState } from 'react';
|
|
21
21
|
import { useAuthFormState } from '@molecule/app-auth-shell-react';
|
|
22
22
|
import { OAuthButtons, OAuthDivider } from '@molecule/app-oauth-buttons-react';
|
|
23
23
|
import { useAuth, useAuthClient, useI18nError, useLogin, useSignup, useTranslation, } from '@molecule/app-react';
|
|
@@ -87,6 +87,19 @@ export function AuthModal({ open, onClose, initialMode = 'signup', oauthConfig,
|
|
|
87
87
|
const isSignup = mode === 'signup';
|
|
88
88
|
const busy = isSignup ? signupStatus === 'pending' : loginStatus === 'pending';
|
|
89
89
|
const errorMessage = useI18nError(isSignup ? signupError : loginError);
|
|
90
|
+
// Dialog pattern (WAI-ARIA): when the modal opens, keyboard and
|
|
91
|
+
// screen-reader users land on the form's primary field instead of on the
|
|
92
|
+
// page behind the overlay. This replaces the `autoFocus` prop, which
|
|
93
|
+
// jsx-a11y/no-autofocus bars: the prop fires on EVERY mount of the input
|
|
94
|
+
// (e.g. the brief remount after the mode switches), while this effect runs
|
|
95
|
+
// exactly once per open transition. It runs after the Modal's own
|
|
96
|
+
// focus-trap effect (child effects first), so the email field wins in both
|
|
97
|
+
// signup and login mode.
|
|
98
|
+
const emailRef = useRef(null);
|
|
99
|
+
useEffect(() => {
|
|
100
|
+
if (open)
|
|
101
|
+
emailRef.current?.focus();
|
|
102
|
+
}, [open]);
|
|
90
103
|
// Universal post-auth: refresh the session (guards + plan current), show a
|
|
91
104
|
// brief confirmation, run the app's hook, then close — all in place, no
|
|
92
105
|
// navigation.
|
|
@@ -178,7 +191,7 @@ export function AuthModal({ open, onClose, initialMode = 'signup', oauthConfig,
|
|
|
178
191
|
defaultValue: 'Log in to keep your work.',
|
|
179
192
|
}) }), _jsxs("form", { onSubmit: (e) => void handleSubmit(e), style: { display: 'grid', gap: 10 }, children: [isSignup && (_jsx("input", { type: "text", value: name, onChange: (e) => setName(e.target.value), autoComplete: "name", "data-mol-id": "auth-modal-name", placeholder: t('auth.signup.name', undefined, {
|
|
180
193
|
defaultValue: 'Name (optional)',
|
|
181
|
-
}), style: fieldStyle })), _jsx("input", { type: "email", value: email, onChange: (e) => setField('email', e.target.value), autoComplete: "email",
|
|
194
|
+
}), style: fieldStyle })), _jsx("input", { type: "email", value: email, onChange: (e) => setField('email', e.target.value), autoComplete: "email", ref: emailRef, required: true, "data-mol-id": "auth-modal-email", placeholder: t('auth.login.email', undefined, { defaultValue: 'Email' }), style: fieldStyle }), _jsx("input", { type: "password", value: password, onChange: (e) => setPassword(e.target.value), autoComplete: isSignup ? 'new-password' : 'current-password', required: true, "data-mol-id": "auth-modal-password", placeholder: t('auth.login.password', undefined, { defaultValue: 'Password' }), style: fieldStyle }), !isSignup && (_jsx("input", { type: "text", inputMode: "numeric", value: twoFactorToken, onChange: (e) => setTwoFactorToken(e.target.value), autoComplete: "one-time-code", "data-mol-id": "auth-modal-2fa", placeholder: t('auth.login.twoFactor', undefined, {
|
|
182
195
|
defaultValue: 'Two-Factor Token (If enabled)',
|
|
183
196
|
}), style: fieldStyle })), isSignup && captchaSlot && (_jsx("div", { "data-mol-id": "auth-modal-captcha", style: { display: 'grid', marginTop: 2 }, children: captchaSlot })), _jsx(Button, { type: "submit", size: "lg", color: "success", disabled: busy || (isSignup && !captchaSolved), "data-mol-id": "auth-modal-submit", style: { width: '100%', marginTop: 2 }, children: busy
|
|
184
197
|
? t('auth.modal.working', undefined, { defaultValue: 'Just a moment…' })
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@molecule/app-auth-modal-react",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.2",
|
|
4
4
|
"description": "In-app login / signup modal + click-interceptor + popup OAuth — authenticate and upgrade without ever navigating away or losing work",
|
|
5
5
|
"homepage": "https://www.molecule.dev/packages/app-auth-modal-react",
|
|
6
6
|
"type": "module",
|
|
@@ -46,12 +46,12 @@
|
|
|
46
46
|
"react": "^18.0.0 || ^19.0.0"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@molecule/app-auth-shell-react": "4.0.
|
|
50
|
-
"@molecule/app-i18n": "1.2.
|
|
49
|
+
"@molecule/app-auth-shell-react": "4.0.2",
|
|
50
|
+
"@molecule/app-i18n": "1.2.2",
|
|
51
51
|
"@molecule/app-oauth-buttons-react": "4.0.0",
|
|
52
|
-
"@molecule/app-react": "4.
|
|
53
|
-
"@molecule/app-ui": "1.
|
|
54
|
-
"@molecule/app-ui-react": "4.1.
|
|
52
|
+
"@molecule/app-react": "4.7.1",
|
|
53
|
+
"@molecule/app-ui": "1.4.0",
|
|
54
|
+
"@molecule/app-ui-react": "4.1.4",
|
|
55
55
|
"@testing-library/react": "16.3.3",
|
|
56
56
|
"@types/node": "26.6.5",
|
|
57
57
|
"@types/react": "19.3.0",
|