@okjt/dashboard 0.2.2 → 0.4.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/dist/AccountMenu.js +2 -2
- package/dist/AdminBulkActions.js +2 -2
- package/dist/AdminCard.js +1 -1
- package/dist/AdminFloatingToolbar.js +11 -5
- package/dist/AdminListPanel.js +1 -1
- package/dist/AdminModal.js +1 -1
- package/dist/AdminPageHero.js +69 -4
- package/dist/AdminPageLayout.js +24 -2
- package/dist/AdminPagination.js +1 -1
- package/dist/AdminSidePanel.js +91 -43
- package/dist/AdminSummaryCards.js +65 -2
- package/dist/AdminToolbarFilters.js +2 -2
- package/dist/AdminToolbarSearch.js +1 -1
- package/dist/AdminTutorial.js +2 -2
- package/dist/AuthContext.js +95 -56
- package/dist/BoldToolbar.js +272 -0
- package/dist/ConfirmPasswordPage.js +41 -0
- package/dist/DashboardHeader.js +70 -55
- package/dist/DashboardIcon.js +15 -0
- package/dist/DashboardProvider.js +37 -2
- package/dist/DashboardShell.js +33 -6
- package/dist/DashboardSidebar.js +20 -14
- package/dist/EmptyState.js +42 -11
- package/dist/ForgotPasswordPage.js +39 -0
- package/dist/GoogleCallbackPage.js +3 -3
- package/dist/NotificationsBell.js +2 -2
- package/dist/ResetPasswordPage.js +61 -0
- package/dist/ShareModal.js +1 -1
- package/dist/SignInPage.js +125 -42
- package/dist/TwoFactorForm.js +18 -3
- package/dist/VersionHistoryDrawer.js +2 -2
- package/dist/index.js +64 -51
- package/package.json +2 -2
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { useParams, useSearchParams } from "react-router-dom";
|
|
4
|
+
import { useAuth } from "./AuthContext.js";
|
|
5
|
+
import AuthLayout, { AuthError, AuthField, AuthSubmit } from "./AuthLayout.js";
|
|
6
|
+
function ResetPasswordPage({
|
|
7
|
+
layout: Layout = AuthLayout,
|
|
8
|
+
token: tokenProp,
|
|
9
|
+
email: emailProp,
|
|
10
|
+
onReset,
|
|
11
|
+
title = "Choose a new password",
|
|
12
|
+
subtitle = "Make it at least 8 characters. You\u2019ll sign in with it from now on.",
|
|
13
|
+
footer,
|
|
14
|
+
submitLabel = "Reset password",
|
|
15
|
+
idPrefix = "reset"
|
|
16
|
+
}) {
|
|
17
|
+
const params = useParams();
|
|
18
|
+
const [query] = useSearchParams();
|
|
19
|
+
const token = tokenProp ?? params.token ?? "";
|
|
20
|
+
const { resetPassword } = useAuth();
|
|
21
|
+
const [email, setEmail] = useState(emailProp ?? query.get("email") ?? "");
|
|
22
|
+
const [password, setPassword] = useState("");
|
|
23
|
+
const [confirmation, setConfirmation] = useState("");
|
|
24
|
+
const [errors, setErrors] = useState({});
|
|
25
|
+
const [error, setError] = useState(null);
|
|
26
|
+
const [loading, setLoading] = useState(false);
|
|
27
|
+
const onSubmit = async (e) => {
|
|
28
|
+
e.preventDefault();
|
|
29
|
+
if (password !== confirmation) {
|
|
30
|
+
setErrors({ password_confirmation: "The passwords don\u2019t match." });
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
setLoading(true);
|
|
34
|
+
setError(null);
|
|
35
|
+
setErrors({});
|
|
36
|
+
const result = await resetPassword({ token, email, password, password_confirmation: confirmation });
|
|
37
|
+
setLoading(false);
|
|
38
|
+
if (result.success) {
|
|
39
|
+
onReset?.(result);
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
const fieldErrors = Object.fromEntries(Object.entries(result.errors ?? {}).map(([k, v]) => [k, Array.isArray(v) ? v[0] : v]));
|
|
43
|
+
setErrors(fieldErrors);
|
|
44
|
+
if (!Object.keys(fieldErrors).length) setError(result.message);
|
|
45
|
+
};
|
|
46
|
+
if (!token) {
|
|
47
|
+
return /* @__PURE__ */ jsx(Layout, { title: "This link is incomplete", subtitle: "Open the link from the email again, or ask for a new one.", footer });
|
|
48
|
+
}
|
|
49
|
+
return /* @__PURE__ */ jsxs(Layout, { title, subtitle, footer, children: [
|
|
50
|
+
/* @__PURE__ */ jsx(AuthError, { children: error }),
|
|
51
|
+
/* @__PURE__ */ jsxs("form", { onSubmit, className: "space-y-5", children: [
|
|
52
|
+
/* @__PURE__ */ jsx(AuthField, { id: `${idPrefix}-email`, label: "Email", type: "email", autoComplete: "email", value: email, onChange: (e) => setEmail(e.target.value), error: errors.email, required: true }),
|
|
53
|
+
/* @__PURE__ */ jsx(AuthField, { id: `${idPrefix}-password`, label: "New password", type: "password", autoComplete: "new-password", value: password, onChange: (e) => setPassword(e.target.value), error: errors.password, required: true, autoFocus: true }),
|
|
54
|
+
/* @__PURE__ */ jsx(AuthField, { id: `${idPrefix}-password-confirmation`, label: "Confirm password", type: "password", autoComplete: "new-password", value: confirmation, onChange: (e) => setConfirmation(e.target.value), error: errors.password_confirmation, required: true }),
|
|
55
|
+
/* @__PURE__ */ jsx("div", { className: "pt-2", children: /* @__PURE__ */ jsx(AuthSubmit, { loading, children: loading ? "Saving\u2026" : submitLabel }) })
|
|
56
|
+
] })
|
|
57
|
+
] });
|
|
58
|
+
}
|
|
59
|
+
export {
|
|
60
|
+
ResetPasswordPage as default
|
|
61
|
+
};
|
package/dist/ShareModal.js
CHANGED
|
@@ -11,7 +11,7 @@ import { CollaboratorAvatar } from "./CollaboratorAvatars.js";
|
|
|
11
11
|
import { useDashboard } from "./DashboardProvider.js";
|
|
12
12
|
import { useModules } from "./modules.js";
|
|
13
13
|
const EMPTY_FORM = { name: "", email: "", message: "", role: "editor" };
|
|
14
|
-
const selectClass = "px-2 py-1.5 rounded-lg border border-tone-200 bg-
|
|
14
|
+
const selectClass = "px-2 py-1.5 rounded-lg border border-tone-200 bg-surface text-xs text-tone-700 focus:outline-none focus:ring-2 focus:ring-accent/20";
|
|
15
15
|
function CopyField({ value, label }) {
|
|
16
16
|
const [copied, setCopied] = useState(false);
|
|
17
17
|
const copy = async () => {
|
package/dist/SignInPage.js
CHANGED
|
@@ -1,10 +1,21 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useState } from "react";
|
|
3
3
|
import { useForm } from "react-hook-form";
|
|
4
4
|
import { useAuth } from "./AuthContext.js";
|
|
5
5
|
import AuthLayout, { AuthError, AuthField, AuthSubmit } from "./AuthLayout.js";
|
|
6
6
|
import TwoFactorForm from "./TwoFactorForm.js";
|
|
7
7
|
import { loginWithPasskey, passkeysSupported } from "./passkeys.js";
|
|
8
|
+
const LABELS = {
|
|
9
|
+
submit: "Sign in",
|
|
10
|
+
submitting: "Signing in\u2026",
|
|
11
|
+
sendCode: "Email me a code",
|
|
12
|
+
verifyCode: "Verify & sign in",
|
|
13
|
+
emailPlaceholder: "you@example.com",
|
|
14
|
+
passwordPlaceholder: "Type your password",
|
|
15
|
+
remember: "Remember me",
|
|
16
|
+
useCode: "Email me a sign-in code instead",
|
|
17
|
+
usePassword: "Use password instead"
|
|
18
|
+
};
|
|
8
19
|
function SignInPage({
|
|
9
20
|
layout: Layout = AuthLayout,
|
|
10
21
|
onSignedIn,
|
|
@@ -12,41 +23,78 @@ function SignInPage({
|
|
|
12
23
|
subtitle,
|
|
13
24
|
footer,
|
|
14
25
|
forgotHint,
|
|
26
|
+
remember: offerRemember = false,
|
|
27
|
+
emailCode = false,
|
|
28
|
+
status,
|
|
29
|
+
passkey,
|
|
30
|
+
labels: labelsIn,
|
|
31
|
+
emailAutoComplete = "email",
|
|
15
32
|
google,
|
|
16
33
|
idPrefix = "sign-in"
|
|
17
34
|
}) {
|
|
18
|
-
const
|
|
35
|
+
const labels = { ...LABELS, ...labelsIn };
|
|
36
|
+
const { login, verify2fa, resendVerification, signedIn, requestLoginCode, verifyLoginCode } = useAuth();
|
|
19
37
|
const [error, setError] = useState(null);
|
|
38
|
+
const [notice, setNotice] = useState(status ?? null);
|
|
20
39
|
const [loading, setLoading] = useState(false);
|
|
21
|
-
const [
|
|
22
|
-
const [emailFor2fa, setEmailFor2fa] = useState("");
|
|
40
|
+
const [challenge, setChallenge] = useState(null);
|
|
23
41
|
const [twoFactorCode, setTwoFactorCode] = useState("");
|
|
42
|
+
const [useRecovery, setUseRecovery] = useState(false);
|
|
24
43
|
const [needsVerification, setNeedsVerification] = useState(null);
|
|
25
44
|
const [resendState, setResendState] = useState(null);
|
|
26
|
-
const
|
|
45
|
+
const [method, setMethod] = useState("password");
|
|
46
|
+
const [codeFor, setCodeFor] = useState(null);
|
|
47
|
+
const [rememberMe, setRememberMe] = useState(false);
|
|
48
|
+
const [emailedCode, setEmailedCode] = useState("");
|
|
49
|
+
const { register, handleSubmit, resetField, formState: { errors } } = useForm();
|
|
27
50
|
const done = (result) => {
|
|
28
51
|
const problem = onSignedIn?.(result);
|
|
29
52
|
if (typeof problem === "string") setError(problem);
|
|
30
53
|
};
|
|
31
|
-
const
|
|
32
|
-
setLoading(true);
|
|
33
|
-
setError(null);
|
|
34
|
-
const result = await login(data.email, data.password);
|
|
54
|
+
const settle = (result) => {
|
|
35
55
|
if (result.requires_verification) {
|
|
36
56
|
setNeedsVerification(result.email);
|
|
37
57
|
setError(null);
|
|
38
58
|
} else if (result.success) {
|
|
39
59
|
if (result.requires_2fa) {
|
|
40
|
-
|
|
41
|
-
setEmailFor2fa(result.email);
|
|
60
|
+
setChallenge(result.challenge ?? "");
|
|
42
61
|
} else {
|
|
43
62
|
done(result);
|
|
44
63
|
}
|
|
45
64
|
} else {
|
|
46
|
-
setError(result.message);
|
|
65
|
+
setError(result.errors?.code?.[0] || result.message);
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
const onSubmit = async (data) => {
|
|
69
|
+
setLoading(true);
|
|
70
|
+
setError(null);
|
|
71
|
+
if (method === "code") {
|
|
72
|
+
if (!codeFor) {
|
|
73
|
+
const result = await requestLoginCode(data.email);
|
|
74
|
+
if (result.success) {
|
|
75
|
+
setCodeFor(data.email);
|
|
76
|
+
setNotice(result.message || "If that address exists, a sign-in code is on its way.");
|
|
77
|
+
} else {
|
|
78
|
+
setError(result.message);
|
|
79
|
+
}
|
|
80
|
+
} else {
|
|
81
|
+
setNotice(null);
|
|
82
|
+
settle(await verifyLoginCode(codeFor, emailedCode));
|
|
83
|
+
}
|
|
84
|
+
setLoading(false);
|
|
85
|
+
return;
|
|
47
86
|
}
|
|
87
|
+
settle(await login(data.email, data.password, offerRemember && rememberMe ? { remember: true } : {}));
|
|
48
88
|
setLoading(false);
|
|
49
89
|
};
|
|
90
|
+
const switchMethod = () => {
|
|
91
|
+
setMethod((m) => m === "password" ? "code" : "password");
|
|
92
|
+
setCodeFor(null);
|
|
93
|
+
setError(null);
|
|
94
|
+
setNotice(null);
|
|
95
|
+
resetField("password");
|
|
96
|
+
setEmailedCode("");
|
|
97
|
+
};
|
|
50
98
|
const handleResend = async () => {
|
|
51
99
|
setResendState("sending");
|
|
52
100
|
const result = await resendVerification(needsVerification);
|
|
@@ -62,8 +110,7 @@ function SignInPage({
|
|
|
62
110
|
return;
|
|
63
111
|
}
|
|
64
112
|
if (result.requires_2fa) {
|
|
65
|
-
|
|
66
|
-
setEmailFor2fa(result.email);
|
|
113
|
+
setChallenge(result.challenge ?? "");
|
|
67
114
|
return;
|
|
68
115
|
}
|
|
69
116
|
done(signedIn(result));
|
|
@@ -77,7 +124,7 @@ function SignInPage({
|
|
|
77
124
|
e.preventDefault();
|
|
78
125
|
setLoading(true);
|
|
79
126
|
setError(null);
|
|
80
|
-
const result = await verify2fa(
|
|
127
|
+
const result = await verify2fa(challenge, twoFactorCode);
|
|
81
128
|
if (result.success) {
|
|
82
129
|
done(result);
|
|
83
130
|
} else {
|
|
@@ -117,24 +164,46 @@ function SignInPage({
|
|
|
117
164
|
}
|
|
118
165
|
);
|
|
119
166
|
}
|
|
120
|
-
if (
|
|
167
|
+
if (challenge !== null) {
|
|
121
168
|
return /* @__PURE__ */ jsxs(
|
|
122
169
|
Layout,
|
|
123
170
|
{
|
|
124
171
|
title: "Two-step verification",
|
|
125
|
-
subtitle: "Enter the 6-digit code from your authenticator app to finish signing in.",
|
|
172
|
+
subtitle: useRecovery ? "Enter one of the recovery codes you saved when you turned two-step sign-in on." : "Enter the 6-digit code from your authenticator app to finish signing in.",
|
|
126
173
|
footer: /* @__PURE__ */ jsx("button", { type: "button", onClick: () => {
|
|
127
|
-
|
|
174
|
+
setChallenge(null);
|
|
175
|
+
setTwoFactorCode("");
|
|
176
|
+
setUseRecovery(false);
|
|
128
177
|
setError(null);
|
|
129
178
|
}, className: "hover:text-body", children: "\u2190 Use a different account" }),
|
|
130
179
|
children: [
|
|
131
180
|
/* @__PURE__ */ jsx(AuthError, { children: error }),
|
|
132
|
-
/* @__PURE__ */ jsx(TwoFactorForm, { id: `${idPrefix}-2fa`, code: twoFactorCode, onCode: setTwoFactorCode, loading, onSubmit: handle2faVerify })
|
|
181
|
+
/* @__PURE__ */ jsx(TwoFactorForm, { id: `${idPrefix}-2fa`, code: twoFactorCode, onCode: setTwoFactorCode, loading, onSubmit: handle2faVerify, recovery: useRecovery }),
|
|
182
|
+
/* @__PURE__ */ jsx("div", { className: "mt-4 text-center", children: /* @__PURE__ */ jsx("button", { type: "button", onClick: () => {
|
|
183
|
+
setUseRecovery((r) => !r);
|
|
184
|
+
setTwoFactorCode("");
|
|
185
|
+
setError(null);
|
|
186
|
+
}, className: "text-sm text-muted hover:text-body", children: useRecovery ? "Use your authenticator app instead" : "Use a recovery code instead" }) })
|
|
133
187
|
]
|
|
134
188
|
}
|
|
135
189
|
);
|
|
136
190
|
}
|
|
191
|
+
const byCode = method === "code";
|
|
192
|
+
const passkeyButton = passkey !== void 0 ? passkey : passkeysSupported() && /* @__PURE__ */ jsxs(
|
|
193
|
+
"button",
|
|
194
|
+
{
|
|
195
|
+
type: "button",
|
|
196
|
+
onClick: handlePasskey,
|
|
197
|
+
disabled: loading,
|
|
198
|
+
className: "mb-3 flex w-full items-center justify-center gap-2 rounded-full border border-tone-200 bg-white px-4 py-3 text-sm font-semibold text-ink shadow-sm transition-colors hover:bg-tone-50 disabled:opacity-50",
|
|
199
|
+
children: [
|
|
200
|
+
/* @__PURE__ */ jsx("svg", { className: "h-5 w-5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: "1.8", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M15.75 5.25a3 3 0 0 1 3 3m3 0a6 6 0 0 1-7.029 5.912c-.563-.097-1.159.026-1.563.43L10.5 17.25H8.25v2.25H6v2.25H2.25v-2.818c0-.597.237-1.17.659-1.591l6.499-6.499c.404-.404.527-1 .43-1.563A6 6 0 1 1 21.75 8.25Z" }) }),
|
|
201
|
+
"Sign in with a passkey"
|
|
202
|
+
]
|
|
203
|
+
}
|
|
204
|
+
);
|
|
137
205
|
return /* @__PURE__ */ jsxs(Layout, { title, subtitle, footer, children: [
|
|
206
|
+
notice && /* @__PURE__ */ jsx("div", { role: "status", className: "mb-5 rounded-2xl border border-emerald-200 bg-emerald-50 px-4 py-3 text-center text-sm text-emerald-700", children: notice }),
|
|
138
207
|
/* @__PURE__ */ jsx(AuthError, { children: error }),
|
|
139
208
|
/* @__PURE__ */ jsxs("form", { onSubmit: handleSubmit(onSubmit), className: "space-y-5", noValidate: true, children: [
|
|
140
209
|
/* @__PURE__ */ jsx(
|
|
@@ -143,8 +212,9 @@ function SignInPage({
|
|
|
143
212
|
id: `${idPrefix}-email`,
|
|
144
213
|
label: "Email",
|
|
145
214
|
type: "email",
|
|
146
|
-
autoComplete:
|
|
147
|
-
placeholder:
|
|
215
|
+
autoComplete: emailAutoComplete,
|
|
216
|
+
placeholder: labels.emailPlaceholder,
|
|
217
|
+
readOnly: byCode && !!codeFor,
|
|
148
218
|
error: errors.email?.message,
|
|
149
219
|
...register("email", {
|
|
150
220
|
required: "Email is required",
|
|
@@ -155,14 +225,14 @@ function SignInPage({
|
|
|
155
225
|
})
|
|
156
226
|
}
|
|
157
227
|
),
|
|
158
|
-
/* @__PURE__ */ jsx(
|
|
228
|
+
!byCode && /* @__PURE__ */ jsx(
|
|
159
229
|
AuthField,
|
|
160
230
|
{
|
|
161
231
|
id: `${idPrefix}-password`,
|
|
162
232
|
label: "Password",
|
|
163
233
|
type: "password",
|
|
164
234
|
autoComplete: "current-password",
|
|
165
|
-
placeholder:
|
|
235
|
+
placeholder: labels.passwordPlaceholder,
|
|
166
236
|
error: errors.password?.message,
|
|
167
237
|
...register("password", {
|
|
168
238
|
required: "Password is required",
|
|
@@ -170,27 +240,40 @@ function SignInPage({
|
|
|
170
240
|
})
|
|
171
241
|
}
|
|
172
242
|
),
|
|
173
|
-
|
|
174
|
-
|
|
243
|
+
byCode && codeFor && /* @__PURE__ */ jsx(
|
|
244
|
+
AuthField,
|
|
245
|
+
{
|
|
246
|
+
id: `${idPrefix}-code`,
|
|
247
|
+
label: "Sign-in code",
|
|
248
|
+
inputMode: "numeric",
|
|
249
|
+
autoComplete: "one-time-code",
|
|
250
|
+
placeholder: "6-digit code",
|
|
251
|
+
maxLength: 6,
|
|
252
|
+
autoFocus: true,
|
|
253
|
+
required: true,
|
|
254
|
+
value: emailedCode,
|
|
255
|
+
onChange: (e) => setEmailedCode(e.target.value.replace(/\D/g, ""))
|
|
256
|
+
}
|
|
257
|
+
),
|
|
258
|
+
!byCode && offerRemember && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-3 -mt-1", children: [
|
|
259
|
+
/* @__PURE__ */ jsxs("label", { className: "flex cursor-pointer items-center gap-2 text-sm text-muted", children: [
|
|
260
|
+
/* @__PURE__ */ jsx("input", { type: "checkbox", checked: rememberMe, onChange: (e) => setRememberMe(e.target.checked), className: "h-4 w-4 rounded border-line accent-[var(--okjt-auth-focus,var(--color-accent))]" }),
|
|
261
|
+
labels.remember
|
|
262
|
+
] }),
|
|
263
|
+
forgotHint && /* @__PURE__ */ jsx("div", { className: "text-sm text-muted", children: forgotHint })
|
|
264
|
+
] }),
|
|
265
|
+
!byCode && !offerRemember && forgotHint && /* @__PURE__ */ jsx("div", { className: "text-xs text-faint text-right -mt-1", children: forgotHint }),
|
|
266
|
+
/* @__PURE__ */ jsx("div", { className: "pt-2", children: /* @__PURE__ */ jsx(AuthSubmit, { loading, children: loading ? labels.submitting : !byCode ? labels.submit : codeFor ? labels.verifyCode : labels.sendCode }) })
|
|
175
267
|
] }),
|
|
176
|
-
/* @__PURE__ */ jsxs(
|
|
177
|
-
/* @__PURE__ */
|
|
178
|
-
|
|
268
|
+
(passkeyButton || google) && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
269
|
+
/* @__PURE__ */ jsxs("div", { className: "relative my-5", "aria-hidden": "true", children: [
|
|
270
|
+
/* @__PURE__ */ jsx("div", { className: "absolute inset-0 flex items-center", children: /* @__PURE__ */ jsx("div", { className: "w-full border-t border-tone-200" }) }),
|
|
271
|
+
/* @__PURE__ */ jsx("div", { className: "relative flex justify-center text-xs", children: /* @__PURE__ */ jsx("span", { className: "bg-[var(--okjt-auth-card,#fff)] px-3 text-faint", children: "or" }) })
|
|
272
|
+
] }),
|
|
273
|
+
passkeyButton,
|
|
274
|
+
google
|
|
179
275
|
] }),
|
|
180
|
-
|
|
181
|
-
"button",
|
|
182
|
-
{
|
|
183
|
-
type: "button",
|
|
184
|
-
onClick: handlePasskey,
|
|
185
|
-
disabled: loading,
|
|
186
|
-
className: "mb-3 flex w-full items-center justify-center gap-2 rounded-full border border-tone-200 bg-white px-4 py-3 text-sm font-semibold text-ink shadow-sm transition-colors hover:bg-tone-50 disabled:opacity-50",
|
|
187
|
-
children: [
|
|
188
|
-
/* @__PURE__ */ jsx("svg", { className: "h-5 w-5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: "1.8", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M15.75 5.25a3 3 0 0 1 3 3m3 0a6 6 0 0 1-7.029 5.912c-.563-.097-1.159.026-1.563.43L10.5 17.25H8.25v2.25H6v2.25H2.25v-2.818c0-.597.237-1.17.659-1.591l6.499-6.499c.404-.404.527-1 .43-1.563A6 6 0 1 1 21.75 8.25Z" }) }),
|
|
189
|
-
"Sign in with a passkey"
|
|
190
|
-
]
|
|
191
|
-
}
|
|
192
|
-
),
|
|
193
|
-
google
|
|
276
|
+
emailCode && /* @__PURE__ */ jsx("div", { className: "mt-4 text-center", children: /* @__PURE__ */ jsx("button", { type: "button", onClick: switchMethod, className: "text-sm text-muted hover:text-body", children: byCode ? labels.usePassword : labels.useCode }) })
|
|
194
277
|
] });
|
|
195
278
|
}
|
|
196
279
|
export {
|
package/dist/TwoFactorForm.js
CHANGED
|
@@ -1,8 +1,22 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { AuthField, AuthSubmit } from "./AuthLayout.js";
|
|
3
|
-
function TwoFactorForm({ id, code, onCode, loading, onSubmit }) {
|
|
3
|
+
function TwoFactorForm({ id, code, onCode, loading, onSubmit, recovery = false }) {
|
|
4
4
|
return /* @__PURE__ */ jsxs("form", { onSubmit, className: "space-y-6", children: [
|
|
5
|
-
/* @__PURE__ */ jsx(
|
|
5
|
+
recovery ? /* @__PURE__ */ jsx(
|
|
6
|
+
AuthField,
|
|
7
|
+
{
|
|
8
|
+
id,
|
|
9
|
+
label: "Recovery code",
|
|
10
|
+
value: code,
|
|
11
|
+
onChange: (e) => onCode(e.target.value.trim()),
|
|
12
|
+
autoComplete: "off",
|
|
13
|
+
placeholder: "xxxxxxxxxx-xxxxxxxxxx",
|
|
14
|
+
required: true,
|
|
15
|
+
autoFocus: true,
|
|
16
|
+
inputClassName: "text-center font-mono"
|
|
17
|
+
},
|
|
18
|
+
"recovery"
|
|
19
|
+
) : /* @__PURE__ */ jsx(
|
|
6
20
|
AuthField,
|
|
7
21
|
{
|
|
8
22
|
id,
|
|
@@ -16,7 +30,8 @@ function TwoFactorForm({ id, code, onCode, loading, onSubmit }) {
|
|
|
16
30
|
required: true,
|
|
17
31
|
autoFocus: true,
|
|
18
32
|
inputClassName: "text-center text-xl tracking-[0.6em] font-semibold"
|
|
19
|
-
}
|
|
33
|
+
},
|
|
34
|
+
"code"
|
|
20
35
|
),
|
|
21
36
|
/* @__PURE__ */ jsx(AuthSubmit, { loading, children: loading ? "Verifying\u2026" : "Verify & sign in" })
|
|
22
37
|
] });
|
|
@@ -110,7 +110,7 @@ function VersionHistoryDrawer({ module, onClose, onRestored }) {
|
|
|
110
110
|
exit: { x: "100%" },
|
|
111
111
|
transition: { type: "spring", damping: 32, stiffness: 300 },
|
|
112
112
|
onClick: (e) => e.stopPropagation(),
|
|
113
|
-
className: "h-full w-full max-w-md bg-
|
|
113
|
+
className: "h-full w-full max-w-md bg-surface shadow-2xl flex flex-col",
|
|
114
114
|
children: [
|
|
115
115
|
/* @__PURE__ */ jsxs("div", { className: "shrink-0 px-4 py-3 border-b border-tone-100 space-y-3", children: [
|
|
116
116
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
@@ -147,7 +147,7 @@ function VersionHistoryDrawer({ module, onClose, onRestored }) {
|
|
|
147
147
|
const header = day !== lastDay ? day : null;
|
|
148
148
|
lastDay = day;
|
|
149
149
|
return /* @__PURE__ */ jsxs("li", { children: [
|
|
150
|
-
header && /* @__PURE__ */ jsx("h3", { className: "sticky top-0 z-10 bg-
|
|
150
|
+
header && /* @__PURE__ */ jsx("h3", { className: "sticky top-0 z-10 bg-surface/95 backdrop-blur pt-3 pb-1 text-[11px] font-bold uppercase tracking-wider text-tone-500", children: header }),
|
|
151
151
|
/* @__PURE__ */ jsx("ul", { className: "divide-y divide-tone-100", children: /* @__PURE__ */ jsx(
|
|
152
152
|
Entry,
|
|
153
153
|
{
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DashboardProvider, useDashboard } from "./DashboardProvider.js";
|
|
1
|
+
import { DashboardProvider, useDashboard, useComponentDefaults } from "./DashboardProvider.js";
|
|
2
2
|
import { AdminChromeProvider, useAdminChrome, AdminHeaderStatus } from "./AdminChromeContext.js";
|
|
3
3
|
import { SearchProvider, useSearch } from "./SearchContext.js";
|
|
4
4
|
import { default as default2 } from "./AdminPageLayout.js";
|
|
@@ -8,6 +8,7 @@ import { default as default5 } from "./StatCard.js";
|
|
|
8
8
|
import { default as default6 } from "./AdminFloatingToolbar.js";
|
|
9
9
|
import { default as default7 } from "./AdminToolbarSearch.js";
|
|
10
10
|
import { default as default8, countActiveFilters } from "./AdminToolbarFilters.js";
|
|
11
|
+
import { countActiveFilterLists } from "./BoldToolbar.js";
|
|
11
12
|
import { SidePanelNav, SidePanelAside, SidePanelMobileBar } from "./AdminSidePanel.js";
|
|
12
13
|
import { default as default9 } from "./AdminListPanel.js";
|
|
13
14
|
import { default as default10, pageWindow } from "./AdminPagination.js";
|
|
@@ -19,38 +20,43 @@ import { default as default14 } from "./EditableFieldset.js";
|
|
|
19
20
|
import { default as default15 } from "./DeleteButton.js";
|
|
20
21
|
import { default as default16 } from "./ToggleButton.js";
|
|
21
22
|
import { default as default17 } from "./EmptyState.js";
|
|
22
|
-
import { default as default18 } from "./
|
|
23
|
-
import { default as default19 } from "./
|
|
24
|
-
import { default as default20 } from "./
|
|
25
|
-
import { default as default21
|
|
26
|
-
import { default as default22 } from "./
|
|
27
|
-
import { default as default23
|
|
28
|
-
import { default as default24 } from "./
|
|
29
|
-
import { default as default25 } from "./
|
|
23
|
+
import { default as default18 } from "./DashboardIcon.js";
|
|
24
|
+
import { default as default19 } from "./QueryError.js";
|
|
25
|
+
import { default as default20 } from "./UnsavedChangesStatus.js";
|
|
26
|
+
import { default as default21 } from "./AdminTutorial.js";
|
|
27
|
+
import { default as default22, useBulkAdminAction } from "./useAdminAction.js";
|
|
28
|
+
import { default as default23 } from "./useCrudHandlers.js";
|
|
29
|
+
import { default as default24, useUnsavedChanges } from "./useUnsavedChangesGuard.js";
|
|
30
|
+
import { default as default25 } from "./useFilteredItems.js";
|
|
31
|
+
import { default as default26 } from "./useSavedViews.js";
|
|
30
32
|
import { useModules, moduleForPathIn, initials, collaboratorColor } from "./modules.js";
|
|
31
33
|
import { CollaborationProvider, useCollaboration, HEARTBEAT_MS } from "./CollaborationContext.js";
|
|
32
|
-
import { default as
|
|
33
|
-
import { default as
|
|
34
|
-
import { default as
|
|
35
|
-
import { default as
|
|
36
|
-
import { default as
|
|
37
|
-
import { default as
|
|
38
|
-
import { default as
|
|
39
|
-
import { default as
|
|
40
|
-
import { AuthProvider, useAuth, default as
|
|
41
|
-
import { default as
|
|
42
|
-
import { default as
|
|
34
|
+
import { default as default27, CollaboratorAvatar } from "./CollaboratorAvatars.js";
|
|
35
|
+
import { default as default28 } from "./ActivityPanel.js";
|
|
36
|
+
import { default as default29 } from "./useActivityPanel.js";
|
|
37
|
+
import { default as default30 } from "./VersionHistoryDrawer.js";
|
|
38
|
+
import { default as default31 } from "./ShareModal.js";
|
|
39
|
+
import { default as default32 } from "./DashboardShell.js";
|
|
40
|
+
import { default as default33 } from "./DashboardSidebar.js";
|
|
41
|
+
import { default as default34 } from "./DashboardHeader.js";
|
|
42
|
+
import { AuthProvider, useAuth, default as default35 } from "./AuthContext.js";
|
|
43
|
+
import { default as default36 } from "./GoogleButton.js";
|
|
44
|
+
import { default as default37 } from "./NotificationsBell.js";
|
|
43
45
|
import { loginWithPasskey, registerPasskey, passkeysSupported } from "./passkeys.js";
|
|
44
|
-
import { default as
|
|
45
|
-
import { default as
|
|
46
|
-
import { default as
|
|
47
|
-
import { default as
|
|
48
|
-
import { default as
|
|
49
|
-
import { default as
|
|
46
|
+
import { default as default38, AuthField, AuthSubmit, AuthError } from "./AuthLayout.js";
|
|
47
|
+
import { default as default39 } from "./SignInPage.js";
|
|
48
|
+
import { default as default40 } from "./GoogleCallbackPage.js";
|
|
49
|
+
import { default as default41 } from "./VerifyEmailPage.js";
|
|
50
|
+
import { default as default42 } from "./ForgotPasswordPage.js";
|
|
51
|
+
import { default as default43 } from "./ResetPasswordPage.js";
|
|
52
|
+
import { default as default44 } from "./ConfirmPasswordPage.js";
|
|
53
|
+
import { default as default45 } from "./TwoFactorForm.js";
|
|
54
|
+
import { default as default46 } from "./AcceptInvitePage.js";
|
|
55
|
+
import { default as default47 } from "./AccountMenu.js";
|
|
50
56
|
export {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
57
|
+
default46 as AcceptInvitePage,
|
|
58
|
+
default47 as AccountMenu,
|
|
59
|
+
default28 as ActivityPanel,
|
|
54
60
|
default11 as AdminBulkActions,
|
|
55
61
|
default12 as AdminCard,
|
|
56
62
|
AdminChromeProvider,
|
|
@@ -67,40 +73,46 @@ export {
|
|
|
67
73
|
AdminTextarea,
|
|
68
74
|
default8 as AdminToolbarFilters,
|
|
69
75
|
default7 as AdminToolbarSearch,
|
|
70
|
-
|
|
71
|
-
|
|
76
|
+
default21 as AdminTutorial,
|
|
77
|
+
default35 as AuthContext,
|
|
72
78
|
AuthError,
|
|
73
79
|
AuthField,
|
|
74
|
-
|
|
80
|
+
default38 as AuthLayout,
|
|
75
81
|
AuthProvider,
|
|
76
82
|
AuthSubmit,
|
|
77
83
|
CollaborationProvider,
|
|
78
84
|
CollaboratorAvatar,
|
|
79
|
-
|
|
80
|
-
|
|
85
|
+
default27 as CollaboratorAvatars,
|
|
86
|
+
default44 as ConfirmPasswordPage,
|
|
87
|
+
default34 as DashboardHeader,
|
|
88
|
+
default18 as DashboardIcon,
|
|
81
89
|
DashboardProvider,
|
|
82
|
-
|
|
83
|
-
|
|
90
|
+
default32 as DashboardShell,
|
|
91
|
+
default33 as DashboardSidebar,
|
|
84
92
|
default15 as DeleteButton,
|
|
85
93
|
default14 as EditableFieldset,
|
|
86
94
|
default17 as EmptyState,
|
|
87
|
-
|
|
88
|
-
|
|
95
|
+
default42 as ForgotPasswordPage,
|
|
96
|
+
default36 as GoogleButton,
|
|
97
|
+
default40 as GoogleCallbackPage,
|
|
89
98
|
HEARTBEAT_MS,
|
|
90
|
-
|
|
91
|
-
|
|
99
|
+
default37 as NotificationsBell,
|
|
100
|
+
default19 as QueryError,
|
|
101
|
+
default43 as ResetPasswordPage,
|
|
92
102
|
SearchProvider,
|
|
93
|
-
|
|
103
|
+
default31 as ShareModal,
|
|
94
104
|
SidePanelAside,
|
|
95
105
|
SidePanelMobileBar,
|
|
96
106
|
SidePanelNav,
|
|
97
|
-
|
|
107
|
+
default39 as SignInPage,
|
|
98
108
|
default5 as StatCard,
|
|
99
109
|
default16 as ToggleButton,
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
110
|
+
default45 as TwoFactorForm,
|
|
111
|
+
default20 as UnsavedChangesStatus,
|
|
112
|
+
default41 as VerifyEmailPage,
|
|
113
|
+
default30 as VersionHistoryDrawer,
|
|
103
114
|
collaboratorColor,
|
|
115
|
+
countActiveFilterLists,
|
|
104
116
|
countActiveFilters,
|
|
105
117
|
initials,
|
|
106
118
|
loginWithPasskey,
|
|
@@ -108,18 +120,19 @@ export {
|
|
|
108
120
|
pageWindow,
|
|
109
121
|
passkeysSupported,
|
|
110
122
|
registerPasskey,
|
|
111
|
-
|
|
112
|
-
|
|
123
|
+
default29 as useActivityPanel,
|
|
124
|
+
default22 as useAdminAction,
|
|
113
125
|
useAdminChrome,
|
|
114
126
|
useAuth,
|
|
115
127
|
useBulkAdminAction,
|
|
116
128
|
useCollaboration,
|
|
117
|
-
|
|
129
|
+
useComponentDefaults,
|
|
130
|
+
default23 as useCrudHandlers,
|
|
118
131
|
useDashboard,
|
|
119
|
-
|
|
132
|
+
default25 as useFilteredItems,
|
|
120
133
|
useModules,
|
|
121
|
-
|
|
134
|
+
default26 as useSavedViews,
|
|
122
135
|
useSearch,
|
|
123
136
|
useUnsavedChanges,
|
|
124
|
-
|
|
137
|
+
default24 as useUnsavedChangesGuard
|
|
125
138
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@okjt/dashboard",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Dashboard pages for OKJTech projects: page layout, hero, summary cards, floating toolbar with search and filters, side panel, lists, bulk actions, one way to save, and working together: presence, version history, sharing; the dashboard shell, sign-in pages and account menu",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"test": "node build.mjs && vitest run"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@okjt/ui": "^0.1
|
|
26
|
+
"@okjt/ui": "^0.2.1"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
29
|
"@tanstack/react-query": ">=5",
|