@djangocfg/layouts 2.1.583 → 2.1.584
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/package.json +12 -12
- package/src/layouts/AuthLayout/README.md +2 -2
- package/src/layouts/AuthLayout/components/steps/IdentifierStep.tsx +1 -20
- package/src/layouts/AuthLayout/context.tsx +0 -3
- package/src/layouts/AuthLayout/styles/auth.css +1 -1
- package/src/layouts/AuthLayout/types.ts +1 -15
- package/src/testing/MockAuthFormProvider.tsx +0 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@djangocfg/layouts",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.584",
|
|
4
4
|
"description": "Simple, straightforward layout components for Next.js - import and use with props",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"layouts",
|
|
@@ -90,11 +90,11 @@
|
|
|
90
90
|
"check": "tsc --noEmit"
|
|
91
91
|
},
|
|
92
92
|
"peerDependencies": {
|
|
93
|
-
"@djangocfg/analytics": "^2.1.
|
|
94
|
-
"@djangocfg/api": "^2.1.
|
|
95
|
-
"@djangocfg/devtools": "^2.1.
|
|
96
|
-
"@djangocfg/i18n": "^2.1.
|
|
97
|
-
"@djangocfg/ui-core": "^2.1.
|
|
93
|
+
"@djangocfg/analytics": "^2.1.584",
|
|
94
|
+
"@djangocfg/api": "^2.1.584",
|
|
95
|
+
"@djangocfg/devtools": "^2.1.584",
|
|
96
|
+
"@djangocfg/i18n": "^2.1.584",
|
|
97
|
+
"@djangocfg/ui-core": "^2.1.584",
|
|
98
98
|
"@hookform/resolvers": "^5.2.2",
|
|
99
99
|
"consola": "^3.4.2",
|
|
100
100
|
"lucide-react": "^0.545.0",
|
|
@@ -124,12 +124,12 @@
|
|
|
124
124
|
"uuid": "^11.1.1"
|
|
125
125
|
},
|
|
126
126
|
"devDependencies": {
|
|
127
|
-
"@djangocfg/analytics": "^2.1.
|
|
128
|
-
"@djangocfg/api": "^2.1.
|
|
129
|
-
"@djangocfg/devtools": "^2.1.
|
|
130
|
-
"@djangocfg/i18n": "^2.1.
|
|
131
|
-
"@djangocfg/typescript-config": "^2.1.
|
|
132
|
-
"@djangocfg/ui-core": "^2.1.
|
|
127
|
+
"@djangocfg/analytics": "^2.1.584",
|
|
128
|
+
"@djangocfg/api": "^2.1.584",
|
|
129
|
+
"@djangocfg/devtools": "^2.1.584",
|
|
130
|
+
"@djangocfg/i18n": "^2.1.584",
|
|
131
|
+
"@djangocfg/typescript-config": "^2.1.584",
|
|
132
|
+
"@djangocfg/ui-core": "^2.1.584",
|
|
133
133
|
"@storybook/react-vite": "^10.5.0",
|
|
134
134
|
"@types/node": "^25.9.5",
|
|
135
135
|
"@types/react": "19.2.15",
|
|
@@ -89,8 +89,8 @@ document names stay in English across locales) — see `shared/AuthConsent`.
|
|
|
89
89
|
rolls back to the identifier step if the request fails. The resend link counts
|
|
90
90
|
down from the server's `resend_in` (30s fallback).
|
|
91
91
|
|
|
92
|
-
**
|
|
93
|
-
|
|
92
|
+
**Session length.** Sign-ins are kept as long as the server's refresh-token
|
|
93
|
+
lifetime allows; there is no remember-me option.
|
|
94
94
|
|
|
95
95
|
## Usage
|
|
96
96
|
|
|
@@ -48,12 +48,9 @@ function IdentifierStepRaw() {
|
|
|
48
48
|
enableGithubAuth,
|
|
49
49
|
sourceUrl,
|
|
50
50
|
marketingConsent,
|
|
51
|
-
rememberMe,
|
|
52
51
|
marketingConsentConfig,
|
|
53
|
-
rememberMeConfig,
|
|
54
52
|
setIdentifier,
|
|
55
53
|
setMarketingConsent,
|
|
56
|
-
setRememberMe,
|
|
57
54
|
setError,
|
|
58
55
|
handleIdentifierSubmit,
|
|
59
56
|
} = useAuthFormContext();
|
|
@@ -103,7 +100,6 @@ function IdentifierStepRaw() {
|
|
|
103
100
|
// GitHub OAuth
|
|
104
101
|
const { isLoading: isGithubLoading, startGithubAuth } = useGithubAuth({
|
|
105
102
|
sourceUrl,
|
|
106
|
-
rememberMe,
|
|
107
103
|
onError: setError,
|
|
108
104
|
});
|
|
109
105
|
|
|
@@ -137,8 +133,7 @@ function IdentifierStepRaw() {
|
|
|
137
133
|
|
|
138
134
|
<AuthError message={error} />
|
|
139
135
|
|
|
140
|
-
|
|
141
|
-
{consentEnabled && (
|
|
136
|
+
{consentEnabled && (
|
|
142
137
|
<label className="auth-optin">
|
|
143
138
|
<Checkbox
|
|
144
139
|
checked={consentChecked}
|
|
@@ -156,20 +151,6 @@ function IdentifierStepRaw() {
|
|
|
156
151
|
</label>
|
|
157
152
|
)}
|
|
158
153
|
|
|
159
|
-
{rememberMeConfig?.enabled && (
|
|
160
|
-
<label className="auth-optin">
|
|
161
|
-
<Checkbox
|
|
162
|
-
checked={rememberMe}
|
|
163
|
-
onCheckedChange={(checked) => setRememberMe(checked === true)}
|
|
164
|
-
disabled={isLoading}
|
|
165
|
-
className="auth-optin-checkbox"
|
|
166
|
-
/>
|
|
167
|
-
<span className="auth-optin-label">
|
|
168
|
-
{rememberMeConfig?.label ?? 'Keep me signed in for 30 days'}
|
|
169
|
-
</span>
|
|
170
|
-
</label>
|
|
171
|
-
)}
|
|
172
|
-
|
|
173
154
|
<AuthButton
|
|
174
155
|
loading={isLoading}
|
|
175
156
|
disabled={!identifier || isRateLimited}
|
|
@@ -28,7 +28,6 @@ export const AuthFormProvider: React.FC<AuthLayoutProps> = ({
|
|
|
28
28
|
logo,
|
|
29
29
|
redirectUrl,
|
|
30
30
|
marketingConsent,
|
|
31
|
-
rememberMe,
|
|
32
31
|
onIdentifierSuccess,
|
|
33
32
|
onOTPSuccess,
|
|
34
33
|
onError,
|
|
@@ -66,7 +65,6 @@ export const AuthFormProvider: React.FC<AuthLayoutProps> = ({
|
|
|
66
65
|
redirectUrl,
|
|
67
66
|
// Renamed: `marketingConsent` (the name) is the checkbox STATE from the form hook.
|
|
68
67
|
marketingConsentConfig: marketingConsent,
|
|
69
|
-
rememberMeConfig: rememberMe,
|
|
70
68
|
}),
|
|
71
69
|
[
|
|
72
70
|
authForm,
|
|
@@ -78,7 +76,6 @@ export const AuthFormProvider: React.FC<AuthLayoutProps> = ({
|
|
|
78
76
|
logo,
|
|
79
77
|
redirectUrl,
|
|
80
78
|
marketingConsent,
|
|
81
|
-
rememberMe,
|
|
82
79
|
]
|
|
83
80
|
);
|
|
84
81
|
|
|
@@ -469,7 +469,7 @@ a.auth-logo:focus-visible {
|
|
|
469
469
|
|
|
470
470
|
/* ===== OPT-IN CHECKBOX ROWS (identifier step) =====
|
|
471
471
|
*
|
|
472
|
-
* One class for every opt-in row — marketing consent
|
|
472
|
+
* One class for every opt-in row — marketing consent and whatever
|
|
473
473
|
* comes next. They are the same control doing the same job, so they must not
|
|
474
474
|
* drift apart in size, colour or alignment; two near-identical blocks are how
|
|
475
475
|
* the remember-me row ended up a step larger than the consent row above it.
|
|
@@ -50,17 +50,6 @@ export interface AuthMarketingConsentConfig {
|
|
|
50
50
|
defaultChecked?: boolean;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
/**
|
|
54
|
-
* Persistent-login checkbox on the identifier step. Sign-ins are remembered for
|
|
55
|
-
* 30 days by default; the checkbox only exists for apps that want the choice.
|
|
56
|
-
*/
|
|
57
|
-
export interface AuthRememberMeConfig {
|
|
58
|
-
/** Render the checkbox, checked by default. Default: false (always remembered). */
|
|
59
|
-
enabled?: boolean;
|
|
60
|
-
/** Checkbox label. Default: "Keep me signed in for 30 days". */
|
|
61
|
-
label?: React.ReactNode;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
53
|
export interface AuthLayoutConfig {
|
|
65
54
|
/** Support page URL */
|
|
66
55
|
supportUrl?: string;
|
|
@@ -79,8 +68,6 @@ export interface AuthLayoutConfig {
|
|
|
79
68
|
redirectUrl?: string;
|
|
80
69
|
/** Optional marketing-consent checkbox on the identifier step. Absent ⇒ no checkbox, OTP body unchanged. */
|
|
81
70
|
marketingConsent?: AuthMarketingConsentConfig;
|
|
82
|
-
/** Optional persistent-login control. */
|
|
83
|
-
rememberMe?: AuthRememberMeConfig;
|
|
84
71
|
}
|
|
85
72
|
|
|
86
73
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
@@ -90,9 +77,8 @@ export interface AuthLayoutConfig {
|
|
|
90
77
|
// `marketingConsent` is omitted from the config side of the merge: the name is
|
|
91
78
|
// taken by the checkbox *state* (boolean | null) from AuthFormReturn, so the
|
|
92
79
|
// prop object is re-exposed as `marketingConsentConfig`.
|
|
93
|
-
export interface AuthFormContextType extends AuthFormReturn, Omit<AuthLayoutConfig, 'marketingConsent'
|
|
80
|
+
export interface AuthFormContextType extends AuthFormReturn, Omit<AuthLayoutConfig, 'marketingConsent'> {
|
|
94
81
|
marketingConsentConfig?: AuthMarketingConsentConfig;
|
|
95
|
-
rememberMeConfig?: AuthRememberMeConfig;
|
|
96
82
|
}
|
|
97
83
|
|
|
98
84
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
@@ -69,7 +69,6 @@ export const MockAuthFormProvider: React.FC<MockAuthFormProviderProps> = ({
|
|
|
69
69
|
const [otp, setOtp] = useState(initialOtp);
|
|
70
70
|
const [isLoading, setIsLoading] = useState(initialLoading);
|
|
71
71
|
const [acceptedTerms, setAcceptedTerms] = useState(initialAcceptedTerms);
|
|
72
|
-
const [rememberMe, setRememberMe] = useState(false);
|
|
73
72
|
const [marketingConsent, setMarketingConsent] = useState<boolean | null>(null);
|
|
74
73
|
const [error, setError] = useState(initialError);
|
|
75
74
|
const [rateLimitSeconds, setRateLimitSeconds] = useState(initialRateLimitSeconds);
|
|
@@ -90,7 +89,6 @@ export const MockAuthFormProvider: React.FC<MockAuthFormProviderProps> = ({
|
|
|
90
89
|
otp,
|
|
91
90
|
isLoading,
|
|
92
91
|
acceptedTerms,
|
|
93
|
-
rememberMe,
|
|
94
92
|
marketingConsent,
|
|
95
93
|
step,
|
|
96
94
|
error,
|
|
@@ -106,7 +104,6 @@ export const MockAuthFormProvider: React.FC<MockAuthFormProviderProps> = ({
|
|
|
106
104
|
setPassword,
|
|
107
105
|
setOtp,
|
|
108
106
|
setAcceptedTerms,
|
|
109
|
-
setRememberMe,
|
|
110
107
|
setMarketingConsent,
|
|
111
108
|
setError,
|
|
112
109
|
clearError: () => setError(''),
|
|
@@ -148,7 +145,6 @@ export const MockAuthFormProvider: React.FC<MockAuthFormProviderProps> = ({
|
|
|
148
145
|
otp,
|
|
149
146
|
isLoading,
|
|
150
147
|
acceptedTerms,
|
|
151
|
-
rememberMe,
|
|
152
148
|
marketingConsent,
|
|
153
149
|
step,
|
|
154
150
|
error,
|