@authdog/react-elements 0.0.33 → 0.0.34
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/.turbo/turbo-build.log +35 -35
- package/CHANGELOG.md +6 -0
- package/dist/index.d.mts +9 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +39 -11
- package/package.json +1 -1
- package/src/components/core/user-profile.tsx +159 -63
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @authdog/react-elements@0.0.
|
|
2
|
+
> @authdog/react-elements@0.0.34 build /home/runner/work/web-sdk/web-sdk/packages/react-elements
|
|
3
3
|
> pnpm tsup && pnpm build:styles
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: src/index.ts, src/lib/utils.ts, src/components/ui/alert.tsx, src/components/ui/avatar.tsx, src/components/ui/badge.tsx, src/components/ui/button.tsx, src/components/ui/card.tsx, src/components/ui/dropdown-menu.tsx, src/components/ui/input.tsx, src/components/ui/label.tsx, src/components/ui/separator.tsx, src/components/ui/sheet.tsx
|
|
@@ -10,9 +10,34 @@
|
|
|
10
10
|
[34mCLI[39m Cleaning output folder
|
|
11
11
|
[34mESM[39m Build start
|
|
12
12
|
[34mCJS[39m Build start
|
|
13
|
-
[
|
|
14
|
-
[
|
|
13
|
+
[32mESM[39m [1mdist/components/ui/alert.mjs [22m[32m1.19 KB[39m
|
|
14
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m24.39 KB[39m
|
|
15
|
+
[32mESM[39m [1mdist/lib/utils.mjs [22m[32m166.00 B[39m
|
|
16
|
+
[32mESM[39m [1mdist/components/ui/avatar.mjs [22m[32m749.00 B[39m
|
|
17
|
+
[32mESM[39m [1mdist/components/ui/badge.mjs [22m[32m1.34 KB[39m
|
|
18
|
+
[32mESM[39m [1mdist/components/ui/button.mjs [22m[32m1.36 KB[39m
|
|
19
|
+
[32mESM[39m [1mdist/components/ui/card.mjs [22m[32m1.35 KB[39m
|
|
20
|
+
[32mESM[39m [1mdist/components/ui/dropdown-menu.mjs [22m[32m5.37 KB[39m
|
|
21
|
+
[32mESM[39m [1mdist/components/ui/input.mjs [22m[32m949.00 B[39m
|
|
22
|
+
[32mESM[39m [1mdist/components/ui/label.mjs [22m[32m566.00 B[39m
|
|
23
|
+
[32mESM[39m [1mdist/components/ui/separator.mjs [22m[32m604.00 B[39m
|
|
24
|
+
[32mESM[39m [1mdist/components/ui/sheet.mjs [22m[32m2.68 KB[39m
|
|
25
|
+
[32mESM[39m [1mdist/components/ui/alert.mjs.map [22m[32m2.82 KB[39m
|
|
26
|
+
[32mESM[39m [1mdist/index.mjs.map [22m[32m77.82 KB[39m
|
|
27
|
+
[32mESM[39m [1mdist/lib/utils.mjs.map [22m[32m415.00 B[39m
|
|
28
|
+
[32mESM[39m [1mdist/components/ui/avatar.mjs.map [22m[32m2.13 KB[39m
|
|
29
|
+
[32mESM[39m [1mdist/components/ui/badge.mjs.map [22m[32m2.63 KB[39m
|
|
30
|
+
[32mESM[39m [1mdist/components/ui/button.mjs.map [22m[32m3.01 KB[39m
|
|
31
|
+
[32mESM[39m [1mdist/components/ui/card.mjs.map [22m[32m3.54 KB[39m
|
|
32
|
+
[32mESM[39m [1mdist/components/ui/dropdown-menu.mjs.map [22m[32m12.03 KB[39m
|
|
33
|
+
[32mESM[39m [1mdist/components/ui/input.mjs.map [22m[32m1.67 KB[39m
|
|
34
|
+
[32mESM[39m [1mdist/components/ui/label.mjs.map [22m[32m1.32 KB[39m
|
|
35
|
+
[32mESM[39m [1mdist/components/ui/separator.mjs.map [22m[32m1.51 KB[39m
|
|
36
|
+
[32mESM[39m [1mdist/components/ui/sheet.mjs.map [22m[32m6.49 KB[39m
|
|
37
|
+
[32mESM[39m ⚡️ Build success in 194ms
|
|
38
|
+
[32mCJS[39m [1mdist/index.js [22m[32m26.50 KB[39m
|
|
15
39
|
[32mCJS[39m [1mdist/lib/utils.js [22m[32m620.00 B[39m
|
|
40
|
+
[32mCJS[39m [1mdist/components/ui/alert.js [22m[32m1.65 KB[39m
|
|
16
41
|
[32mCJS[39m [1mdist/components/ui/avatar.js [22m[32m1.34 KB[39m
|
|
17
42
|
[32mCJS[39m [1mdist/components/ui/badge.js [22m[32m1.78 KB[39m
|
|
18
43
|
[32mCJS[39m [1mdist/components/ui/button.js [22m[32m1.94 KB[39m
|
|
@@ -22,9 +47,9 @@
|
|
|
22
47
|
[32mCJS[39m [1mdist/components/ui/label.js [22m[32m1.14 KB[39m
|
|
23
48
|
[32mCJS[39m [1mdist/components/ui/separator.js [22m[32m1.18 KB[39m
|
|
24
49
|
[32mCJS[39m [1mdist/components/ui/sheet.js [22m[32m3.36 KB[39m
|
|
25
|
-
[32mCJS[39m [1mdist/
|
|
26
|
-
[32mCJS[39m [1mdist/index.js.map [22m[32m70.61 KB[39m
|
|
50
|
+
[32mCJS[39m [1mdist/index.js.map [22m[32m77.33 KB[39m
|
|
27
51
|
[32mCJS[39m [1mdist/lib/utils.js.map [22m[32m520.00 B[39m
|
|
52
|
+
[32mCJS[39m [1mdist/components/ui/alert.js.map [22m[32m3.01 KB[39m
|
|
28
53
|
[32mCJS[39m [1mdist/components/ui/avatar.js.map [22m[32m2.31 KB[39m
|
|
29
54
|
[32mCJS[39m [1mdist/components/ui/badge.js.map [22m[32m2.79 KB[39m
|
|
30
55
|
[32mCJS[39m [1mdist/components/ui/button.js.map [22m[32m3.17 KB[39m
|
|
@@ -34,37 +59,12 @@
|
|
|
34
59
|
[32mCJS[39m [1mdist/components/ui/label.js.map [22m[32m1.45 KB[39m
|
|
35
60
|
[32mCJS[39m [1mdist/components/ui/separator.js.map [22m[32m1.64 KB[39m
|
|
36
61
|
[32mCJS[39m [1mdist/components/ui/sheet.js.map [22m[32m6.75 KB[39m
|
|
37
|
-
[32mCJS[39m ⚡️ Build success in
|
|
38
|
-
[32mESM[39m [1mdist/index.mjs [22m[32m21.84 KB[39m
|
|
39
|
-
[32mESM[39m [1mdist/lib/utils.mjs [22m[32m166.00 B[39m
|
|
40
|
-
[32mESM[39m [1mdist/components/ui/alert.mjs [22m[32m1.19 KB[39m
|
|
41
|
-
[32mESM[39m [1mdist/components/ui/avatar.mjs [22m[32m749.00 B[39m
|
|
42
|
-
[32mESM[39m [1mdist/components/ui/badge.mjs [22m[32m1.34 KB[39m
|
|
43
|
-
[32mESM[39m [1mdist/components/ui/button.mjs [22m[32m1.36 KB[39m
|
|
44
|
-
[32mESM[39m [1mdist/components/ui/card.mjs [22m[32m1.35 KB[39m
|
|
45
|
-
[32mESM[39m [1mdist/components/ui/input.mjs [22m[32m949.00 B[39m
|
|
46
|
-
[32mESM[39m [1mdist/components/ui/label.mjs [22m[32m566.00 B[39m
|
|
47
|
-
[32mESM[39m [1mdist/components/ui/separator.mjs [22m[32m604.00 B[39m
|
|
48
|
-
[32mESM[39m [1mdist/components/ui/sheet.mjs [22m[32m2.68 KB[39m
|
|
49
|
-
[32mESM[39m [1mdist/components/ui/dropdown-menu.mjs [22m[32m5.37 KB[39m
|
|
50
|
-
[32mESM[39m [1mdist/index.mjs.map [22m[32m70.93 KB[39m
|
|
51
|
-
[32mESM[39m [1mdist/lib/utils.mjs.map [22m[32m415.00 B[39m
|
|
52
|
-
[32mESM[39m [1mdist/components/ui/alert.mjs.map [22m[32m2.82 KB[39m
|
|
53
|
-
[32mESM[39m [1mdist/components/ui/avatar.mjs.map [22m[32m2.13 KB[39m
|
|
54
|
-
[32mESM[39m [1mdist/components/ui/badge.mjs.map [22m[32m2.63 KB[39m
|
|
55
|
-
[32mESM[39m [1mdist/components/ui/button.mjs.map [22m[32m3.01 KB[39m
|
|
56
|
-
[32mESM[39m [1mdist/components/ui/card.mjs.map [22m[32m3.54 KB[39m
|
|
57
|
-
[32mESM[39m [1mdist/components/ui/input.mjs.map [22m[32m1.67 KB[39m
|
|
58
|
-
[32mESM[39m [1mdist/components/ui/label.mjs.map [22m[32m1.32 KB[39m
|
|
59
|
-
[32mESM[39m [1mdist/components/ui/separator.mjs.map [22m[32m1.51 KB[39m
|
|
60
|
-
[32mESM[39m [1mdist/components/ui/sheet.mjs.map [22m[32m6.49 KB[39m
|
|
61
|
-
[32mESM[39m [1mdist/components/ui/dropdown-menu.mjs.map [22m[32m12.03 KB[39m
|
|
62
|
-
[32mESM[39m ⚡️ Build success in 155ms
|
|
62
|
+
[32mCJS[39m ⚡️ Build success in 200ms
|
|
63
63
|
[34mDTS[39m Build start
|
|
64
|
-
[32mDTS[39m ⚡️ Build success in
|
|
65
|
-
[32mDTS[39m [1mdist/index.d.mts [22m[32m3.
|
|
66
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[32m3.
|
|
64
|
+
[32mDTS[39m ⚡️ Build success in 5638ms
|
|
65
|
+
[32mDTS[39m [1mdist/index.d.mts [22m[32m3.45 KB[39m
|
|
66
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m3.45 KB[39m
|
|
67
67
|
|
|
68
|
-
> @authdog/react-elements@0.0.
|
|
68
|
+
> @authdog/react-elements@0.0.34 build:styles /home/runner/work/web-sdk/web-sdk/packages/react-elements
|
|
69
69
|
> postcss src/global.css -o dist/styles.css
|
|
70
70
|
|
package/CHANGELOG.md
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -46,8 +46,16 @@ interface UserProfileProps {
|
|
|
46
46
|
isPrimary?: boolean;
|
|
47
47
|
}[];
|
|
48
48
|
handleAuthenticated?: () => void;
|
|
49
|
+
onRequestEmailVerification?: (email: string) => Promise<{
|
|
50
|
+
success: boolean;
|
|
51
|
+
message?: string;
|
|
52
|
+
} | void>;
|
|
53
|
+
onVerifyEmail?: (email: string, code: string) => Promise<{
|
|
54
|
+
success: boolean;
|
|
55
|
+
message?: string;
|
|
56
|
+
} | void>;
|
|
49
57
|
}
|
|
50
|
-
declare const UserProfile: ({ loading, user, handleAuthenticated }: UserProfileProps) => react_jsx_runtime.JSX.Element;
|
|
58
|
+
declare const UserProfile: ({ loading, user, handleAuthenticated, onRequestEmailVerification, onVerifyEmail, }: UserProfileProps) => react_jsx_runtime.JSX.Element;
|
|
51
59
|
|
|
52
60
|
type UserDropdownLink = {
|
|
53
61
|
label: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -46,8 +46,16 @@ interface UserProfileProps {
|
|
|
46
46
|
isPrimary?: boolean;
|
|
47
47
|
}[];
|
|
48
48
|
handleAuthenticated?: () => void;
|
|
49
|
+
onRequestEmailVerification?: (email: string) => Promise<{
|
|
50
|
+
success: boolean;
|
|
51
|
+
message?: string;
|
|
52
|
+
} | void>;
|
|
53
|
+
onVerifyEmail?: (email: string, code: string) => Promise<{
|
|
54
|
+
success: boolean;
|
|
55
|
+
message?: string;
|
|
56
|
+
} | void>;
|
|
49
57
|
}
|
|
50
|
-
declare const UserProfile: ({ loading, user, handleAuthenticated }: UserProfileProps) => react_jsx_runtime.JSX.Element;
|
|
58
|
+
declare const UserProfile: ({ loading, user, handleAuthenticated, onRequestEmailVerification, onVerifyEmail, }: UserProfileProps) => react_jsx_runtime.JSX.Element;
|
|
51
59
|
|
|
52
60
|
type UserDropdownLink = {
|
|
53
61
|
label: string;
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
"use strict";var Be=Object.create;var U=Object.defineProperty;var Ge=Object.getOwnPropertyDescriptor;var Oe=Object.getOwnPropertyNames;var _e=Object.getPrototypeOf,Ue=Object.prototype.hasOwnProperty;var Fe=(e,t)=>{for(var r in t)U(e,r,{get:t[r],enumerable:!0})},se=(e,t,r,l)=>{if(t&&typeof t=="object"||typeof t=="function")for(let d of Oe(t))!Ue.call(e,d)&&d!==r&&U(e,d,{get:()=>t[d],enumerable:!(l=Ge(t,d))||l.enumerable});return e};var F=(e,t,r)=>(r=e!=null?Be(_e(e)):{},se(t||!e||!e.__esModule?U(r,"default",{value:e,enumerable:!0}):r,e)),je=e=>se(U({},"__esModule",{value:!0}),e);var Ze={};Fe(Ze,{Button:()=>v,ClientOnly:()=>fe,Navbar:()=>Ne,PlaceholderAlert:()=>Ve,TOTPValidator:()=>ze,UserDropdown:()=>Re,UserProfile:()=>Se});module.exports=je(Ze);var ce=F(require("react")),me=require("@radix-ui/react-slot"),pe=require("class-variance-authority");var de=require("clsx"),le=require("tailwind-merge");function s(...e){return(0,le.twMerge)((0,de.clsx)(e))}var ue=require("react/jsx-runtime"),He=(0,pe.cva)("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),v=ce.forwardRef(({className:e,variant:t,size:r,asChild:l=!1,...d},h)=>(0,ue.jsx)(l?me.Slot:"button",{className:s(He({variant:t,size:r,className:e})),ref:h,...d}));v.displayName="Button";var j=require("react"),H=require("react/jsx-runtime"),fe=({children:e})=>{let[t,r]=(0,j.useState)(!1);return(0,j.useEffect)(()=>{r(!0)},[]),t?(0,H.jsx)(H.Fragment,{children:e}):null};var we=require("react"),B=require("lucide-react");var A=F(require("@radix-ui/react-avatar"));var $=require("react/jsx-runtime");function T({className:e,...t}){return(0,$.jsx)(A.Root,{"data-slot":"avatar",className:s("relative flex size-8 shrink-0 overflow-hidden rounded-full",e),...t})}function V({className:e,...t}){return(0,$.jsx)(A.Image,{"data-slot":"avatar-image",className:s("aspect-square size-full",e),...t})}function z({className:e,...t}){return(0,$.jsx)(A.Fallback,{"data-slot":"avatar-fallback",className:s("bg-muted flex size-full items-center justify-center rounded-full",e),...t})}var c=F(require("@radix-ui/react-dropdown-menu")),oe=require("lucide-react");var N=require("react/jsx-runtime");function K({...e}){return(0,N.jsx)(c.Root,{"data-slot":"dropdown-menu",...e})}function W({...e}){return(0,N.jsx)(c.Trigger,{"data-slot":"dropdown-menu-trigger",...e})}function q({className:e,sideOffset:t=4,...r}){return(0,N.jsx)(c.Portal,{children:(0,N.jsx)(c.Content,{"data-slot":"dropdown-menu-content",sideOffset:t,className:s("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",e),...r})})}function ve({...e}){return(0,N.jsx)(c.Group,{"data-slot":"dropdown-menu-group",...e})}function D({className:e,inset:t,variant:r="default",...l}){return(0,N.jsx)(c.Item,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":r,className:s("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...l})}function ge({className:e,inset:t,...r}){return(0,N.jsx)(c.Label,{"data-slot":"dropdown-menu-label","data-inset":t,className:s("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",e),...r})}function E({className:e,...t}){return(0,N.jsx)(c.Separator,{"data-slot":"dropdown-menu-separator",className:s("bg-border -mx-1 my-1 h-px",e),...t})}var g=F(require("@radix-ui/react-dialog")),he=require("lucide-react");var b=require("react/jsx-runtime"),$e=he.X;function xe({...e}){return(0,b.jsx)(g.Root,{"data-slot":"sheet",...e})}function be({...e}){return(0,b.jsx)(g.Trigger,{"data-slot":"sheet-trigger",...e})}function Ke({...e}){return(0,b.jsx)(g.Portal,{"data-slot":"sheet-portal",...e})}function We({className:e,...t}){return(0,b.jsx)(g.Overlay,{"data-slot":"sheet-overlay",className:s("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",e),...t})}function ye({className:e,children:t,side:r="right",...l}){return(0,b.jsxs)(Ke,{children:[(0,b.jsx)(We,{}),(0,b.jsxs)(g.Content,{"data-slot":"sheet-content",className:s("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500",r==="right"&&"data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm",r==="left"&&"data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm",r==="top"&&"data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b",r==="bottom"&&"data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t",e),...l,children:[t,(0,b.jsxs)(g.Close,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none",children:[(0,b.jsx)($e,{className:"size-4"}),(0,b.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})}var J=require("react"),X=require("react/jsx-runtime"),qe={className:"mr-2 h-4 w-4","aria-hidden":"true"},Xe=e=>{let[t,r]=(0,J.useState)(!1);return(0,J.useEffect)(()=>{r(!0)},[]),t?(0,X.jsx)(e,{...qe}):(0,X.jsx)("span",{className:"mr-2 h-4 w-4","aria-hidden":"true"})},L=({Icon:e})=>(0,X.jsx)("span",{className:"inline-flex items-center justify-center",children:Xe(e)});var a=require("react/jsx-runtime");function Ne({items:e=[],children:t,className:r,logoText:l="ACME Corp",user:d={name:"John Doe",email:"john@example.com",image:"https://i.pravatar.cc/150?u=a042581f4e29026704d"},onNavigateHome:h=()=>console.log("Navigating to home"),onNavItemClick:x=k=>console.log(`Navigating to ${k}`),onProfileSelected:C,onLogout:P=()=>console.log("Logout clicked"),isLoading:u=!1,identityHost:y="https://stg-id.authdog.xyz",environmentId:R="58be35b0-708f-49f6-84f0-6695d307d997"}){let[k,I]=(0,we.useState)(!1),f=d!=null&&d.id!==null&&d.id!==void 0;return(0,a.jsx)("header",{className:s("border-b bg-background",r),children:(0,a.jsxs)("div",{className:"container flex h-16 items-center justify-between px-4 md:px-6",children:[(0,a.jsxs)("div",{className:"flex items-center gap-4",children:[(0,a.jsx)("span",{className:"text-xl font-bold cursor-pointer",onClick:h,children:l}),(0,a.jsx)("nav",{className:"hidden md:flex gap-6",children:e?.map((i,p)=>(0,a.jsx)("span",{onClick:()=>{i.disabled||x(i.href)},className:s("text-sm font-medium transition-colors hover:text-primary cursor-pointer",i.disabled&&"cursor-not-allowed opacity-80"),children:i.title},p))})]}),(0,a.jsxs)("div",{className:"flex items-center gap-4",children:[t,f?(0,a.jsxs)(K,{children:[(0,a.jsx)(W,{asChild:!0,children:(0,a.jsx)(v,{variant:"ghost",className:"relative h-8 w-8 rounded-full",disabled:u,children:(0,a.jsx)(T,{className:"h-8 w-8",children:u?(0,a.jsx)("div",{className:"h-8 w-8 animate-pulse bg-muted rounded-full"}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(V,{src:d.photos?.[0]?.value||"/placeholder.svg",alt:d.displayName}),(0,a.jsx)(z,{children:d.displayName?.charAt(0)})]})})})}),(0,a.jsx)(q,{className:"w-56",align:"end",forceMount:!0,children:u?(0,a.jsxs)("div",{className:"p-4",children:[(0,a.jsx)("div",{className:"h-4 w-3/4 animate-pulse bg-muted rounded mb-2"}),(0,a.jsx)("div",{className:"h-3 w-1/2 animate-pulse bg-muted rounded"})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(ge,{className:"font-normal",children:(0,a.jsxs)("div",{className:"flex flex-col space-y-1",children:[(0,a.jsx)("p",{className:"text-sm font-medium leading-none",children:d.displayName}),(0,a.jsx)("p",{className:"text-xs leading-none text-muted-foreground",children:d.emails?.[0]?.value})]})}),(0,a.jsx)(E,{}),(0,a.jsx)(ve,{children:(0,a.jsxs)(D,{onClick:C,children:[(0,a.jsx)(L,{Icon:B.User}),(0,a.jsx)("span",{children:"Profile"})]})}),(0,a.jsx)(E,{}),(0,a.jsxs)(D,{onClick:P,children:[(0,a.jsx)(L,{Icon:B.LogOut}),(0,a.jsx)("span",{children:"Log out"})]})]})})]}):(0,a.jsx)(v,{variant:"default","aria-label":"Sign in",onClick:()=>{if(!R)throw new Error("Environment ID is required");if(!y)throw new Error("Identity Host is required");let i=`${y}/signin/${R}`;window.open(i,"_blank")},children:"Sign in"}),(0,a.jsxs)(xe,{open:k,onOpenChange:I,children:[(0,a.jsx)(be,{asChild:!0,children:(0,a.jsx)(v,{variant:"ghost",size:"icon",className:"md:hidden","aria-label":"Open Menu",children:(0,a.jsx)(L,{Icon:B.Menu})})}),(0,a.jsx)(ye,{side:"left",className:"pr-0",children:(0,a.jsx)("nav",{className:"grid gap-2 py-6",children:e?.map((i,p)=>(0,a.jsx)("a",{href:i.href,className:s("flex w-full items-center rounded-md px-3 py-2 text-sm font-medium hover:bg-accent",i.disabled&&"cursor-not-allowed opacity-80"),onClick:()=>I(!1),children:i.title},p))})})]})]})]})})}var G=require("react");var Pe=require("@radix-ui/react-slot"),Ce=require("class-variance-authority");var De=require("react/jsx-runtime"),Je=(0,Ce.cva)("inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"}},defaultVariants:{variant:"default"}});function ke({className:e,variant:t,asChild:r=!1,...l}){return(0,De.jsx)(r?Pe.Slot:"span",{"data-slot":"badge",className:s(Je({variant:t}),e),...l})}var Me=require("lucide-react"),o=require("react/jsx-runtime"),Se=({loading:e,user:t,handleAuthenticated:r})=>{let[l,d]=(0,G.useState)(!1),[h,x]=(0,G.useState)("profile");(0,G.useEffect)(()=>{d(!0)},[]),(0,G.useEffect)(()=>{!e&&r&&r()},[e,t,r]);let C={className:"mr-2 h-4 w-4","aria-hidden":"true"},P=u=>l?(0,o.jsx)(u,{...C}):null;return!l||e?(0,o.jsx)("div",{children:"Loading..."}):t?(0,o.jsxs)("div",{className:"grid grid-cols-[14rem,1fr] w-full bg-transparent",children:[(0,o.jsxs)("div",{className:"h-full border-r p-3 md:p-4 bg-transparent flex flex-col min-w-0",children:[(0,o.jsxs)("div",{className:"mb-3 md:mb-4",children:[(0,o.jsx)("h1",{className:"text-xl font-bold text-gray-900 dark:text-gray-100",children:"Account"}),(0,o.jsx)("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Manage your account info."})]}),(0,o.jsx)("nav",{className:"space-y-1 flex-1",children:(0,o.jsxs)("button",{onClick:()=>x("profile"),className:`flex items-center w-full px-3 py-2 text-sm rounded-md ${h==="profile"?"bg-gray-100 text-gray-900 dark:bg-gray-800 dark:text-gray-100":"text-gray-700 hover:bg-gray-50 dark:text-gray-300 dark:hover:bg-gray-800"}`,children:[P(Me.User),"Profile"]})})]}),(0,o.jsxs)("div",{className:"h-full p-3 md:p-5 min-w-0 bg-transparent",children:[(0,o.jsx)("div",{className:"flex justify-between items-center mb-3 md:mb-4",children:(0,o.jsx)("h2",{className:"text-xl font-semibold text-gray-900 dark:text-gray-100",children:h==="profile"?"Profile details":"Security settings"})}),h==="profile"?(0,o.jsxs)("div",{className:"space-y-5 md:space-y-6",children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("h3",{className:"text-sm font-medium mb-3 text-gray-900 dark:text-gray-100",children:"Profile"}),(0,o.jsx)("div",{className:"flex items-center justify-between",children:(0,o.jsxs)("div",{className:"flex items-center",children:[(0,o.jsxs)(T,{className:"h-12 w-12 mr-4 border",children:[(0,o.jsx)(V,{src:t.photos?.[0]?.value,alt:"Profile picture"}),(0,o.jsx)(z,{children:t.displayName?.split(" ").map(u=>u[0]).join("")})]}),(0,o.jsx)("span",{className:"font-medium text-gray-900 dark:text-gray-100",children:t.displayName})]})})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)("h3",{className:"text-sm font-medium mb-3 text-gray-900 dark:text-gray-100",children:"Email addresses"}),(0,o.jsx)("div",{className:"space-y-2.5",children:t.emails.map((u,y)=>(0,o.jsxs)("div",{className:"flex items-center justify-between",children:[(0,o.jsx)("span",{className:"text-gray-900 dark:text-gray-100",children:u.value}),y===0&&(0,o.jsx)(ke,{variant:"outline",className:"text-xs bg-gray-100 text-gray-700 hover:bg-gray-100 dark:bg-gray-800 dark:text-gray-300 dark:hover:bg-gray-800",children:"Primary"})]},u.value))})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)("h3",{className:"text-sm font-medium mb-3 text-gray-900 dark:text-gray-100",children:"Connected accounts"}),(0,o.jsx)("div",{className:"space-y-2.5",children:(0,o.jsxs)("div",{className:"flex items-center justify-between",children:[(0,o.jsx)("div",{className:"flex items-center",children:(0,o.jsx)("div",{className:"mr-2",children:(0,o.jsx)("span",{className:"text-gray-900 dark:text-gray-100",children:t.provider})})}),(0,o.jsx)("span",{className:"text-sm text-gray-500 dark:text-gray-400",children:t?.emails?.[0]?.value})]},t.provider)})]})]}):(0,o.jsxs)("div",{className:"space-y-5 md:space-y-6",children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("h3",{className:"text-sm font-medium mb-3 text-gray-900 dark:text-gray-100",children:"Two-factor authentication"}),(0,o.jsx)("div",{className:"space-y-2.5",children:(0,o.jsxs)("div",{className:"flex items-center justify-between",children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("p",{className:"font-medium text-gray-900 dark:text-gray-100",children:"Two-factor authentication"}),(0,o.jsx)("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Add an extra layer of security to your account"})]}),(0,o.jsx)(v,{variant:"outline",size:"sm",children:"Enable"})]})})]},"two-factor"),(0,o.jsxs)("div",{children:[(0,o.jsx)("h3",{className:"text-sm font-medium mb-3 text-gray-900 dark:text-gray-100",children:"Password"}),(0,o.jsx)("div",{className:"space-y-2.5",children:(0,o.jsxs)("div",{className:"flex items-center justify-between",children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("p",{className:"font-medium text-gray-900 dark:text-gray-100",children:"Change password"}),(0,o.jsx)("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Last changed 3 months ago"})]}),(0,o.jsx)(v,{variant:"outline",size:"sm",children:"Change"})]})})]},"password"),(0,o.jsxs)("div",{children:[(0,o.jsx)("h3",{className:"text-sm font-medium mb-3 text-gray-900 dark:text-gray-100",children:"Active sessions"}),(0,o.jsx)("div",{className:"space-y-2.5",children:(0,o.jsxs)("div",{className:"flex items-center justify-between",children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("p",{className:"font-medium text-gray-900 dark:text-gray-100",children:"Current session"}),(0,o.jsx)("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Chrome on Windows \u2022 Active now"})]}),(0,o.jsx)(v,{variant:"outline",size:"sm",children:"Sign out"})]})})]},"sessions")]})]})]}):(0,o.jsx)("div",{children:"No user"})};var O=require("lucide-react"),m=require("react/jsx-runtime"),Ye=e=>e&&String(e).trim().split(/\s+/).slice(0,2).map(l=>l[0]?.toUpperCase()).join("")||"?",Re=({trigger:e,user:t,className:r,onManageAccount:l,onSignout:d,links:h=[],side:x="bottom",align:C="end",sideOffset:P=8})=>{let u=t?.emails?.[0]?.value||t?.email||"",y=t?.displayName||t?.name||"",R=t?.photos?.[0]?.value||t?.avatar||"",k=f=>{if(f.onClick)return f.onClick();f.href&&(f.href.startsWith("http")?window.open(f.href,"_blank"):window.location.assign(f.href))},I=O.ExternalLink;return(0,m.jsxs)(K,{children:[(0,m.jsx)(W,{className:"inline-flex items-center justify-center h-10 w-10 rounded-full focus:outline-none",children:e}),(0,m.jsxs)(q,{align:C,side:x,sideOffset:P,className:s("w-72 p-2 overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md",r),children:[(0,m.jsxs)("div",{className:"flex items-center gap-3 px-4 pt-4 pb-3",children:[(0,m.jsxs)(T,{className:"h-9 w-9 rounded-full",children:[(0,m.jsx)(V,{src:R,alt:y}),(0,m.jsx)(z,{className:"rounded-full",children:Ye(y)})]}),(0,m.jsxs)("div",{className:"min-w-0",children:[(0,m.jsx)("div",{className:"text-sm font-semibold truncate",children:y}),(0,m.jsx)("div",{className:"text-xs text-muted-foreground truncate",children:u})]})]}),(0,m.jsx)(E,{}),(0,m.jsxs)(D,{className:"cursor-pointer py-2",onClick:()=>l?.(),children:[(0,m.jsx)(O.Settings,{className:"mr-2 h-4 w-4"}),(0,m.jsx)("span",{children:"Manage account"})]}),h.map((f,i)=>{let p=f.icon??I;return(0,m.jsxs)(D,{className:"cursor-pointer py-2",onClick:()=>k(f),children:[(0,m.jsx)(p,{className:"mr-2 h-4 w-4"}),(0,m.jsx)("span",{children:f.label})]},`${f.label}-${i}`)}),(0,m.jsx)(E,{}),(0,m.jsxs)(D,{className:"cursor-pointer text-red-600 focus:text-red-700 py-2",onClick:()=>d?.(),children:[(0,m.jsx)(O.LogOut,{className:"mr-2 h-4 w-4"}),(0,m.jsx)("span",{children:"Sign out"})]})]})]})};var Te=require("lucide-react");var Ie=require("class-variance-authority");var Z=require("react/jsx-runtime"),Qe=(0,Ie.cva)("relative w-full rounded-lg border px-4 py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"text-destructive bg-card [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90"}},defaultVariants:{variant:"default"}});function Y({className:e,variant:t,...r}){return(0,Z.jsx)("div",{"data-slot":"alert",role:"alert",className:s(Qe({variant:t}),e),...r})}function Ae({className:e,...t}){return(0,Z.jsx)("div",{"data-slot":"alert-title",className:s("col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight",e),...t})}function Q({className:e,...t}){return(0,Z.jsx)("div",{"data-slot":"alert-description",className:s("text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",e),...t})}var M=require("react/jsx-runtime"),Ve=e=>{let t=e.title??"Placeholder Alert",r=e.description??"This is a placeholder alert.";return(0,M.jsx)("div",{className:"grid w-full max-w-xl items-start gap-4",children:(0,M.jsxs)(Y,{children:[(0,M.jsx)(L,{Icon:Te.CheckCircle2Icon}),(0,M.jsx)(Ae,{children:t}),(0,M.jsx)(Q,{children:r})]})})};var S=require("react");var ae=require("react/jsx-runtime");function ee({className:e,...t}){return(0,ae.jsx)("div",{"data-slot":"card",className:s("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",e),...t})}function te({className:e,...t}){return(0,ae.jsx)("div",{"data-slot":"card-content",className:s("px-6",e),...t})}var _=require("lucide-react"),n=require("react/jsx-runtime"),ze=({onValidate:e})=>{let[t,r]=(0,S.useState)(["","","","","",""]),[l,d]=(0,S.useState)(!1),[h,x]=(0,S.useState)(""),[C,P]=(0,S.useState)(!1),u=(0,S.useRef)([]),y=(i,p)=>{if(!/^\d*$/.test(p))return;let w=[...t];w[i]=p.slice(-1),r(w),x(""),P(!1),p&&i<5&&u.current[i+1]?.focus()},R=(i,p)=>{p.key==="Backspace"&&!t[i]&&i>0&&u.current[i-1]?.focus(),p.key==="v"&&(p.ctrlKey||p.metaKey)&&(p.preventDefault(),navigator.clipboard.readText().then(w=>{let re=w.replace(/\D/g,"").slice(0,6).split(""),ne=[...t];re.forEach((Le,ie)=>{ie<6&&(ne[ie]=Le)}),r(ne);let Ee=Math.min(re.length,5);u.current[Ee]?.focus()}))},k=async()=>{let i=t.join("");if(i.length!==6){x("Please enter all 6 digits");return}d(!0),x("");try{await e(i),P(!0)}catch{x("Invalid TOTP code. Please try again.")}finally{d(!1)}},I=i=>{i.preventDefault(),k()},f=()=>{r(["","","","","",""]),x(""),P(!1),d(!1),u.current[0]?.focus()};return C?(0,n.jsx)("div",{className:"max-w-md mx-auto",children:(0,n.jsx)(ee,{className:"border-green-200 bg-green-50",children:(0,n.jsx)(te,{className:"pt-6",children:(0,n.jsxs)("div",{className:"text-center space-y-4",children:[(0,n.jsx)("div",{className:"mx-auto w-16 h-16 bg-green-100 rounded-full flex items-center justify-center",children:(0,n.jsx)(_.CheckCircle,{className:"w-8 h-8 text-green-600"})}),(0,n.jsxs)("div",{children:[(0,n.jsx)("h3",{className:"text-lg font-semibold text-green-900",children:"Verification Successful!"}),(0,n.jsx)("p",{className:"text-sm text-green-700 mt-1",children:"Your TOTP code has been validated."})]}),(0,n.jsx)(v,{onClick:f,variant:"outline",className:"bg-white",children:"Verify Another Code"})]})})})}):(0,n.jsx)("div",{className:"max-w-md mx-auto",children:(0,n.jsx)(ee,{children:(0,n.jsx)(te,{className:"pt-6",children:(0,n.jsxs)("div",{className:"text-center space-y-6",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"mx-auto w-12 h-12 bg-blue-100 rounded-full flex items-center justify-center mb-4",children:(0,n.jsx)(_.Shield,{className:"w-6 h-6 text-blue-600"})}),(0,n.jsx)("h3",{className:"text-lg font-semibold",children:"Enter Verification Code"}),(0,n.jsx)("p",{className:"text-sm text-muted-foreground mt-1",children:"Enter the 6-digit code from your authenticator app"})]}),(0,n.jsxs)("form",{onSubmit:I,className:"space-y-6",children:[(0,n.jsx)("div",{className:"flex justify-center gap-2",children:t.map((i,p)=>(0,n.jsx)(ee,{className:"w-12 h-14 border-2 focus-within:border-blue-500 transition-colors",children:(0,n.jsx)(te,{className:"p-0 h-full flex items-center justify-center",children:(0,n.jsx)("input",{ref:w=>{u.current[p]=w},type:"tel",inputMode:"numeric",maxLength:1,value:i,onChange:w=>y(p,w.target.value),onKeyDown:w=>R(p,w),className:"w-full h-full text-center text-2xl font-bold border-none outline-none bg-transparent",autoComplete:"one-time-code",disabled:l,style:{height:"auto"}})})},p))}),h&&(0,n.jsxs)(Y,{variant:"destructive",children:[(0,n.jsx)(_.AlertCircle,{className:"h-4 w-4"}),(0,n.jsx)(Q,{children:h})]}),(0,n.jsxs)("div",{className:"space-y-3",children:[(0,n.jsx)(v,{type:"submit",className:"w-full",disabled:l||t.some(i=>i===""),children:l?"Verifying...":"Verify Code"}),(0,n.jsx)(v,{type:"button",variant:"ghost",size:"sm",onClick:f,className:"w-full text-xs",children:"Clear Code"})]})]}),(0,n.jsx)("p",{className:"text-xs text-muted-foreground",children:"Codes refresh every 30 seconds"})]})})})})};
|
|
2
|
+
"use strict";var Be=Object.create;var $=Object.defineProperty;var Ge=Object.getOwnPropertyDescriptor;var Oe=Object.getOwnPropertyNames;var _e=Object.getPrototypeOf,Ue=Object.prototype.hasOwnProperty;var je=(t,o)=>{for(var a in o)$(t,a,{get:o[a],enumerable:!0})},ce=(t,o,a,l)=>{if(o&&typeof o=="object"||typeof o=="function")for(let d of Oe(o))!Ue.call(t,d)&&d!==a&&$(t,d,{get:()=>o[d],enumerable:!(l=Ge(o,d))||l.enumerable});return t};var K=(t,o,a)=>(a=t!=null?Be(_e(t)):{},ce(o||!t||!t.__esModule?$(a,"default",{value:t,enumerable:!0}):a,t)),Fe=t=>ce($({},"__esModule",{value:!0}),t);var Ze={};je(Ze,{Button:()=>P,ClientOnly:()=>xe,Navbar:()=>De,PlaceholderAlert:()=>Ee,TOTPValidator:()=>Le,UserDropdown:()=>Te,UserProfile:()=>Ie});module.exports=Fe(Ze);var ue=K(require("react")),fe=require("@radix-ui/react-slot"),ve=require("class-variance-authority");var me=require("clsx"),pe=require("tailwind-merge");function s(...t){return(0,pe.twMerge)((0,me.clsx)(t))}var ge=require("react/jsx-runtime"),He=(0,ve.cva)("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),P=ue.forwardRef(({className:t,variant:o,size:a,asChild:l=!1,...d},h)=>(0,ge.jsx)(l?fe.Slot:"button",{className:s(He({variant:o,size:a,className:t})),ref:h,...d}));P.displayName="Button";var W=require("react"),q=require("react/jsx-runtime"),xe=({children:t})=>{let[o,a]=(0,W.useState)(!1);return(0,W.useEffect)(()=>{a(!0)},[]),o?(0,q.jsx)(q.Fragment,{children:t}):null};var Ce=require("react"),G=require("lucide-react");var A=K(require("@radix-ui/react-avatar"));var X=require("react/jsx-runtime");function V({className:t,...o}){return(0,X.jsx)(A.Root,{"data-slot":"avatar",className:s("relative flex size-8 shrink-0 overflow-hidden rounded-full",t),...o})}function z({className:t,...o}){return(0,X.jsx)(A.Image,{"data-slot":"avatar-image",className:s("aspect-square size-full",t),...o})}function E({className:t,...o}){return(0,X.jsx)(A.Fallback,{"data-slot":"avatar-fallback",className:s("bg-muted flex size-full items-center justify-center rounded-full",t),...o})}var m=K(require("@radix-ui/react-dropdown-menu")),se=require("lucide-react");var C=require("react/jsx-runtime");function Y({...t}){return(0,C.jsx)(m.Root,{"data-slot":"dropdown-menu",...t})}function J({...t}){return(0,C.jsx)(m.Trigger,{"data-slot":"dropdown-menu-trigger",...t})}function Q({className:t,sideOffset:o=4,...a}){return(0,C.jsx)(m.Portal,{children:(0,C.jsx)(m.Content,{"data-slot":"dropdown-menu-content",sideOffset:o,className:s("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",t),...a})})}function be({...t}){return(0,C.jsx)(m.Group,{"data-slot":"dropdown-menu-group",...t})}function R({className:t,inset:o,variant:a="default",...l}){return(0,C.jsx)(m.Item,{"data-slot":"dropdown-menu-item","data-inset":o,"data-variant":a,className:s("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),...l})}function he({className:t,inset:o,...a}){return(0,C.jsx)(m.Label,{"data-slot":"dropdown-menu-label","data-inset":o,className:s("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",t),...a})}function L({className:t,...o}){return(0,C.jsx)(m.Separator,{"data-slot":"dropdown-menu-separator",className:s("bg-border -mx-1 my-1 h-px",t),...o})}var f=K(require("@radix-ui/react-dialog")),ye=require("lucide-react");var b=require("react/jsx-runtime"),$e=ye.X;function we({...t}){return(0,b.jsx)(f.Root,{"data-slot":"sheet",...t})}function Ne({...t}){return(0,b.jsx)(f.Trigger,{"data-slot":"sheet-trigger",...t})}function Ke({...t}){return(0,b.jsx)(f.Portal,{"data-slot":"sheet-portal",...t})}function We({className:t,...o}){return(0,b.jsx)(f.Overlay,{"data-slot":"sheet-overlay",className:s("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",t),...o})}function Pe({className:t,children:o,side:a="right",...l}){return(0,b.jsxs)(Ke,{children:[(0,b.jsx)(We,{}),(0,b.jsxs)(f.Content,{"data-slot":"sheet-content",className:s("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500",a==="right"&&"data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm",a==="left"&&"data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm",a==="top"&&"data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b",a==="bottom"&&"data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t",t),...l,children:[o,(0,b.jsxs)(f.Close,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none",children:[(0,b.jsx)($e,{className:"size-4"}),(0,b.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})}var ee=require("react"),Z=require("react/jsx-runtime"),qe={className:"mr-2 h-4 w-4","aria-hidden":"true"},Xe=t=>{let[o,a]=(0,ee.useState)(!1);return(0,ee.useEffect)(()=>{a(!0)},[]),o?(0,Z.jsx)(t,{...qe}):(0,Z.jsx)("span",{className:"mr-2 h-4 w-4","aria-hidden":"true"})},B=({Icon:t})=>(0,Z.jsx)("span",{className:"inline-flex items-center justify-center",children:Xe(t)});var r=require("react/jsx-runtime");function De({items:t=[],children:o,className:a,logoText:l="ACME Corp",user:d={name:"John Doe",email:"john@example.com",image:"https://i.pravatar.cc/150?u=a042581f4e29026704d"},onNavigateHome:h=()=>console.log("Navigating to home"),onNavItemClick:x=D=>console.log(`Navigating to ${D}`),onProfileSelected:v,onLogout:y=()=>console.log("Logout clicked"),isLoading:g=!1,identityHost:w="https://stg-id.authdog.xyz",environmentId:k="58be35b0-708f-49f6-84f0-6695d307d997"}){let[D,M]=(0,Ce.useState)(!1),u=d!=null&&d.id!==null&&d.id!==void 0;return(0,r.jsx)("header",{className:s("border-b bg-background",a),children:(0,r.jsxs)("div",{className:"container flex h-16 items-center justify-between px-4 md:px-6",children:[(0,r.jsxs)("div",{className:"flex items-center gap-4",children:[(0,r.jsx)("span",{className:"text-xl font-bold cursor-pointer",onClick:h,children:l}),(0,r.jsx)("nav",{className:"hidden md:flex gap-6",children:t?.map((n,c)=>(0,r.jsx)("span",{onClick:()=>{n.disabled||x(n.href)},className:s("text-sm font-medium transition-colors hover:text-primary cursor-pointer",n.disabled&&"cursor-not-allowed opacity-80"),children:n.title},c))})]}),(0,r.jsxs)("div",{className:"flex items-center gap-4",children:[o,u?(0,r.jsxs)(Y,{children:[(0,r.jsx)(J,{asChild:!0,children:(0,r.jsx)(P,{variant:"ghost",className:"relative h-8 w-8 rounded-full",disabled:g,children:(0,r.jsx)(V,{className:"h-8 w-8",children:g?(0,r.jsx)("div",{className:"h-8 w-8 animate-pulse bg-muted rounded-full"}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(z,{src:d.photos?.[0]?.value||"/placeholder.svg",alt:d.displayName}),(0,r.jsx)(E,{children:d.displayName?.charAt(0)})]})})})}),(0,r.jsx)(Q,{className:"w-56",align:"end",forceMount:!0,children:g?(0,r.jsxs)("div",{className:"p-4",children:[(0,r.jsx)("div",{className:"h-4 w-3/4 animate-pulse bg-muted rounded mb-2"}),(0,r.jsx)("div",{className:"h-3 w-1/2 animate-pulse bg-muted rounded"})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(he,{className:"font-normal",children:(0,r.jsxs)("div",{className:"flex flex-col space-y-1",children:[(0,r.jsx)("p",{className:"text-sm font-medium leading-none",children:d.displayName}),(0,r.jsx)("p",{className:"text-xs leading-none text-muted-foreground",children:d.emails?.[0]?.value})]})}),(0,r.jsx)(L,{}),(0,r.jsx)(be,{children:(0,r.jsxs)(R,{onClick:v,children:[(0,r.jsx)(B,{Icon:G.User}),(0,r.jsx)("span",{children:"Profile"})]})}),(0,r.jsx)(L,{}),(0,r.jsxs)(R,{onClick:y,children:[(0,r.jsx)(B,{Icon:G.LogOut}),(0,r.jsx)("span",{children:"Log out"})]})]})})]}):(0,r.jsx)(P,{variant:"default","aria-label":"Sign in",onClick:()=>{if(!k)throw new Error("Environment ID is required");if(!w)throw new Error("Identity Host is required");let n=`${w}/signin/${k}`;window.open(n,"_blank")},children:"Sign in"}),(0,r.jsxs)(we,{open:D,onOpenChange:M,children:[(0,r.jsx)(Ne,{asChild:!0,children:(0,r.jsx)(P,{variant:"ghost",size:"icon",className:"md:hidden","aria-label":"Open Menu",children:(0,r.jsx)(B,{Icon:G.Menu})})}),(0,r.jsx)(Pe,{side:"left",className:"pr-0",children:(0,r.jsx)("nav",{className:"grid gap-2 py-6",children:t?.map((n,c)=>(0,r.jsx)("a",{href:n.href,className:s("flex w-full items-center rounded-md px-3 py-2 text-sm font-medium hover:bg-accent",n.disabled&&"cursor-not-allowed opacity-80"),onClick:()=>M(!1),children:n.title},c))})})]})]})]})})}var S=require("react");var ke=require("@radix-ui/react-slot"),Me=require("class-variance-authority");var Re=require("react/jsx-runtime"),Ye=(0,Me.cva)("inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"}},defaultVariants:{variant:"default"}});function Se({className:t,variant:o,asChild:a=!1,...l}){return(0,Re.jsx)(a?ke.Slot:"span",{"data-slot":"badge",className:s(Ye({variant:o}),t),...l})}var O=require("lucide-react"),e=require("react/jsx-runtime"),Ie=({loading:t,user:o,handleAuthenticated:a,onRequestEmailVerification:l,onVerifyEmail:d})=>{let[h,x]=(0,S.useState)(!1),[v,y]=(0,S.useState)("profile"),[g,w]=(0,S.useState)(null),[k,D]=(0,S.useState)({});(0,S.useEffect)(()=>{x(!0)},[]),(0,S.useEffect)(()=>{!t&&a&&a()},[t,o,a]);let M={className:"mr-2 h-4 w-4","aria-hidden":"true"},u=n=>h?(0,e.jsx)(n,{...M}):null;return!h||t?(0,e.jsx)("div",{children:"Loading..."}):o?(0,e.jsxs)("div",{className:"grid grid-cols-[14rem,1fr] w-full bg-transparent",children:[(0,e.jsxs)("div",{className:"h-full border-r border-border p-3 md:p-4 bg-transparent flex flex-col min-w-0",children:[(0,e.jsxs)("div",{className:"mb-3 md:mb-4",children:[(0,e.jsx)("h1",{className:"text-xl font-bold text-foreground",children:"Account"}),(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"Manage your account info."})]}),(0,e.jsxs)("nav",{className:"space-y-1 flex-1",children:[(0,e.jsxs)("button",{onClick:()=>y("profile"),className:`flex items-center w-full px-3 py-2 text-sm rounded-md ${v==="profile"?"bg-muted text-foreground":"text-muted-foreground hover:bg-muted/50"}`,children:[u(O.User),"Profile"]}),(0,e.jsxs)("button",{onClick:()=>y("security"),className:`flex items-center w-full px-3 py-2 text-sm rounded-md ${v==="security"?"bg-muted text-foreground":"text-muted-foreground hover:bg-muted/50"}`,children:[u(O.Shield),"Security"]}),(0,e.jsxs)("button",{onClick:()=>y("preferences"),className:`flex items-center w-full px-3 py-2 text-sm rounded-md ${v==="preferences"?"bg-muted text-foreground":"text-muted-foreground hover:bg-muted/50"}`,children:[u(O.SlidersHorizontal),"Preferences"]})]})]}),(0,e.jsxs)("div",{className:"h-full p-3 md:p-5 min-w-0 bg-transparent",children:[(0,e.jsx)("div",{className:"flex justify-between items-center mb-3 md:mb-4",children:(0,e.jsx)("h2",{className:"text-xl font-semibold text-foreground",children:v==="profile"?"Profile details":v==="security"?"Security settings":"Preferences"})}),v==="profile"?(0,e.jsxs)("div",{className:"space-y-5 md:space-y-6",children:[(0,e.jsxs)("div",{children:[(0,e.jsx)("h3",{className:"text-sm font-medium mb-3 text-foreground",children:"Profile"}),(0,e.jsx)("div",{className:"flex items-center justify-between",children:(0,e.jsxs)("div",{className:"flex items-center",children:[(0,e.jsxs)(V,{className:"h-12 w-12 mr-4 border",children:[(0,e.jsx)(z,{src:o.photos?.[0]?.value,alt:"Profile picture"}),(0,e.jsx)(E,{children:o.displayName?.split(" ").map(n=>n[0]).join("")})]}),(0,e.jsx)("span",{className:"font-medium text-foreground",children:o.displayName})]})})]}),(0,e.jsxs)("div",{children:[(0,e.jsx)("h3",{className:"text-sm font-medium mb-3 text-foreground",children:"Email addresses"}),(0,e.jsx)("div",{className:"space-y-2.5",children:o.emails.map((n,c)=>{let j=(o?.verifications||[]).find(H=>H.email===n.value)?.verified===!0,F=k[n.value]||"";return(0,e.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,e.jsxs)("div",{className:"flex flex-col",children:[(0,e.jsx)("span",{className:"text-foreground",children:n.value}),(0,e.jsx)("div",{className:"mt-1 text-xs text-muted-foreground",children:j?"Verified":"Not verified"})]}),(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[c===0&&(0,e.jsx)(Se,{variant:"outline",className:"text-xs bg-muted text-foreground hover:bg-muted",children:"Primary"}),!j&&(0,e.jsx)(e.Fragment,{children:g===n.value?(0,e.jsxs)("div",{className:"flex items-center gap-1",children:[(0,e.jsx)("input",{className:"h-7 w-24 text-sm rounded-md border border-border bg-background px-2 text-foreground",placeholder:"Code",value:F,onChange:H=>D(ie=>({...ie,[n.value]:H.target.value}))}),(0,e.jsx)("button",{className:"h-7 rounded-md border border-border px-2 text-xs",onClick:async()=>{d&&await d(n.value,F)},children:"Verify"}),(0,e.jsx)("button",{className:"h-7 rounded-md border border-border px-2 text-xs",onClick:()=>w(null),children:"Cancel"})]}):(0,e.jsx)(e.Fragment,{children:(0,e.jsx)("button",{className:"h-7 rounded-md border border-border px-2 text-xs",onClick:async()=>{l&&await l(n.value),w(n.value)},children:"Send code"})})})]})]},n.value)})})]}),(0,e.jsxs)("div",{children:[(0,e.jsx)("h3",{className:"text-sm font-medium mb-3 text-gray-900 dark:text-gray-100",children:"Connected accounts"}),(0,e.jsx)("div",{className:"space-y-2.5",children:(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsx)("div",{className:"flex items-center",children:(0,e.jsx)("div",{className:"mr-2",children:(0,e.jsx)("span",{className:"text-gray-900 dark:text-gray-100",children:o.provider})})}),(0,e.jsx)("span",{className:"text-sm text-gray-500 dark:text-gray-400",children:o?.emails?.[0]?.value})]},o.provider)})]})]}):v==="security"?(0,e.jsxs)("div",{className:"space-y-5 md:space-y-6",children:[(0,e.jsx)("div",{className:"border rounded-md overflow-hidden",children:(0,e.jsxs)("div",{className:"flex items-center justify-between px-4 py-3",children:[(0,e.jsx)("div",{className:"text-sm text-gray-700 dark:text-gray-300",children:"Password"}),(0,e.jsx)("button",{className:"text-sm text-indigo-600 hover:underline",children:"Set password"})]})}),(0,e.jsx)("div",{className:"border rounded-md overflow-hidden",children:(0,e.jsxs)("div",{className:"flex items-center justify-between px-4 py-3",children:[(0,e.jsx)("div",{className:"text-sm text-gray-700 dark:text-gray-300",children:"Passkeys"}),(0,e.jsx)("button",{className:"text-sm text-indigo-600 hover:underline",children:"+\xA0Add a passkey"})]})}),(0,e.jsx)("div",{className:"border rounded-md overflow-hidden",children:(0,e.jsxs)("div",{className:"flex items-center justify-between px-4 py-3",children:[(0,e.jsx)("div",{className:"text-sm text-gray-700 dark:text-gray-300",children:"Two-step verification"}),(0,e.jsx)("button",{className:"text-sm text-indigo-600 hover:underline",children:"+\xA0Add two-step verification"})]})}),(0,e.jsxs)("div",{className:"border rounded-md overflow-hidden",children:[(0,e.jsx)("div",{className:"px-4 py-3 border-b text-sm font-medium text-gray-900 dark:text-gray-100",children:"Active devices"}),(0,e.jsx)("div",{className:"p-4 space-y-3",children:(0,e.jsxs)("div",{className:"text-sm",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("span",{className:"inline-block h-5 w-5 rounded-sm bg-gray-900 dark:bg-white"}),(0,e.jsx)("span",{className:"font-medium",children:"X11"}),(0,e.jsx)("span",{className:"text-xs rounded-md border px-2 py-0.5 text-gray-600 dark:text-gray-300",children:"This device"})]}),(0,e.jsx)("div",{className:"text-gray-600 dark:text-gray-400 mt-1",children:"Firefox 142.0"}),(0,e.jsx)("div",{className:"text-gray-600 dark:text-gray-400",children:"127.0.0.1 (Local), (Your City)"}),(0,e.jsx)("div",{className:"text-gray-600 dark:text-gray-400",children:"Today at 7:08 PM"})]})})]}),(0,e.jsx)("div",{className:"border rounded-md overflow-hidden",children:(0,e.jsxs)("div",{className:"flex items-center justify-between px-4 py-3",children:[(0,e.jsx)("div",{className:"text-sm text-gray-700 dark:text-gray-300",children:"Delete account"}),(0,e.jsx)("button",{className:"text-sm text-red-600 hover:underline",children:"Delete account"})]})})]}):(0,e.jsx)("div",{className:"space-y-5 md:space-y-6",children:(0,e.jsxs)("div",{children:[(0,e.jsx)("h3",{className:"text-sm font-medium mb-3 text-gray-900 dark:text-gray-100",children:"Preferences"}),(0,e.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsx)("span",{className:"text-gray-700 dark:text-gray-300",children:"Locale"}),(0,e.jsx)("span",{className:"text-gray-500 dark:text-gray-400",children:"Auto"})]}),(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsx)("span",{className:"text-gray-700 dark:text-gray-300",children:"Theme"}),(0,e.jsx)("span",{className:"text-gray-500 dark:text-gray-400",children:"System"})]})]})]})})]})]}):(0,e.jsx)("div",{children:"No user"})};var _=require("lucide-react"),p=require("react/jsx-runtime"),Je=t=>t&&String(t).trim().split(/\s+/).slice(0,2).map(l=>l[0]?.toUpperCase()).join("")||"?",Te=({trigger:t,user:o,className:a,onManageAccount:l,onSignout:d,links:h=[],side:x="bottom",align:v="end",sideOffset:y=8})=>{let g=o?.emails?.[0]?.value||o?.email||"",w=o?.displayName||o?.name||"",k=o?.photos?.[0]?.value||o?.avatar||"",D=u=>{if(u.onClick)return u.onClick();u.href&&(u.href.startsWith("http")?window.open(u.href,"_blank"):window.location.assign(u.href))},M=_.ExternalLink;return(0,p.jsxs)(Y,{children:[(0,p.jsx)(J,{className:"inline-flex items-center justify-center h-10 w-10 rounded-full focus:outline-none",children:t}),(0,p.jsxs)(Q,{align:v,side:x,sideOffset:y,className:s("w-72 p-2 overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md",a),children:[(0,p.jsxs)("div",{className:"flex items-center gap-3 px-4 pt-4 pb-3",children:[(0,p.jsxs)(V,{className:"h-9 w-9 rounded-full",children:[(0,p.jsx)(z,{src:k,alt:w}),(0,p.jsx)(E,{className:"rounded-full",children:Je(w)})]}),(0,p.jsxs)("div",{className:"min-w-0",children:[(0,p.jsx)("div",{className:"text-sm font-semibold truncate",children:w}),(0,p.jsx)("div",{className:"text-xs text-muted-foreground truncate",children:g})]})]}),(0,p.jsx)(L,{}),(0,p.jsxs)(R,{className:"cursor-pointer py-2",onClick:()=>l?.(),children:[(0,p.jsx)(_.Settings,{className:"mr-2 h-4 w-4"}),(0,p.jsx)("span",{children:"Manage account"})]}),h.map((u,n)=>{let c=u.icon??M;return(0,p.jsxs)(R,{className:"cursor-pointer py-2",onClick:()=>D(u),children:[(0,p.jsx)(c,{className:"mr-2 h-4 w-4"}),(0,p.jsx)("span",{children:u.label})]},`${u.label}-${n}`)}),(0,p.jsx)(L,{}),(0,p.jsxs)(R,{className:"cursor-pointer text-red-600 focus:text-red-700 py-2",onClick:()=>d?.(),children:[(0,p.jsx)(_.LogOut,{className:"mr-2 h-4 w-4"}),(0,p.jsx)("span",{children:"Sign out"})]})]})]})};var ze=require("lucide-react");var Ae=require("class-variance-authority");var re=require("react/jsx-runtime"),Qe=(0,Ae.cva)("relative w-full rounded-lg border px-4 py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"text-destructive bg-card [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90"}},defaultVariants:{variant:"default"}});function te({className:t,variant:o,...a}){return(0,re.jsx)("div",{"data-slot":"alert",role:"alert",className:s(Qe({variant:o}),t),...a})}function Ve({className:t,...o}){return(0,re.jsx)("div",{"data-slot":"alert-title",className:s("col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight",t),...o})}function oe({className:t,...o}){return(0,re.jsx)("div",{"data-slot":"alert-description",className:s("text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",t),...o})}var I=require("react/jsx-runtime"),Ee=t=>{let o=t.title??"Placeholder Alert",a=t.description??"This is a placeholder alert.";return(0,I.jsx)("div",{className:"grid w-full max-w-xl items-start gap-4",children:(0,I.jsxs)(te,{children:[(0,I.jsx)(B,{Icon:ze.CheckCircle2Icon}),(0,I.jsx)(Ve,{children:o}),(0,I.jsx)(oe,{children:a})]})})};var T=require("react");var de=require("react/jsx-runtime");function ae({className:t,...o}){return(0,de.jsx)("div",{"data-slot":"card",className:s("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",t),...o})}function ne({className:t,...o}){return(0,de.jsx)("div",{"data-slot":"card-content",className:s("px-6",t),...o})}var U=require("lucide-react"),i=require("react/jsx-runtime"),Le=({onValidate:t})=>{let[o,a]=(0,T.useState)(["","","","","",""]),[l,d]=(0,T.useState)(!1),[h,x]=(0,T.useState)(""),[v,y]=(0,T.useState)(!1),g=(0,T.useRef)([]),w=(n,c)=>{if(!/^\d*$/.test(c))return;let N=[...o];N[n]=c.slice(-1),a(N),x(""),y(!1),c&&n<5&&g.current[n+1]?.focus()},k=(n,c)=>{c.key==="Backspace"&&!o[n]&&n>0&&g.current[n-1]?.focus(),c.key==="v"&&(c.ctrlKey||c.metaKey)&&(c.preventDefault(),navigator.clipboard.readText().then(N=>{let j=N.replace(/\D/g,"").slice(0,6).split(""),F=[...o];j.forEach((ie,le)=>{le<6&&(F[le]=ie)}),a(F);let H=Math.min(j.length,5);g.current[H]?.focus()}))},D=async()=>{let n=o.join("");if(n.length!==6){x("Please enter all 6 digits");return}d(!0),x("");try{await t(n),y(!0)}catch{x("Invalid TOTP code. Please try again.")}finally{d(!1)}},M=n=>{n.preventDefault(),D()},u=()=>{a(["","","","","",""]),x(""),y(!1),d(!1),g.current[0]?.focus()};return v?(0,i.jsx)("div",{className:"max-w-md mx-auto",children:(0,i.jsx)(ae,{className:"border-green-200 bg-green-50",children:(0,i.jsx)(ne,{className:"pt-6",children:(0,i.jsxs)("div",{className:"text-center space-y-4",children:[(0,i.jsx)("div",{className:"mx-auto w-16 h-16 bg-green-100 rounded-full flex items-center justify-center",children:(0,i.jsx)(U.CheckCircle,{className:"w-8 h-8 text-green-600"})}),(0,i.jsxs)("div",{children:[(0,i.jsx)("h3",{className:"text-lg font-semibold text-green-900",children:"Verification Successful!"}),(0,i.jsx)("p",{className:"text-sm text-green-700 mt-1",children:"Your TOTP code has been validated."})]}),(0,i.jsx)(P,{onClick:u,variant:"outline",className:"bg-white",children:"Verify Another Code"})]})})})}):(0,i.jsx)("div",{className:"max-w-md mx-auto",children:(0,i.jsx)(ae,{children:(0,i.jsx)(ne,{className:"pt-6",children:(0,i.jsxs)("div",{className:"text-center space-y-6",children:[(0,i.jsxs)("div",{children:[(0,i.jsx)("div",{className:"mx-auto w-12 h-12 bg-blue-100 rounded-full flex items-center justify-center mb-4",children:(0,i.jsx)(U.Shield,{className:"w-6 h-6 text-blue-600"})}),(0,i.jsx)("h3",{className:"text-lg font-semibold",children:"Enter Verification Code"}),(0,i.jsx)("p",{className:"text-sm text-muted-foreground mt-1",children:"Enter the 6-digit code from your authenticator app"})]}),(0,i.jsxs)("form",{onSubmit:M,className:"space-y-6",children:[(0,i.jsx)("div",{className:"flex justify-center gap-2",children:o.map((n,c)=>(0,i.jsx)(ae,{className:"w-12 h-14 border-2 focus-within:border-blue-500 transition-colors",children:(0,i.jsx)(ne,{className:"p-0 h-full flex items-center justify-center",children:(0,i.jsx)("input",{ref:N=>{g.current[c]=N},type:"tel",inputMode:"numeric",maxLength:1,value:n,onChange:N=>w(c,N.target.value),onKeyDown:N=>k(c,N),className:"w-full h-full text-center text-2xl font-bold border-none outline-none bg-transparent",autoComplete:"one-time-code",disabled:l,style:{height:"auto"}})})},c))}),h&&(0,i.jsxs)(te,{variant:"destructive",children:[(0,i.jsx)(U.AlertCircle,{className:"h-4 w-4"}),(0,i.jsx)(oe,{children:h})]}),(0,i.jsxs)("div",{className:"space-y-3",children:[(0,i.jsx)(P,{type:"submit",className:"w-full",disabled:l||o.some(n=>n===""),children:l?"Verifying...":"Verify Code"}),(0,i.jsx)(P,{type:"button",variant:"ghost",size:"sm",onClick:u,className:"w-full text-xs",children:"Clear Code"})]})]}),(0,i.jsx)("p",{className:"text-xs text-muted-foreground",children:"Codes refresh every 30 seconds"})]})})})})};
|
|
3
3
|
//# sourceMappingURL=index.js.map
|