@erikey/react 0.3.2 → 0.3.3
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/styles.css +9 -0
- package/dist/styles.css.map +1 -1
- package/dist/ui/index.css +9 -0
- package/dist/ui/index.css.map +1 -1
- package/dist/ui/index.d.mts +32 -7
- package/dist/ui/index.mjs +203 -104
- package/dist/ui/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/ui/index.mjs
CHANGED
|
@@ -84,10 +84,10 @@ function AuthUIProvider({
|
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
// src/ui/components/auth/SignInForm.tsx
|
|
87
|
-
import
|
|
87
|
+
import React8, { useState as useState2 } from "react";
|
|
88
88
|
import { useForm } from "react-hook-form";
|
|
89
89
|
import { zodResolver } from "@hookform/resolvers/zod";
|
|
90
|
-
import { Loader2 } from "lucide-react";
|
|
90
|
+
import { Loader2 as Loader22 } from "lucide-react";
|
|
91
91
|
|
|
92
92
|
// src/ui/lib/validation.ts
|
|
93
93
|
import { z } from "zod";
|
|
@@ -240,10 +240,124 @@ var Checkbox = forwardRef4(({ className, ...props }, ref) => /* @__PURE__ */ Rea
|
|
|
240
240
|
));
|
|
241
241
|
Checkbox.displayName = CheckboxPrimitive.Root.displayName;
|
|
242
242
|
|
|
243
|
+
// src/ui/components/ui/Separator.tsx
|
|
244
|
+
import React6, { forwardRef as forwardRef5 } from "react";
|
|
245
|
+
import * as SeparatorPrimitive from "@radix-ui/react-separator";
|
|
246
|
+
var Separator = forwardRef5(({ className, orientation = "horizontal", decorative = true, ...props }, ref) => /* @__PURE__ */ React6.createElement(
|
|
247
|
+
SeparatorPrimitive.Root,
|
|
248
|
+
{
|
|
249
|
+
ref,
|
|
250
|
+
decorative,
|
|
251
|
+
orientation,
|
|
252
|
+
className: cn(
|
|
253
|
+
"shrink-0 bg-border",
|
|
254
|
+
orientation === "horizontal" ? "h-[1px] w-full" : "h-full w-[1px]",
|
|
255
|
+
className
|
|
256
|
+
),
|
|
257
|
+
...props
|
|
258
|
+
}
|
|
259
|
+
));
|
|
260
|
+
Separator.displayName = SeparatorPrimitive.Root.displayName;
|
|
261
|
+
|
|
262
|
+
// src/ui/components/auth/SocialAuthButtons.tsx
|
|
263
|
+
import React7, { useState } from "react";
|
|
264
|
+
import { Loader2 } from "lucide-react";
|
|
265
|
+
var GoogleIcon = () => /* @__PURE__ */ React7.createElement("svg", { className: "h-4 w-4", viewBox: "0 0 24 24" }, /* @__PURE__ */ React7.createElement(
|
|
266
|
+
"path",
|
|
267
|
+
{
|
|
268
|
+
fill: "currentColor",
|
|
269
|
+
d: "M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"
|
|
270
|
+
}
|
|
271
|
+
), /* @__PURE__ */ React7.createElement(
|
|
272
|
+
"path",
|
|
273
|
+
{
|
|
274
|
+
fill: "currentColor",
|
|
275
|
+
d: "M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"
|
|
276
|
+
}
|
|
277
|
+
), /* @__PURE__ */ React7.createElement(
|
|
278
|
+
"path",
|
|
279
|
+
{
|
|
280
|
+
fill: "currentColor",
|
|
281
|
+
d: "M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"
|
|
282
|
+
}
|
|
283
|
+
), /* @__PURE__ */ React7.createElement(
|
|
284
|
+
"path",
|
|
285
|
+
{
|
|
286
|
+
fill: "currentColor",
|
|
287
|
+
d: "M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"
|
|
288
|
+
}
|
|
289
|
+
));
|
|
290
|
+
var GitHubIcon = () => /* @__PURE__ */ React7.createElement("svg", { className: "h-4 w-4", viewBox: "0 0 24 24", fill: "currentColor" }, /* @__PURE__ */ React7.createElement("path", { d: "M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z" }));
|
|
291
|
+
var AppleIcon = () => /* @__PURE__ */ React7.createElement("svg", { className: "h-4 w-4", viewBox: "0 0 24 24", fill: "currentColor" }, /* @__PURE__ */ React7.createElement("path", { d: "M18.71 19.5c-.83 1.24-1.71 2.45-3.05 2.47-1.34.03-1.77-.79-3.29-.79-1.53 0-2 .77-3.27.82-1.31.05-2.3-1.32-3.14-2.53C4.25 17 2.94 12.45 4.7 9.39c.87-1.52 2.43-2.48 4.12-2.51 1.28-.02 2.5.87 3.29.87.78 0 2.26-1.07 3.81-.91.65.03 2.47.26 3.64 1.98-.09.06-2.17 1.28-2.15 3.81.03 3.02 2.65 4.03 2.68 4.04-.03.07-.42 1.44-1.38 2.83M13 3.5c.73-.83 1.94-1.46 2.94-1.5.13 1.17-.34 2.35-1.04 3.19-.69.85-1.83 1.51-2.95 1.42-.15-1.15.41-2.35 1.05-3.11z" }));
|
|
292
|
+
var DiscordIcon = () => /* @__PURE__ */ React7.createElement("svg", { className: "h-4 w-4", viewBox: "0 0 24 24", fill: "currentColor" }, /* @__PURE__ */ React7.createElement("path", { d: "M20.317 4.3698a19.7913 19.7913 0 00-4.8851-1.5152.0741.0741 0 00-.0785.0371c-.211.3753-.4447.8648-.6083 1.2495-1.8447-.2762-3.68-.2762-5.4868 0-.1636-.3933-.4058-.8742-.6177-1.2495a.077.077 0 00-.0785-.037 19.7363 19.7363 0 00-4.8852 1.515.0699.0699 0 00-.0321.0277C.5334 9.0458-.319 13.5799.0992 18.0578a.0824.0824 0 00.0312.0561c2.0528 1.5076 4.0413 2.4228 5.9929 3.0294a.0777.0777 0 00.0842-.0276c.4616-.6304.8731-1.2952 1.226-1.9942a.076.076 0 00-.0416-.1057c-.6528-.2476-1.2743-.5495-1.8722-.8923a.077.077 0 01-.0076-.1277c.1258-.0943.2517-.1923.3718-.2914a.0743.0743 0 01.0776-.0105c3.9278 1.7933 8.18 1.7933 12.0614 0a.0739.0739 0 01.0785.0095c.1202.099.246.1981.3728.2924a.077.077 0 01-.0066.1276 12.2986 12.2986 0 01-1.873.8914.0766.0766 0 00-.0407.1067c.3604.698.7719 1.3628 1.225 1.9932a.076.076 0 00.0842.0286c1.961-.6067 3.9495-1.5219 6.0023-3.0294a.077.077 0 00.0313-.0552c.5004-5.177-.8382-9.6739-3.5485-13.6604a.061.061 0 00-.0312-.0286zM8.02 15.3312c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9555-2.4189 2.157-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.9555 2.4189-2.1569 2.4189zm7.9748 0c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9554-2.4189 2.1569-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.946 2.4189-2.1568 2.4189Z" }));
|
|
293
|
+
var TwitterIcon = () => /* @__PURE__ */ React7.createElement("svg", { className: "h-4 w-4", viewBox: "0 0 24 24", fill: "currentColor" }, /* @__PURE__ */ React7.createElement("path", { d: "M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z" }));
|
|
294
|
+
var FacebookIcon = () => /* @__PURE__ */ React7.createElement("svg", { className: "h-4 w-4", viewBox: "0 0 24 24", fill: "currentColor" }, /* @__PURE__ */ React7.createElement("path", { d: "M24 12.073c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.99 4.388 10.954 10.125 11.854v-8.385H7.078v-3.47h3.047V9.43c0-3.007 1.792-4.669 4.533-4.669 1.312 0 2.686.235 2.686.235v2.953H15.83c-1.491 0-1.956.925-1.956 1.874v2.25h3.328l-.532 3.47h-2.796v8.385C19.612 23.027 24 18.062 24 12.073z" }));
|
|
295
|
+
var MicrosoftIcon = () => /* @__PURE__ */ React7.createElement("svg", { className: "h-4 w-4", viewBox: "0 0 24 24", fill: "currentColor" }, /* @__PURE__ */ React7.createElement("path", { d: "M11.4 24H0V12.6h11.4V24zM24 24H12.6V12.6H24V24zM11.4 11.4H0V0h11.4v11.4zm12.6 0H12.6V0H24v11.4z" }));
|
|
296
|
+
var providerConfig = {
|
|
297
|
+
google: { icon: GoogleIcon, label: "Google" },
|
|
298
|
+
github: { icon: GitHubIcon, label: "GitHub" },
|
|
299
|
+
apple: { icon: AppleIcon, label: "Apple" },
|
|
300
|
+
discord: { icon: DiscordIcon, label: "Discord" },
|
|
301
|
+
twitter: { icon: TwitterIcon, label: "X" },
|
|
302
|
+
facebook: { icon: FacebookIcon, label: "Facebook" },
|
|
303
|
+
microsoft: { icon: MicrosoftIcon, label: "Microsoft" }
|
|
304
|
+
};
|
|
305
|
+
function SocialAuthButtons({
|
|
306
|
+
className,
|
|
307
|
+
mode = "sign-in",
|
|
308
|
+
onSuccess,
|
|
309
|
+
onError
|
|
310
|
+
}) {
|
|
311
|
+
const { authClient, providers, redirectTo, toast } = useAuthUI();
|
|
312
|
+
const [loadingProvider, setLoadingProvider] = useState(null);
|
|
313
|
+
if (!providers || providers.length === 0) {
|
|
314
|
+
return null;
|
|
315
|
+
}
|
|
316
|
+
const handleSocialAuth = async (provider) => {
|
|
317
|
+
if (!authClient.signIn.social) {
|
|
318
|
+
toast({ title: "Error", description: "Social sign in not available", variant: "destructive" });
|
|
319
|
+
return;
|
|
320
|
+
}
|
|
321
|
+
setLoadingProvider(provider);
|
|
322
|
+
try {
|
|
323
|
+
await authClient.signIn.social({
|
|
324
|
+
provider,
|
|
325
|
+
callbackURL: redirectTo || window.location.origin
|
|
326
|
+
});
|
|
327
|
+
onSuccess?.();
|
|
328
|
+
} catch (error) {
|
|
329
|
+
const errorMessage = error instanceof Error ? error.message : "Authentication failed";
|
|
330
|
+
toast({ title: "Error", description: errorMessage, variant: "destructive" });
|
|
331
|
+
onError?.(error instanceof Error ? error : new Error(errorMessage));
|
|
332
|
+
setLoadingProvider(null);
|
|
333
|
+
}
|
|
334
|
+
};
|
|
335
|
+
const actionText = mode === "sign-in" ? "Sign in" : "Sign up";
|
|
336
|
+
return /* @__PURE__ */ React7.createElement("div", { className: cn("grid gap-2", className) }, providers.map((provider) => {
|
|
337
|
+
const config = providerConfig[provider];
|
|
338
|
+
if (!config) return null;
|
|
339
|
+
const Icon = config.icon;
|
|
340
|
+
const isLoading = loadingProvider === provider;
|
|
341
|
+
return /* @__PURE__ */ React7.createElement(
|
|
342
|
+
Button,
|
|
343
|
+
{
|
|
344
|
+
key: provider,
|
|
345
|
+
type: "button",
|
|
346
|
+
variant: "outline",
|
|
347
|
+
className: "w-full",
|
|
348
|
+
disabled: loadingProvider !== null,
|
|
349
|
+
onClick: () => handleSocialAuth(provider)
|
|
350
|
+
},
|
|
351
|
+
isLoading ? /* @__PURE__ */ React7.createElement(Loader2, { className: "mr-2 h-4 w-4 animate-spin" }) : /* @__PURE__ */ React7.createElement(Icon, null),
|
|
352
|
+
/* @__PURE__ */ React7.createElement("span", { className: "ml-2" }, actionText, " with ", config.label)
|
|
353
|
+
);
|
|
354
|
+
}));
|
|
355
|
+
}
|
|
356
|
+
|
|
243
357
|
// src/ui/components/auth/SignInForm.tsx
|
|
244
358
|
function SignInForm({ className, redirectTo, onSuccess, onError }) {
|
|
245
|
-
const { authClient, navigate, Link, basePath, viewPaths, forgotPassword, rememberMe, toast } = useAuthUI();
|
|
246
|
-
const [isLoading, setIsLoading] =
|
|
359
|
+
const { authClient, navigate, Link, basePath, viewPaths, forgotPassword, rememberMe, toast, providers } = useAuthUI();
|
|
360
|
+
const [isLoading, setIsLoading] = useState2(false);
|
|
247
361
|
const form = useForm({
|
|
248
362
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
249
363
|
resolver: zodResolver(signInSchema),
|
|
@@ -279,7 +393,8 @@ function SignInForm({ className, redirectTo, onSuccess, onError }) {
|
|
|
279
393
|
setIsLoading(false);
|
|
280
394
|
}
|
|
281
395
|
};
|
|
282
|
-
|
|
396
|
+
const hasSocialProviders = providers && providers.length > 0;
|
|
397
|
+
return /* @__PURE__ */ React8.createElement("div", { className: cn("grid gap-4", className) }, hasSocialProviders && /* @__PURE__ */ React8.createElement(React8.Fragment, null, /* @__PURE__ */ React8.createElement(SocialAuthButtons, { mode: "sign-in", onSuccess, onError }), /* @__PURE__ */ React8.createElement("div", { className: "relative" }, /* @__PURE__ */ React8.createElement("div", { className: "absolute inset-0 flex items-center" }, /* @__PURE__ */ React8.createElement(Separator, { className: "w-full" })), /* @__PURE__ */ React8.createElement("div", { className: "relative flex justify-center text-xs uppercase" }, /* @__PURE__ */ React8.createElement("span", { className: "bg-background px-2 text-muted-foreground" }, "Or continue with")))), /* @__PURE__ */ React8.createElement("form", { onSubmit: form.handleSubmit(onSubmit), className: "grid gap-4" }, /* @__PURE__ */ React8.createElement("div", { className: "grid gap-2" }, /* @__PURE__ */ React8.createElement(Label, { htmlFor: "email" }, "Email"), /* @__PURE__ */ React8.createElement(
|
|
283
398
|
Input,
|
|
284
399
|
{
|
|
285
400
|
id: "email",
|
|
@@ -289,14 +404,14 @@ function SignInForm({ className, redirectTo, onSuccess, onError }) {
|
|
|
289
404
|
disabled: isLoading,
|
|
290
405
|
...form.register("email")
|
|
291
406
|
}
|
|
292
|
-
), form.formState.errors.email && /* @__PURE__ */
|
|
407
|
+
), form.formState.errors.email && /* @__PURE__ */ React8.createElement("p", { className: "text-sm text-destructive" }, form.formState.errors.email.message)), /* @__PURE__ */ React8.createElement("div", { className: "grid gap-2" }, /* @__PURE__ */ React8.createElement("div", { className: "flex items-center justify-between" }, /* @__PURE__ */ React8.createElement(Label, { htmlFor: "password" }, "Password"), forgotPassword && /* @__PURE__ */ React8.createElement(
|
|
293
408
|
Link,
|
|
294
409
|
{
|
|
295
410
|
href: `${basePath}/${viewPaths.forgotPassword}`,
|
|
296
411
|
className: "text-sm text-muted-foreground hover:text-primary"
|
|
297
412
|
},
|
|
298
413
|
"Forgot password?"
|
|
299
|
-
)), /* @__PURE__ */
|
|
414
|
+
)), /* @__PURE__ */ React8.createElement(
|
|
300
415
|
Input,
|
|
301
416
|
{
|
|
302
417
|
id: "password",
|
|
@@ -306,7 +421,7 @@ function SignInForm({ className, redirectTo, onSuccess, onError }) {
|
|
|
306
421
|
disabled: isLoading,
|
|
307
422
|
...form.register("password")
|
|
308
423
|
}
|
|
309
|
-
), form.formState.errors.password && /* @__PURE__ */
|
|
424
|
+
), form.formState.errors.password && /* @__PURE__ */ React8.createElement("p", { className: "text-sm text-destructive" }, form.formState.errors.password.message)), rememberMe && /* @__PURE__ */ React8.createElement("div", { className: "flex items-center gap-2" }, /* @__PURE__ */ React8.createElement(
|
|
310
425
|
Checkbox,
|
|
311
426
|
{
|
|
312
427
|
id: "rememberMe",
|
|
@@ -314,14 +429,14 @@ function SignInForm({ className, redirectTo, onSuccess, onError }) {
|
|
|
314
429
|
onCheckedChange: (checked) => form.setValue("rememberMe", checked === true),
|
|
315
430
|
disabled: isLoading
|
|
316
431
|
}
|
|
317
|
-
), /* @__PURE__ */
|
|
432
|
+
), /* @__PURE__ */ React8.createElement(Label, { htmlFor: "rememberMe", className: "text-sm font-normal cursor-pointer" }, "Remember me")), /* @__PURE__ */ React8.createElement(Button, { type: "submit", className: "w-full", disabled: isLoading }, isLoading && /* @__PURE__ */ React8.createElement(Loader22, { className: "mr-2 h-4 w-4 animate-spin" }), "Sign In"), /* @__PURE__ */ React8.createElement("p", { className: "text-center text-sm text-muted-foreground" }, "Don't have an account?", " ", /* @__PURE__ */ React8.createElement(Link, { href: `${basePath}/${viewPaths.signUp}`, className: "text-primary hover:underline" }, "Sign up"))));
|
|
318
433
|
}
|
|
319
434
|
|
|
320
435
|
// src/ui/components/auth/SignUpForm.tsx
|
|
321
|
-
import
|
|
436
|
+
import React9, { useState as useState3 } from "react";
|
|
322
437
|
import { useForm as useForm2 } from "react-hook-form";
|
|
323
438
|
import { zodResolver as zodResolver2 } from "@hookform/resolvers/zod";
|
|
324
|
-
import { Loader2 as
|
|
439
|
+
import { Loader2 as Loader23 } from "lucide-react";
|
|
325
440
|
function SignUpForm({ className, redirectTo, onSuccess, onError }) {
|
|
326
441
|
const {
|
|
327
442
|
authClient,
|
|
@@ -331,9 +446,10 @@ function SignUpForm({ className, redirectTo, onSuccess, onError }) {
|
|
|
331
446
|
viewPaths,
|
|
332
447
|
nameRequired,
|
|
333
448
|
confirmPassword: showConfirmPassword,
|
|
334
|
-
toast
|
|
449
|
+
toast,
|
|
450
|
+
providers
|
|
335
451
|
} = useAuthUI();
|
|
336
|
-
const [isLoading, setIsLoading] =
|
|
452
|
+
const [isLoading, setIsLoading] = useState3(false);
|
|
337
453
|
const schema = showConfirmPassword ? signUpWithConfirmSchema : signUpSchema;
|
|
338
454
|
const form = useForm2({
|
|
339
455
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -370,7 +486,8 @@ function SignUpForm({ className, redirectTo, onSuccess, onError }) {
|
|
|
370
486
|
setIsLoading(false);
|
|
371
487
|
}
|
|
372
488
|
};
|
|
373
|
-
|
|
489
|
+
const hasSocialProviders = providers && providers.length > 0;
|
|
490
|
+
return /* @__PURE__ */ React9.createElement("div", { className: cn("grid gap-4", className) }, hasSocialProviders && /* @__PURE__ */ React9.createElement(React9.Fragment, null, /* @__PURE__ */ React9.createElement(SocialAuthButtons, { mode: "sign-up", onSuccess, onError }), /* @__PURE__ */ React9.createElement("div", { className: "relative" }, /* @__PURE__ */ React9.createElement("div", { className: "absolute inset-0 flex items-center" }, /* @__PURE__ */ React9.createElement(Separator, { className: "w-full" })), /* @__PURE__ */ React9.createElement("div", { className: "relative flex justify-center text-xs uppercase" }, /* @__PURE__ */ React9.createElement("span", { className: "bg-background px-2 text-muted-foreground" }, "Or continue with")))), /* @__PURE__ */ React9.createElement("form", { onSubmit: form.handleSubmit(onSubmit), className: "grid gap-4" }, nameRequired && /* @__PURE__ */ React9.createElement("div", { className: "grid gap-2" }, /* @__PURE__ */ React9.createElement(Label, { htmlFor: "name" }, "Name"), /* @__PURE__ */ React9.createElement(
|
|
374
491
|
Input,
|
|
375
492
|
{
|
|
376
493
|
id: "name",
|
|
@@ -380,7 +497,7 @@ function SignUpForm({ className, redirectTo, onSuccess, onError }) {
|
|
|
380
497
|
disabled: isLoading,
|
|
381
498
|
...form.register("name")
|
|
382
499
|
}
|
|
383
|
-
), form.formState.errors.name && /* @__PURE__ */
|
|
500
|
+
), form.formState.errors.name && /* @__PURE__ */ React9.createElement("p", { className: "text-sm text-destructive" }, form.formState.errors.name.message)), /* @__PURE__ */ React9.createElement("div", { className: "grid gap-2" }, /* @__PURE__ */ React9.createElement(Label, { htmlFor: "email" }, "Email"), /* @__PURE__ */ React9.createElement(
|
|
384
501
|
Input,
|
|
385
502
|
{
|
|
386
503
|
id: "email",
|
|
@@ -390,7 +507,7 @@ function SignUpForm({ className, redirectTo, onSuccess, onError }) {
|
|
|
390
507
|
disabled: isLoading,
|
|
391
508
|
...form.register("email")
|
|
392
509
|
}
|
|
393
|
-
), form.formState.errors.email && /* @__PURE__ */
|
|
510
|
+
), form.formState.errors.email && /* @__PURE__ */ React9.createElement("p", { className: "text-sm text-destructive" }, form.formState.errors.email.message)), /* @__PURE__ */ React9.createElement("div", { className: "grid gap-2" }, /* @__PURE__ */ React9.createElement(Label, { htmlFor: "password" }, "Password"), /* @__PURE__ */ React9.createElement(
|
|
394
511
|
Input,
|
|
395
512
|
{
|
|
396
513
|
id: "password",
|
|
@@ -400,7 +517,7 @@ function SignUpForm({ className, redirectTo, onSuccess, onError }) {
|
|
|
400
517
|
disabled: isLoading,
|
|
401
518
|
...form.register("password")
|
|
402
519
|
}
|
|
403
|
-
), form.formState.errors.password && /* @__PURE__ */
|
|
520
|
+
), form.formState.errors.password && /* @__PURE__ */ React9.createElement("p", { className: "text-sm text-destructive" }, form.formState.errors.password.message)), showConfirmPassword && /* @__PURE__ */ React9.createElement("div", { className: "grid gap-2" }, /* @__PURE__ */ React9.createElement(Label, { htmlFor: "confirmPassword" }, "Confirm Password"), /* @__PURE__ */ React9.createElement(
|
|
404
521
|
Input,
|
|
405
522
|
{
|
|
406
523
|
id: "confirmPassword",
|
|
@@ -410,18 +527,18 @@ function SignUpForm({ className, redirectTo, onSuccess, onError }) {
|
|
|
410
527
|
disabled: isLoading,
|
|
411
528
|
...form.register("confirmPassword")
|
|
412
529
|
}
|
|
413
|
-
), form.formState.errors.confirmPassword && /* @__PURE__ */
|
|
530
|
+
), form.formState.errors.confirmPassword && /* @__PURE__ */ React9.createElement("p", { className: "text-sm text-destructive" }, form.formState.errors.confirmPassword.message)), /* @__PURE__ */ React9.createElement(Button, { type: "submit", className: "w-full", disabled: isLoading }, isLoading && /* @__PURE__ */ React9.createElement(Loader23, { className: "mr-2 h-4 w-4 animate-spin" }), "Create Account"), /* @__PURE__ */ React9.createElement("p", { className: "text-center text-sm text-muted-foreground" }, "Already have an account?", " ", /* @__PURE__ */ React9.createElement(Link, { href: `${basePath}/${viewPaths.signIn}`, className: "text-primary hover:underline" }, "Sign in"))));
|
|
414
531
|
}
|
|
415
532
|
|
|
416
533
|
// src/ui/components/auth/ForgotPasswordForm.tsx
|
|
417
|
-
import
|
|
534
|
+
import React10, { useState as useState4 } from "react";
|
|
418
535
|
import { useForm as useForm3 } from "react-hook-form";
|
|
419
536
|
import { zodResolver as zodResolver3 } from "@hookform/resolvers/zod";
|
|
420
|
-
import { Loader2 as
|
|
537
|
+
import { Loader2 as Loader24, ArrowLeft } from "lucide-react";
|
|
421
538
|
function ForgotPasswordForm({ className, onSuccess, onError }) {
|
|
422
539
|
const { authClient, Link, basePath, viewPaths, toast } = useAuthUI();
|
|
423
|
-
const [isLoading, setIsLoading] =
|
|
424
|
-
const [isSubmitted, setIsSubmitted] =
|
|
540
|
+
const [isLoading, setIsLoading] = useState4(false);
|
|
541
|
+
const [isSubmitted, setIsSubmitted] = useState4(false);
|
|
425
542
|
const form = useForm3({
|
|
426
543
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
427
544
|
resolver: zodResolver3(forgotPasswordSchema),
|
|
@@ -459,17 +576,17 @@ function ForgotPasswordForm({ className, onSuccess, onError }) {
|
|
|
459
576
|
}
|
|
460
577
|
};
|
|
461
578
|
if (isSubmitted) {
|
|
462
|
-
return /* @__PURE__ */
|
|
579
|
+
return /* @__PURE__ */ React10.createElement("div", { className: cn("grid gap-4 text-center", className) }, /* @__PURE__ */ React10.createElement("div", { className: "space-y-2" }, /* @__PURE__ */ React10.createElement("h3", { className: "text-lg font-medium" }, "Check your email"), /* @__PURE__ */ React10.createElement("p", { className: "text-sm text-muted-foreground" }, "We sent a password reset link to", " ", /* @__PURE__ */ React10.createElement("span", { className: "font-medium" }, form.getValues("email")))), /* @__PURE__ */ React10.createElement(Button, { variant: "outline", onClick: () => setIsSubmitted(false) }, "Try another email"), /* @__PURE__ */ React10.createElement(
|
|
463
580
|
Link,
|
|
464
581
|
{
|
|
465
582
|
href: `${basePath}/${viewPaths.signIn}`,
|
|
466
583
|
className: "text-sm text-muted-foreground hover:text-primary inline-flex items-center justify-center gap-1"
|
|
467
584
|
},
|
|
468
|
-
/* @__PURE__ */
|
|
585
|
+
/* @__PURE__ */ React10.createElement(ArrowLeft, { className: "h-4 w-4" }),
|
|
469
586
|
"Back to sign in"
|
|
470
587
|
));
|
|
471
588
|
}
|
|
472
|
-
return /* @__PURE__ */
|
|
589
|
+
return /* @__PURE__ */ React10.createElement("form", { onSubmit: form.handleSubmit(onSubmit), className: cn("grid gap-4", className) }, /* @__PURE__ */ React10.createElement("div", { className: "space-y-2 text-center" }, /* @__PURE__ */ React10.createElement("h3", { className: "text-lg font-medium" }, "Forgot your password?"), /* @__PURE__ */ React10.createElement("p", { className: "text-sm text-muted-foreground" }, "Enter your email and we'll send you a reset link.")), /* @__PURE__ */ React10.createElement("div", { className: "grid gap-2" }, /* @__PURE__ */ React10.createElement(Label, { htmlFor: "email" }, "Email"), /* @__PURE__ */ React10.createElement(
|
|
473
590
|
Input,
|
|
474
591
|
{
|
|
475
592
|
id: "email",
|
|
@@ -479,22 +596,22 @@ function ForgotPasswordForm({ className, onSuccess, onError }) {
|
|
|
479
596
|
disabled: isLoading,
|
|
480
597
|
...form.register("email")
|
|
481
598
|
}
|
|
482
|
-
), form.formState.errors.email && /* @__PURE__ */
|
|
599
|
+
), form.formState.errors.email && /* @__PURE__ */ React10.createElement("p", { className: "text-sm text-destructive" }, form.formState.errors.email.message)), /* @__PURE__ */ React10.createElement(Button, { type: "submit", className: "w-full", disabled: isLoading }, isLoading && /* @__PURE__ */ React10.createElement(Loader24, { className: "mr-2 h-4 w-4 animate-spin" }), "Send Reset Link"), /* @__PURE__ */ React10.createElement(
|
|
483
600
|
Link,
|
|
484
601
|
{
|
|
485
602
|
href: `${basePath}/${viewPaths.signIn}`,
|
|
486
603
|
className: "text-sm text-center text-muted-foreground hover:text-primary inline-flex items-center justify-center gap-1"
|
|
487
604
|
},
|
|
488
|
-
/* @__PURE__ */
|
|
605
|
+
/* @__PURE__ */ React10.createElement(ArrowLeft, { className: "h-4 w-4" }),
|
|
489
606
|
"Back to sign in"
|
|
490
607
|
));
|
|
491
608
|
}
|
|
492
609
|
|
|
493
610
|
// src/ui/components/auth/ResetPasswordForm.tsx
|
|
494
|
-
import
|
|
611
|
+
import React11, { useState as useState5 } from "react";
|
|
495
612
|
import { useForm as useForm4 } from "react-hook-form";
|
|
496
613
|
import { zodResolver as zodResolver4 } from "@hookform/resolvers/zod";
|
|
497
|
-
import { Loader2 as
|
|
614
|
+
import { Loader2 as Loader25, CheckCircle } from "lucide-react";
|
|
498
615
|
function ResetPasswordForm({
|
|
499
616
|
className,
|
|
500
617
|
token,
|
|
@@ -502,8 +619,8 @@ function ResetPasswordForm({
|
|
|
502
619
|
onError
|
|
503
620
|
}) {
|
|
504
621
|
const { authClient, navigate, basePath, viewPaths, toast } = useAuthUI();
|
|
505
|
-
const [isLoading, setIsLoading] =
|
|
506
|
-
const [isSuccess, setIsSuccess] =
|
|
622
|
+
const [isLoading, setIsLoading] = useState5(false);
|
|
623
|
+
const [isSuccess, setIsSuccess] = useState5(false);
|
|
507
624
|
const form = useForm4({
|
|
508
625
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
509
626
|
resolver: zodResolver4(resetPasswordSchema),
|
|
@@ -542,9 +659,9 @@ function ResetPasswordForm({
|
|
|
542
659
|
}
|
|
543
660
|
};
|
|
544
661
|
if (isSuccess) {
|
|
545
|
-
return /* @__PURE__ */
|
|
662
|
+
return /* @__PURE__ */ React11.createElement("div", { className: cn("grid gap-4 text-center", className) }, /* @__PURE__ */ React11.createElement("div", { className: "flex justify-center" }, /* @__PURE__ */ React11.createElement(CheckCircle, { className: "h-12 w-12 text-green-500" })), /* @__PURE__ */ React11.createElement("div", { className: "space-y-2" }, /* @__PURE__ */ React11.createElement("h3", { className: "text-lg font-medium" }, "Password reset successful"), /* @__PURE__ */ React11.createElement("p", { className: "text-sm text-muted-foreground" }, "Your password has been reset. You can now sign in with your new password.")), /* @__PURE__ */ React11.createElement(Button, { onClick: () => navigate(`${basePath}/${viewPaths.signIn}`) }, "Sign in"));
|
|
546
663
|
}
|
|
547
|
-
return /* @__PURE__ */
|
|
664
|
+
return /* @__PURE__ */ React11.createElement("form", { onSubmit: form.handleSubmit(onSubmit), className: cn("grid gap-4", className) }, /* @__PURE__ */ React11.createElement("div", { className: "space-y-2 text-center" }, /* @__PURE__ */ React11.createElement("h3", { className: "text-lg font-medium" }, "Reset your password"), /* @__PURE__ */ React11.createElement("p", { className: "text-sm text-muted-foreground" }, "Enter your new password below.")), /* @__PURE__ */ React11.createElement("div", { className: "grid gap-2" }, /* @__PURE__ */ React11.createElement(Label, { htmlFor: "password" }, "New Password"), /* @__PURE__ */ React11.createElement(
|
|
548
665
|
Input,
|
|
549
666
|
{
|
|
550
667
|
id: "password",
|
|
@@ -554,7 +671,7 @@ function ResetPasswordForm({
|
|
|
554
671
|
disabled: isLoading,
|
|
555
672
|
...form.register("password")
|
|
556
673
|
}
|
|
557
|
-
), form.formState.errors.password && /* @__PURE__ */
|
|
674
|
+
), form.formState.errors.password && /* @__PURE__ */ React11.createElement("p", { className: "text-sm text-destructive" }, form.formState.errors.password.message)), /* @__PURE__ */ React11.createElement("div", { className: "grid gap-2" }, /* @__PURE__ */ React11.createElement(Label, { htmlFor: "confirmPassword" }, "Confirm Password"), /* @__PURE__ */ React11.createElement(
|
|
558
675
|
Input,
|
|
559
676
|
{
|
|
560
677
|
id: "confirmPassword",
|
|
@@ -564,16 +681,16 @@ function ResetPasswordForm({
|
|
|
564
681
|
disabled: isLoading,
|
|
565
682
|
...form.register("confirmPassword")
|
|
566
683
|
}
|
|
567
|
-
), form.formState.errors.confirmPassword && /* @__PURE__ */
|
|
684
|
+
), form.formState.errors.confirmPassword && /* @__PURE__ */ React11.createElement("p", { className: "text-sm text-destructive" }, form.formState.errors.confirmPassword.message)), /* @__PURE__ */ React11.createElement(Button, { type: "submit", className: "w-full", disabled: isLoading }, isLoading && /* @__PURE__ */ React11.createElement(Loader25, { className: "mr-2 h-4 w-4 animate-spin" }), "Reset Password"));
|
|
568
685
|
}
|
|
569
686
|
|
|
570
687
|
// src/ui/components/auth/AuthCard.tsx
|
|
571
|
-
import
|
|
688
|
+
import React13 from "react";
|
|
572
689
|
|
|
573
690
|
// src/ui/components/ui/Card.tsx
|
|
574
|
-
import
|
|
575
|
-
var Card =
|
|
576
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
691
|
+
import React12, { forwardRef as forwardRef6 } from "react";
|
|
692
|
+
var Card = forwardRef6(
|
|
693
|
+
({ className, ...props }, ref) => /* @__PURE__ */ React12.createElement(
|
|
577
694
|
"div",
|
|
578
695
|
{
|
|
579
696
|
ref,
|
|
@@ -583,12 +700,12 @@ var Card = forwardRef5(
|
|
|
583
700
|
)
|
|
584
701
|
);
|
|
585
702
|
Card.displayName = "Card";
|
|
586
|
-
var CardHeader =
|
|
587
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
703
|
+
var CardHeader = forwardRef6(
|
|
704
|
+
({ className, ...props }, ref) => /* @__PURE__ */ React12.createElement("div", { ref, className: cn("flex flex-col space-y-1.5 p-6", className), ...props })
|
|
588
705
|
);
|
|
589
706
|
CardHeader.displayName = "CardHeader";
|
|
590
|
-
var CardTitle =
|
|
591
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
707
|
+
var CardTitle = forwardRef6(
|
|
708
|
+
({ className, ...props }, ref) => /* @__PURE__ */ React12.createElement(
|
|
592
709
|
"h3",
|
|
593
710
|
{
|
|
594
711
|
ref,
|
|
@@ -598,16 +715,16 @@ var CardTitle = forwardRef5(
|
|
|
598
715
|
)
|
|
599
716
|
);
|
|
600
717
|
CardTitle.displayName = "CardTitle";
|
|
601
|
-
var CardDescription =
|
|
602
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
718
|
+
var CardDescription = forwardRef6(
|
|
719
|
+
({ className, ...props }, ref) => /* @__PURE__ */ React12.createElement("p", { ref, className: cn("text-sm text-muted-foreground", className), ...props })
|
|
603
720
|
);
|
|
604
721
|
CardDescription.displayName = "CardDescription";
|
|
605
|
-
var CardContent =
|
|
606
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
722
|
+
var CardContent = forwardRef6(
|
|
723
|
+
({ className, ...props }, ref) => /* @__PURE__ */ React12.createElement("div", { ref, className: cn("p-6 pt-0", className), ...props })
|
|
607
724
|
);
|
|
608
725
|
CardContent.displayName = "CardContent";
|
|
609
|
-
var CardFooter =
|
|
610
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
726
|
+
var CardFooter = forwardRef6(
|
|
727
|
+
({ className, ...props }, ref) => /* @__PURE__ */ React12.createElement("div", { ref, className: cn("flex items-center p-6 pt-0", className), ...props })
|
|
611
728
|
);
|
|
612
729
|
CardFooter.displayName = "CardFooter";
|
|
613
730
|
|
|
@@ -654,18 +771,18 @@ function AuthCard({
|
|
|
654
771
|
const renderForm = () => {
|
|
655
772
|
switch (currentView) {
|
|
656
773
|
case "sign-in":
|
|
657
|
-
return /* @__PURE__ */
|
|
774
|
+
return /* @__PURE__ */ React13.createElement(SignInForm, { redirectTo, onSuccess, onError });
|
|
658
775
|
case "sign-up":
|
|
659
|
-
return /* @__PURE__ */
|
|
776
|
+
return /* @__PURE__ */ React13.createElement(SignUpForm, { redirectTo, onSuccess, onError });
|
|
660
777
|
case "forgot-password":
|
|
661
|
-
return /* @__PURE__ */
|
|
778
|
+
return /* @__PURE__ */ React13.createElement(ForgotPasswordForm, { onSuccess, onError });
|
|
662
779
|
case "reset-password":
|
|
663
|
-
return /* @__PURE__ */
|
|
780
|
+
return /* @__PURE__ */ React13.createElement(ResetPasswordForm, { token: resetToken, onSuccess, onError });
|
|
664
781
|
default:
|
|
665
|
-
return /* @__PURE__ */
|
|
782
|
+
return /* @__PURE__ */ React13.createElement(SignInForm, { redirectTo, onSuccess, onError });
|
|
666
783
|
}
|
|
667
784
|
};
|
|
668
|
-
return /* @__PURE__ */
|
|
785
|
+
return /* @__PURE__ */ React13.createElement(Card, { className: cn("w-full max-w-md mx-auto", className) }, /* @__PURE__ */ React13.createElement(CardHeader, { className: "text-center" }, /* @__PURE__ */ React13.createElement(CardTitle, { className: "text-2xl" }, getTitle()), /* @__PURE__ */ React13.createElement(CardDescription, null, getDescription())), /* @__PURE__ */ React13.createElement(CardContent, null, renderForm()));
|
|
669
786
|
}
|
|
670
787
|
function parsePathname(pathname, viewPaths) {
|
|
671
788
|
if (!pathname) return "sign-in";
|
|
@@ -686,7 +803,7 @@ function parsePathname(pathname, viewPaths) {
|
|
|
686
803
|
}
|
|
687
804
|
|
|
688
805
|
// src/ui/components/user/UserAvatar.tsx
|
|
689
|
-
import
|
|
806
|
+
import React14, { forwardRef as forwardRef7 } from "react";
|
|
690
807
|
import * as AvatarPrimitive from "@radix-ui/react-avatar";
|
|
691
808
|
var sizeClasses = {
|
|
692
809
|
sm: "h-8 w-8 text-xs",
|
|
@@ -706,10 +823,10 @@ function getInitials(name, email) {
|
|
|
706
823
|
}
|
|
707
824
|
return "U";
|
|
708
825
|
}
|
|
709
|
-
var UserAvatar =
|
|
826
|
+
var UserAvatar = forwardRef7(
|
|
710
827
|
({ className, src, name, email, size = "md" }, ref) => {
|
|
711
828
|
const initials = getInitials(name, email);
|
|
712
|
-
return /* @__PURE__ */
|
|
829
|
+
return /* @__PURE__ */ React14.createElement(
|
|
713
830
|
AvatarPrimitive.Root,
|
|
714
831
|
{
|
|
715
832
|
ref,
|
|
@@ -719,7 +836,7 @@ var UserAvatar = forwardRef6(
|
|
|
719
836
|
className
|
|
720
837
|
)
|
|
721
838
|
},
|
|
722
|
-
src && /* @__PURE__ */
|
|
839
|
+
src && /* @__PURE__ */ React14.createElement(
|
|
723
840
|
AvatarPrimitive.Image,
|
|
724
841
|
{
|
|
725
842
|
src,
|
|
@@ -727,7 +844,7 @@ var UserAvatar = forwardRef6(
|
|
|
727
844
|
className: "aspect-square h-full w-full object-cover"
|
|
728
845
|
}
|
|
729
846
|
),
|
|
730
|
-
/* @__PURE__ */
|
|
847
|
+
/* @__PURE__ */ React14.createElement(
|
|
731
848
|
AvatarPrimitive.Fallback,
|
|
732
849
|
{
|
|
733
850
|
className: "flex h-full w-full items-center justify-center rounded-full bg-muted font-medium",
|
|
@@ -741,13 +858,13 @@ var UserAvatar = forwardRef6(
|
|
|
741
858
|
UserAvatar.displayName = "UserAvatar";
|
|
742
859
|
|
|
743
860
|
// src/ui/components/user/UserButton.tsx
|
|
744
|
-
import
|
|
861
|
+
import React15, { useState as useState6 } from "react";
|
|
745
862
|
import * as DropdownMenu from "@radix-ui/react-dropdown-menu";
|
|
746
863
|
import { LogOut, Settings } from "lucide-react";
|
|
747
864
|
function UserButton({ className, showSettings = true, settingsUrl }) {
|
|
748
865
|
const { authClient, navigate, basePath, viewPaths, toast, onSessionChange } = useAuthUI();
|
|
749
866
|
const { data: session, isPending } = authClient.useSession();
|
|
750
|
-
const [isSigningOut, setIsSigningOut] =
|
|
867
|
+
const [isSigningOut, setIsSigningOut] = useState6(false);
|
|
751
868
|
const handleSignOut = async () => {
|
|
752
869
|
setIsSigningOut(true);
|
|
753
870
|
try {
|
|
@@ -766,14 +883,14 @@ function UserButton({ className, showSettings = true, settingsUrl }) {
|
|
|
766
883
|
}
|
|
767
884
|
};
|
|
768
885
|
if (isPending) {
|
|
769
|
-
return /* @__PURE__ */
|
|
886
|
+
return /* @__PURE__ */ React15.createElement("div", { className: cn("h-10 w-10 rounded-full bg-muted animate-pulse", className) });
|
|
770
887
|
}
|
|
771
888
|
if (!session?.user) {
|
|
772
889
|
return null;
|
|
773
890
|
}
|
|
774
891
|
const user = session.user;
|
|
775
892
|
const effectiveSettingsUrl = settingsUrl || `${basePath}/${viewPaths.settings}`;
|
|
776
|
-
return /* @__PURE__ */
|
|
893
|
+
return /* @__PURE__ */ React15.createElement(DropdownMenu.Root, null, /* @__PURE__ */ React15.createElement(DropdownMenu.Trigger, { asChild: true }, /* @__PURE__ */ React15.createElement(
|
|
777
894
|
"button",
|
|
778
895
|
{
|
|
779
896
|
className: cn(
|
|
@@ -781,7 +898,7 @@ function UserButton({ className, showSettings = true, settingsUrl }) {
|
|
|
781
898
|
className
|
|
782
899
|
)
|
|
783
900
|
},
|
|
784
|
-
/* @__PURE__ */
|
|
901
|
+
/* @__PURE__ */ React15.createElement(
|
|
785
902
|
UserAvatar,
|
|
786
903
|
{
|
|
787
904
|
src: user.image,
|
|
@@ -790,78 +907,78 @@ function UserButton({ className, showSettings = true, settingsUrl }) {
|
|
|
790
907
|
size: "md"
|
|
791
908
|
}
|
|
792
909
|
)
|
|
793
|
-
)), /* @__PURE__ */
|
|
910
|
+
)), /* @__PURE__ */ React15.createElement(DropdownMenu.Portal, null, /* @__PURE__ */ React15.createElement(
|
|
794
911
|
DropdownMenu.Content,
|
|
795
912
|
{
|
|
796
913
|
className: "z-50 min-w-[200px] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95",
|
|
797
914
|
sideOffset: 5,
|
|
798
915
|
align: "end"
|
|
799
916
|
},
|
|
800
|
-
/* @__PURE__ */
|
|
801
|
-
/* @__PURE__ */
|
|
802
|
-
showSettings && /* @__PURE__ */
|
|
917
|
+
/* @__PURE__ */ React15.createElement("div", { className: "px-2 py-1.5 text-sm" }, /* @__PURE__ */ React15.createElement("p", { className: "font-medium" }, user.name || "User"), /* @__PURE__ */ React15.createElement("p", { className: "text-xs text-muted-foreground" }, user.email)),
|
|
918
|
+
/* @__PURE__ */ React15.createElement(DropdownMenu.Separator, { className: "my-1 h-px bg-border" }),
|
|
919
|
+
showSettings && /* @__PURE__ */ React15.createElement(
|
|
803
920
|
DropdownMenu.Item,
|
|
804
921
|
{
|
|
805
922
|
className: "relative flex cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground",
|
|
806
923
|
onSelect: () => navigate(effectiveSettingsUrl)
|
|
807
924
|
},
|
|
808
|
-
/* @__PURE__ */
|
|
925
|
+
/* @__PURE__ */ React15.createElement(Settings, { className: "mr-2 h-4 w-4" }),
|
|
809
926
|
"Settings"
|
|
810
927
|
),
|
|
811
|
-
/* @__PURE__ */
|
|
928
|
+
/* @__PURE__ */ React15.createElement(
|
|
812
929
|
DropdownMenu.Item,
|
|
813
930
|
{
|
|
814
931
|
className: "relative flex cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground text-destructive focus:text-destructive",
|
|
815
932
|
onSelect: handleSignOut,
|
|
816
933
|
disabled: isSigningOut
|
|
817
934
|
},
|
|
818
|
-
/* @__PURE__ */
|
|
935
|
+
/* @__PURE__ */ React15.createElement(LogOut, { className: "mr-2 h-4 w-4" }),
|
|
819
936
|
isSigningOut ? "Signing out..." : "Sign out"
|
|
820
937
|
)
|
|
821
938
|
)));
|
|
822
939
|
}
|
|
823
940
|
|
|
824
941
|
// src/ui/components/user/UserView.tsx
|
|
825
|
-
import
|
|
942
|
+
import React16 from "react";
|
|
826
943
|
function UserView({ className, showEmail = true }) {
|
|
827
944
|
const { authClient } = useAuthUI();
|
|
828
945
|
const { data: session, isPending } = authClient.useSession();
|
|
829
946
|
if (isPending) {
|
|
830
|
-
return /* @__PURE__ */
|
|
947
|
+
return /* @__PURE__ */ React16.createElement("div", { className: cn("flex items-center gap-3", className) }, /* @__PURE__ */ React16.createElement("div", { className: "h-10 w-10 rounded-full bg-muted animate-pulse" }), /* @__PURE__ */ React16.createElement("div", { className: "space-y-1" }, /* @__PURE__ */ React16.createElement("div", { className: "h-4 w-24 bg-muted animate-pulse rounded" }), showEmail && /* @__PURE__ */ React16.createElement("div", { className: "h-3 w-32 bg-muted animate-pulse rounded" })));
|
|
831
948
|
}
|
|
832
949
|
if (!session?.user) {
|
|
833
950
|
return null;
|
|
834
951
|
}
|
|
835
952
|
const user = session.user;
|
|
836
|
-
return /* @__PURE__ */
|
|
953
|
+
return /* @__PURE__ */ React16.createElement("div", { className: cn("flex items-center gap-3", className) }, /* @__PURE__ */ React16.createElement(UserAvatar, { src: user.image, name: user.name, email: user.email, size: "md" }), /* @__PURE__ */ React16.createElement("div", { className: "flex flex-col" }, /* @__PURE__ */ React16.createElement("span", { className: "text-sm font-medium" }, user.name || "User"), showEmail && user.email && /* @__PURE__ */ React16.createElement("span", { className: "text-xs text-muted-foreground" }, user.email)));
|
|
837
954
|
}
|
|
838
955
|
|
|
839
956
|
// src/ui/components/user/SignedIn.tsx
|
|
840
|
-
import
|
|
957
|
+
import React17 from "react";
|
|
841
958
|
function SignedIn({ children, fallback = null }) {
|
|
842
959
|
const { authClient } = useAuthUI();
|
|
843
960
|
const { data: session, isPending } = authClient.useSession();
|
|
844
961
|
if (isPending) {
|
|
845
|
-
return /* @__PURE__ */
|
|
962
|
+
return /* @__PURE__ */ React17.createElement(React17.Fragment, null, fallback);
|
|
846
963
|
}
|
|
847
964
|
if (!session?.user) {
|
|
848
965
|
return null;
|
|
849
966
|
}
|
|
850
|
-
return /* @__PURE__ */
|
|
967
|
+
return /* @__PURE__ */ React17.createElement(React17.Fragment, null, children);
|
|
851
968
|
}
|
|
852
969
|
|
|
853
970
|
// src/ui/components/user/SignedOut.tsx
|
|
854
|
-
import
|
|
971
|
+
import React18 from "react";
|
|
855
972
|
function SignedOut({ children, fallback = null }) {
|
|
856
973
|
const { authClient } = useAuthUI();
|
|
857
974
|
const { data: session, isPending } = authClient.useSession();
|
|
858
975
|
if (isPending) {
|
|
859
|
-
return /* @__PURE__ */
|
|
976
|
+
return /* @__PURE__ */ React18.createElement(React18.Fragment, null, fallback);
|
|
860
977
|
}
|
|
861
978
|
if (session?.user) {
|
|
862
979
|
return null;
|
|
863
980
|
}
|
|
864
|
-
return /* @__PURE__ */
|
|
981
|
+
return /* @__PURE__ */ React18.createElement(React18.Fragment, null, children);
|
|
865
982
|
}
|
|
866
983
|
|
|
867
984
|
// src/ui/components/user/RedirectToSignIn.tsx
|
|
@@ -887,32 +1004,13 @@ function RedirectToSignUp({ redirectTo }) {
|
|
|
887
1004
|
}
|
|
888
1005
|
|
|
889
1006
|
// src/ui/components/settings/SettingsCards.tsx
|
|
890
|
-
import
|
|
1007
|
+
import React21 from "react";
|
|
891
1008
|
function SettingsCard({ className, title, description, children }) {
|
|
892
|
-
return /* @__PURE__ */
|
|
1009
|
+
return /* @__PURE__ */ React21.createElement(Card, { className: cn("", className) }, /* @__PURE__ */ React21.createElement(CardHeader, null, /* @__PURE__ */ React21.createElement(CardTitle, null, title), description && /* @__PURE__ */ React21.createElement(CardDescription, null, description)), /* @__PURE__ */ React21.createElement(CardContent, null, children));
|
|
893
1010
|
}
|
|
894
1011
|
function SettingsCards({ className, children }) {
|
|
895
|
-
return /* @__PURE__ */
|
|
1012
|
+
return /* @__PURE__ */ React21.createElement("div", { className: cn("space-y-6", className) }, children);
|
|
896
1013
|
}
|
|
897
|
-
|
|
898
|
-
// src/ui/components/ui/Separator.tsx
|
|
899
|
-
import React20, { forwardRef as forwardRef7 } from "react";
|
|
900
|
-
import * as SeparatorPrimitive from "@radix-ui/react-separator";
|
|
901
|
-
var Separator2 = forwardRef7(({ className, orientation = "horizontal", decorative = true, ...props }, ref) => /* @__PURE__ */ React20.createElement(
|
|
902
|
-
SeparatorPrimitive.Root,
|
|
903
|
-
{
|
|
904
|
-
ref,
|
|
905
|
-
decorative,
|
|
906
|
-
orientation,
|
|
907
|
-
className: cn(
|
|
908
|
-
"shrink-0 bg-border",
|
|
909
|
-
orientation === "horizontal" ? "h-[1px] w-full" : "h-full w-[1px]",
|
|
910
|
-
className
|
|
911
|
-
),
|
|
912
|
-
...props
|
|
913
|
-
}
|
|
914
|
-
));
|
|
915
|
-
Separator2.displayName = SeparatorPrimitive.Root.displayName;
|
|
916
1014
|
export {
|
|
917
1015
|
AuthCard,
|
|
918
1016
|
AuthCard as AuthForm,
|
|
@@ -932,13 +1030,14 @@ export {
|
|
|
932
1030
|
RedirectToSignIn,
|
|
933
1031
|
RedirectToSignUp,
|
|
934
1032
|
ResetPasswordForm,
|
|
935
|
-
|
|
1033
|
+
Separator,
|
|
936
1034
|
SettingsCard,
|
|
937
1035
|
SettingsCards,
|
|
938
1036
|
SignInForm,
|
|
939
1037
|
SignUpForm,
|
|
940
1038
|
SignedIn,
|
|
941
1039
|
SignedOut,
|
|
1040
|
+
SocialAuthButtons,
|
|
942
1041
|
UserAvatar,
|
|
943
1042
|
UserButton,
|
|
944
1043
|
UserView,
|