@authdog/react-elements 0.0.37 → 0.0.39
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 +39 -39
- package/CHANGELOG.md +12 -0
- package/dist/index.d.mts +2 -1
- package/dist/index.d.ts +2 -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/package.json +4 -4
- package/src/components/core/user-dropdown.tsx +3 -2
- package/src/components/core/user-profile.tsx +3 -2
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @authdog/react-elements@0.0.
|
|
2
|
+
> @authdog/react-elements@0.0.39 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,61 +10,61 @@
|
|
|
10
10
|
[34mCLI[39m Cleaning output folder
|
|
11
11
|
[34mESM[39m Build start
|
|
12
12
|
[34mCJS[39m Build start
|
|
13
|
-
[
|
|
14
|
-
[32mESM[39m [1mdist/components/ui/alert.mjs [22m[32m1.19 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/dropdown-menu.mjs [22m[32m5.37 KB[39m
|
|
20
|
-
[32mESM[39m [1mdist/components/ui/card.mjs [22m[32m1.35 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/sheet.mjs [22m[32m2.68 KB[39m
|
|
24
|
-
[32mESM[39m [1mdist/components/ui/separator.mjs [22m[32m604.00 B[39m
|
|
25
|
-
[32mESM[39m [1mdist/index.mjs.map [22m[32m85.73 KB[39m
|
|
26
|
-
[32mESM[39m [1mdist/components/ui/alert.mjs.map [22m[32m2.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/dropdown-menu.mjs.map [22m[32m12.03 KB[39m
|
|
32
|
-
[32mESM[39m [1mdist/components/ui/card.mjs.map [22m[32m3.54 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/sheet.mjs.map [22m[32m6.49 KB[39m
|
|
36
|
-
[32mESM[39m [1mdist/components/ui/separator.mjs.map [22m[32m1.51 KB[39m
|
|
37
|
-
[32mESM[39m ⚡️ Build success in 129ms
|
|
13
|
+
[32mCJS[39m [1mdist/index.js [22m[32m29.54 KB[39m
|
|
38
14
|
[32mCJS[39m [1mdist/lib/utils.js [22m[32m620.00 B[39m
|
|
39
|
-
[32mCJS[39m [1mdist/index.js [22m[32m30.01 KB[39m
|
|
40
15
|
[32mCJS[39m [1mdist/components/ui/alert.js [22m[32m1.65 KB[39m
|
|
41
16
|
[32mCJS[39m [1mdist/components/ui/avatar.js [22m[32m1.34 KB[39m
|
|
42
|
-
[32mCJS[39m [1mdist/components/ui/button.js [22m[32m1.94 KB[39m
|
|
43
17
|
[32mCJS[39m [1mdist/components/ui/badge.js [22m[32m1.78 KB[39m
|
|
18
|
+
[32mCJS[39m [1mdist/components/ui/button.js [22m[32m1.94 KB[39m
|
|
19
|
+
[32mCJS[39m [1mdist/components/ui/dropdown-menu.js [22m[32m6.10 KB[39m
|
|
20
|
+
[32mCJS[39m [1mdist/components/ui/input.js [22m[32m1.37 KB[39m
|
|
44
21
|
[32mCJS[39m [1mdist/components/ui/card.js [22m[32m1.85 KB[39m
|
|
45
22
|
[32mCJS[39m [1mdist/components/ui/label.js [22m[32m1.14 KB[39m
|
|
46
23
|
[32mCJS[39m [1mdist/components/ui/separator.js [22m[32m1.18 KB[39m
|
|
47
|
-
[32mCJS[39m [1mdist/components/ui/input.js [22m[32m1.37 KB[39m
|
|
48
24
|
[32mCJS[39m [1mdist/components/ui/sheet.js [22m[32m3.36 KB[39m
|
|
49
|
-
[32mCJS[39m [1mdist/
|
|
25
|
+
[32mCJS[39m [1mdist/index.js.map [22m[32m85.09 KB[39m
|
|
50
26
|
[32mCJS[39m [1mdist/lib/utils.js.map [22m[32m520.00 B[39m
|
|
51
|
-
[32mCJS[39m [1mdist/index.js.map [22m[32m85.20 KB[39m
|
|
52
27
|
[32mCJS[39m [1mdist/components/ui/alert.js.map [22m[32m3.01 KB[39m
|
|
53
28
|
[32mCJS[39m [1mdist/components/ui/avatar.js.map [22m[32m2.31 KB[39m
|
|
54
|
-
[32mCJS[39m [1mdist/components/ui/button.js.map [22m[32m3.17 KB[39m
|
|
55
29
|
[32mCJS[39m [1mdist/components/ui/badge.js.map [22m[32m2.79 KB[39m
|
|
30
|
+
[32mCJS[39m [1mdist/components/ui/button.js.map [22m[32m3.17 KB[39m
|
|
31
|
+
[32mCJS[39m [1mdist/components/ui/dropdown-menu.js.map [22m[32m12.49 KB[39m
|
|
32
|
+
[32mCJS[39m [1mdist/components/ui/input.js.map [22m[32m1.79 KB[39m
|
|
56
33
|
[32mCJS[39m [1mdist/components/ui/card.js.map [22m[32m3.81 KB[39m
|
|
57
34
|
[32mCJS[39m [1mdist/components/ui/label.js.map [22m[32m1.45 KB[39m
|
|
58
35
|
[32mCJS[39m [1mdist/components/ui/separator.js.map [22m[32m1.64 KB[39m
|
|
59
|
-
[32mCJS[39m [1mdist/components/ui/input.js.map [22m[32m1.79 KB[39m
|
|
60
36
|
[32mCJS[39m [1mdist/components/ui/sheet.js.map [22m[32m6.75 KB[39m
|
|
61
|
-
[32mCJS[39m
|
|
62
|
-
[
|
|
37
|
+
[32mCJS[39m ⚡️ Build success in 125ms
|
|
38
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m27.25 KB[39m
|
|
39
|
+
[32mESM[39m [1mdist/lib/utils.mjs [22m[32m166.00 B[39m
|
|
40
|
+
[32mESM[39m [1mdist/components/ui/avatar.mjs [22m[32m749.00 B[39m
|
|
41
|
+
[32mESM[39m [1mdist/components/ui/alert.mjs [22m[32m1.19 KB[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/dropdown-menu.mjs [22m[32m5.37 KB[39m
|
|
46
|
+
[32mESM[39m [1mdist/components/ui/input.mjs [22m[32m949.00 B[39m
|
|
47
|
+
[32mESM[39m [1mdist/components/ui/separator.mjs [22m[32m604.00 B[39m
|
|
48
|
+
[32mESM[39m [1mdist/components/ui/label.mjs [22m[32m566.00 B[39m
|
|
49
|
+
[32mESM[39m [1mdist/components/ui/sheet.mjs [22m[32m2.68 KB[39m
|
|
50
|
+
[32mESM[39m [1mdist/lib/utils.mjs.map [22m[32m415.00 B[39m
|
|
51
|
+
[32mESM[39m [1mdist/index.mjs.map [22m[32m85.57 KB[39m
|
|
52
|
+
[32mESM[39m [1mdist/components/ui/avatar.mjs.map [22m[32m2.13 KB[39m
|
|
53
|
+
[32mESM[39m [1mdist/components/ui/alert.mjs.map [22m[32m2.82 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/dropdown-menu.mjs.map [22m[32m12.03 KB[39m
|
|
58
|
+
[32mESM[39m [1mdist/components/ui/input.mjs.map [22m[32m1.67 KB[39m
|
|
59
|
+
[32mESM[39m [1mdist/components/ui/sheet.mjs.map [22m[32m6.49 KB[39m
|
|
60
|
+
[32mESM[39m [1mdist/components/ui/separator.mjs.map [22m[32m1.51 KB[39m
|
|
61
|
+
[32mESM[39m [1mdist/components/ui/label.mjs.map [22m[32m1.32 KB[39m
|
|
62
|
+
[32mESM[39m ⚡️ Build success in 130ms
|
|
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 5798ms
|
|
65
|
+
[32mDTS[39m [1mdist/index.d.mts [22m[32m3.59 KB[39m
|
|
66
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m3.59 KB[39m
|
|
67
67
|
|
|
68
|
-
> @authdog/react-elements@0.0.
|
|
68
|
+
> @authdog/react-elements@0.0.39 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
|
@@ -88,8 +88,9 @@ interface UserDropdownProps {
|
|
|
88
88
|
side?: "top" | "right" | "bottom" | "left";
|
|
89
89
|
align?: "start" | "center" | "end";
|
|
90
90
|
sideOffset?: number;
|
|
91
|
+
modal?: boolean;
|
|
91
92
|
}
|
|
92
|
-
declare const UserDropdown: ({ trigger, user, className, onManageAccount, onSignout, links, side, align, sideOffset }: UserDropdownProps) => react_jsx_runtime.JSX.Element;
|
|
93
|
+
declare const UserDropdown: ({ trigger, user, className, onManageAccount, onSignout, links, side, align, sideOffset, modal }: UserDropdownProps) => react_jsx_runtime.JSX.Element;
|
|
93
94
|
|
|
94
95
|
interface PlaceholderAlertProps {
|
|
95
96
|
title?: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -88,8 +88,9 @@ interface UserDropdownProps {
|
|
|
88
88
|
side?: "top" | "right" | "bottom" | "left";
|
|
89
89
|
align?: "start" | "center" | "end";
|
|
90
90
|
sideOffset?: number;
|
|
91
|
+
modal?: boolean;
|
|
91
92
|
}
|
|
92
|
-
declare const UserDropdown: ({ trigger, user, className, onManageAccount, onSignout, links, side, align, sideOffset }: UserDropdownProps) => react_jsx_runtime.JSX.Element;
|
|
93
|
+
declare const UserDropdown: ({ trigger, user, className, onManageAccount, onSignout, links, side, align, sideOffset, modal }: UserDropdownProps) => react_jsx_runtime.JSX.Element;
|
|
93
94
|
|
|
94
95
|
interface PlaceholderAlertProps {
|
|
95
96
|
title?: string;
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
"use strict";var Ye=Object.create;var Y=Object.defineProperty;var Je=Object.getOwnPropertyDescriptor;var Qe=Object.getOwnPropertyNames;var Ze=Object.getPrototypeOf,et=Object.prototype.hasOwnProperty;var tt=(t,o)=>{for(var r in o)Y(t,r,{get:o[r],enumerable:!0})},fe=(t,o,r,c)=>{if(o&&typeof o=="object"||typeof o=="function")for(let d of Qe(o))!et.call(t,d)&&d!==r&&Y(t,d,{get:()=>o[d],enumerable:!(c=Je(o,d))||c.enumerable});return t};var q=(t,o,r)=>(r=t!=null?Ye(Ze(t)):{},fe(o||!t||!t.__esModule?Y(r,"default",{value:t,enumerable:!0}):r,t)),ot=t=>fe(Y({},"__esModule",{value:!0}),t);var pt={};tt(pt,{Button:()=>x,ClientOnly:()=>we,Navbar:()=>Re,PlaceholderAlert:()=>We,TOTPValidator:()=>qe,UserDropdown:()=>je,UserProfile:()=>Ue});module.exports=ot(pt);var be=q(require("react")),xe=require("@radix-ui/react-slot"),he=require("class-variance-authority");var ve=require("clsx"),ge=require("tailwind-merge");function n(...t){return(0,ge.twMerge)((0,ve.clsx)(t))}var ye=require("react/jsx-runtime"),rt=(0,he.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"}}),x=be.forwardRef(({className:t,variant:o,size:r,asChild:c=!1,...d},y)=>(0,ye.jsx)(c?xe.Slot:"button",{className:n(rt({variant:o,size:r,className:t})),ref:y,...d}));x.displayName="Button";var J=require("react"),Q=require("react/jsx-runtime"),we=({children:t})=>{let[o,r]=(0,J.useState)(!1);return(0,J.useEffect)(()=>{r(!0)},[]),o?(0,Q.jsx)(Q.Fragment,{children:t}):null};var Se=require("react"),U=require("lucide-react");var z=q(require("@radix-ui/react-avatar"));var Z=require("react/jsx-runtime");function B({className:t,...o}){return(0,Z.jsx)(z.Root,{"data-slot":"avatar",className:n("relative flex size-8 shrink-0 overflow-hidden rounded-full",t),...o})}function G({className:t,...o}){return(0,Z.jsx)(z.Image,{"data-slot":"avatar-image",className:n("aspect-square size-full",t),...o})}function O({className:t,...o}){return(0,Z.jsx)(z.Fallback,{"data-slot":"avatar-fallback",className:n("bg-muted flex size-full items-center justify-center rounded-full",t),...o})}var m=q(require("@radix-ui/react-dropdown-menu")),me=require("lucide-react");var P=require("react/jsx-runtime");function ee({...t}){return(0,P.jsx)(m.Root,{"data-slot":"dropdown-menu",...t})}function te({...t}){return(0,P.jsx)(m.Trigger,{"data-slot":"dropdown-menu-trigger",...t})}function oe({className:t,sideOffset:o=4,...r}){return(0,P.jsx)(m.Portal,{children:(0,P.jsx)(m.Content,{"data-slot":"dropdown-menu-content",sideOffset:o,className:n("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),...r})})}function Ne({...t}){return(0,P.jsx)(m.Group,{"data-slot":"dropdown-menu-group",...t})}function I({className:t,inset:o,variant:r="default",...c}){return(0,P.jsx)(m.Item,{"data-slot":"dropdown-menu-item","data-inset":o,"data-variant":r,className:n("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),...c})}function Ce({className:t,inset:o,...r}){return(0,P.jsx)(m.Label,{"data-slot":"dropdown-menu-label","data-inset":o,className:n("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",t),...r})}function F({className:t,...o}){return(0,P.jsx)(m.Separator,{"data-slot":"dropdown-menu-separator",className:n("bg-border -mx-1 my-1 h-px",t),...o})}var h=q(require("@radix-ui/react-dialog")),Pe=require("lucide-react");var N=require("react/jsx-runtime"),at=Pe.X;function ke({...t}){return(0,N.jsx)(h.Root,{"data-slot":"sheet",...t})}function De({...t}){return(0,N.jsx)(h.Trigger,{"data-slot":"sheet-trigger",...t})}function nt({...t}){return(0,N.jsx)(h.Portal,{"data-slot":"sheet-portal",...t})}function it({className:t,...o}){return(0,N.jsx)(h.Overlay,{"data-slot":"sheet-overlay",className:n("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 Me({className:t,children:o,side:r="right",...c}){return(0,N.jsxs)(nt,{children:[(0,N.jsx)(it,{}),(0,N.jsxs)(h.Content,{"data-slot":"sheet-content",className:n("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",t),...c,children:[o,(0,N.jsxs)(h.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,N.jsx)(at,{className:"size-4"}),(0,N.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})}var ae=require("react"),re=require("react/jsx-runtime"),st={className:"mr-2 h-4 w-4","aria-hidden":"true"},dt=t=>{let[o,r]=(0,ae.useState)(!1);return(0,ae.useEffect)(()=>{r(!0)},[]),o?(0,re.jsx)(t,{...st}):(0,re.jsx)("span",{className:"mr-2 h-4 w-4","aria-hidden":"true"})},_=({Icon:t})=>(0,re.jsx)("span",{className:"inline-flex items-center justify-center",children:dt(t)});var a=require("react/jsx-runtime");function Re({items:t=[],children:o,className:r,logoText:c="ACME Corp",user:d={name:"John Doe",email:"john@example.com",image:"https://i.pravatar.cc/150?u=a042581f4e29026704d"},onNavigateHome:y=()=>console.log("Navigating to home"),onNavItemClick:w=M=>console.log(`Navigating to ${M}`),onProfileSelected:R,onLogout:v=()=>console.log("Logout clicked"),isLoading:g=!1,identityHost:C="https://stg-id.authdog.xyz",environmentId:D="58be35b0-708f-49f6-84f0-6695d307d997"}){let[M,S]=(0,Se.useState)(!1),f=d!=null&&d.id!==null&&d.id!==void 0;return(0,a.jsx)("header",{className:n("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:y,children:c}),(0,a.jsx)("nav",{className:"hidden md:flex gap-6",children:t?.map((i,l)=>(0,a.jsx)("span",{onClick:()=>{i.disabled||w(i.href)},className:n("text-sm font-medium transition-colors hover:text-primary cursor-pointer",i.disabled&&"cursor-not-allowed opacity-80"),children:i.title},l))})]}),(0,a.jsxs)("div",{className:"flex items-center gap-4",children:[o,f?(0,a.jsxs)(ee,{children:[(0,a.jsx)(te,{asChild:!0,children:(0,a.jsx)(x,{variant:"ghost",className:"relative h-8 w-8 rounded-full",disabled:g,children:(0,a.jsx)(B,{className:"h-8 w-8",children:g?(0,a.jsx)("div",{className:"h-8 w-8 animate-pulse bg-muted rounded-full"}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(G,{src:d.photos?.[0]?.value||"/placeholder.svg",alt:d.displayName}),(0,a.jsx)(O,{children:d.displayName?.charAt(0)})]})})})}),(0,a.jsx)(oe,{className:"w-56",align:"end",forceMount:!0,children:g?(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)(Ce,{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)(F,{}),(0,a.jsx)(Ne,{children:(0,a.jsxs)(I,{onClick:R,children:[(0,a.jsx)(_,{Icon:U.User}),(0,a.jsx)("span",{children:"Profile"})]})}),(0,a.jsx)(F,{}),(0,a.jsxs)(I,{onClick:v,children:[(0,a.jsx)(_,{Icon:U.LogOut}),(0,a.jsx)("span",{children:"Log out"})]})]})})]}):(0,a.jsx)(x,{variant:"default","aria-label":"Sign in",onClick:()=>{if(!D)throw new Error("Environment ID is required");if(!C)throw new Error("Identity Host is required");let i=`${C}/signin/${D}`;window.open(i,"_blank")},children:"Sign in"}),(0,a.jsxs)(ke,{open:M,onOpenChange:S,children:[(0,a.jsx)(De,{asChild:!0,children:(0,a.jsx)(x,{variant:"ghost",size:"icon",className:"md:hidden","aria-label":"Open Menu",children:(0,a.jsx)(_,{Icon:U.Menu})})}),(0,a.jsx)(Me,{side:"left",className:"pr-0",children:(0,a.jsx)("nav",{className:"grid gap-2 py-6",children:t?.map((i,l)=>(0,a.jsx)("a",{href:i.href,className:n("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:()=>S(!1),children:i.title},l))})})]})]})]})})}var k=require("react");var Ie=require("@radix-ui/react-slot"),Te=require("class-variance-authority");var Ae=require("react/jsx-runtime"),lt=(0,Te.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 ne({className:t,variant:o,asChild:r=!1,...c}){return(0,Ae.jsx)(r?Ie.Slot:"span",{"data-slot":"badge",className:n(lt({variant:o}),t),...c})}var T=require("react/jsx-runtime");function j({className:t,...o}){return(0,T.jsx)("div",{"data-slot":"card",className:n("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",t),...o})}function Ve({className:t,...o}){return(0,T.jsx)("div",{"data-slot":"card-header",className:n("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",t),...o})}function Le({className:t,...o}){return(0,T.jsx)("div",{"data-slot":"card-title",className:n("leading-none font-semibold",t),...o})}function Ee({className:t,...o}){return(0,T.jsx)("div",{"data-slot":"card-description",className:n("text-muted-foreground text-sm",t),...o})}function H({className:t,...o}){return(0,T.jsx)("div",{"data-slot":"card-content",className:n("px-6",t),...o})}function ze({className:t,...o}){return(0,T.jsx)("div",{"data-slot":"card-footer",className:n("flex items-center px-6 [.border-t]:pt-6",t),...o})}var Ge=require("react/jsx-runtime");function Be({className:t,type:o,...r}){return(0,Ge.jsx)("input",{type:o,"data-slot":"input",className:n("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","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",t),...r})}var Oe=q(require("@radix-ui/react-label"));var _e=require("react/jsx-runtime");function Fe({className:t,...o}){return(0,_e.jsx)(Oe.Root,{"data-slot":"label",className:n("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",t),...o})}var $=require("lucide-react"),e=require("react/jsx-runtime"),Ue=({loading:t,user:o,handleAuthenticated:r,onRequestEmailVerification:c,onVerifyEmail:d,onAddEmail:y})=>{let[w,R]=(0,k.useState)(!1),[v,g]=(0,k.useState)("profile"),[C,D]=(0,k.useState)(null),[M,S]=(0,k.useState)({}),[f,i]=(0,k.useState)(!1),[l,b]=(0,k.useState)("");(0,k.useEffect)(()=>{R(!0)},[]),(0,k.useEffect)(()=>{!t&&r&&r()},[t,o,r]);let X={className:"mr-2 h-4 w-4","aria-hidden":"true"},L=u=>w?(0,e.jsx)(u,{...X}):null;return!w||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:()=>g("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:[L($.User),"Profile"]}),(0,e.jsxs)("button",{onClick:()=>g("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:[L($.Shield),"Security"]}),(0,e.jsxs)("button",{onClick:()=>g("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:[L($.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)(B,{className:"h-12 w-12 mr-4 border",children:[(0,e.jsx)(G,{src:o.photos?.[0]?.value,alt:"Profile picture"}),(0,e.jsx)(O,{children:o.displayName?.split(" ").map(u=>u[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.jsxs)("div",{className:"space-y-2.5",children:[o.emails.map((u,E)=>{let pe=(o?.verifications||[]).find(ce=>ce.email===u.value)?.verified===!0,ue=M[u.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:u.value}),(0,e.jsx)("div",{className:"mt-1",children:pe?(0,e.jsx)(ne,{className:"text-xs rounded-full px-2.5 py-0.5 bg-green-100 text-green-800 border border-green-300 dark:bg-green-500/20 dark:text-green-200 dark:border-green-400/40",children:"Verified"}):(0,e.jsx)(ne,{className:"text-xs rounded-full px-2.5 py-0.5 bg-amber-100 text-amber-800 border border-amber-300 dark:bg-amber-500/20 dark:text-amber-200 dark:border-amber-400/40",children:"Not verified"})})]}),(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[E===0&&(0,e.jsx)(ne,{variant:"outline",className:"text-xs bg-muted text-foreground hover:bg-muted",children:"Primary"}),!pe&&(0,e.jsx)(e.Fragment,{children:C===u.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:ue,onChange:ce=>S(Xe=>({...Xe,[u.value]:ce.target.value}))}),(0,e.jsx)("button",{className:"h-7 rounded-md border border-border px-2 text-xs",onClick:async()=>{d&&await d(u.value,ue)},children:"Verify"}),(0,e.jsx)("button",{className:"h-7 rounded-md border border-border px-2 text-xs",onClick:()=>D(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()=>{c&&await c(u.value),D(u.value)},children:"Send code"})})})]})]},u.value)}),(0,e.jsx)("div",{className:"mt-2",children:f?(0,e.jsx)("div",{className:"max-w-md",children:(0,e.jsxs)(j,{children:[(0,e.jsxs)(Ve,{children:[(0,e.jsx)(Le,{children:"Add email address"}),(0,e.jsx)(Ee,{children:"You'll need to verify this email address before it can be added to your account."})]}),(0,e.jsx)(H,{children:(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)(Fe,{htmlFor:"new-email",children:"Email address"}),(0,e.jsx)(Be,{id:"new-email",placeholder:"Enter your email address",value:l,onChange:u=>b(u.target.value),onKeyDown:async u=>{if(u.key==="Enter"){let E=String(l||"").trim().toLowerCase();if(!E)return;y&&await y(E),i(!1),b("")}}})]})}),(0,e.jsxs)(ze,{className:"justify-end gap-2",children:[(0,e.jsx)(x,{variant:"ghost",onClick:()=>{i(!1),b("")},children:"Cancel"}),(0,e.jsx)(x,{onClick:async()=>{let u=String(l||"").trim().toLowerCase();u&&(y&&await y(u),i(!1),b(""))},children:"Add"})]})]})}):(0,e.jsx)(x,{variant:"outline",size:"sm",className:"text-xs",onClick:()=>i(!0),children:"Add email"})})]})]}),(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 K=require("lucide-react"),p=require("react/jsx-runtime"),ct=t=>t&&String(t).trim().split(/\s+/).slice(0,2).map(c=>c[0]?.toUpperCase()).join("")||"?",je=({trigger:t,user:o,className:r,onManageAccount:c,onSignout:d,links:y=[],side:w="bottom",align:R="end",sideOffset:v=8})=>{let g=o?.emails?.[0]?.value||o?.email||"",C=o?.displayName||o?.name||"",D=o?.photos?.[0]?.value||o?.avatar||"",M=f=>{if(f.onClick)return f.onClick();f.href&&(f.href.startsWith("http")?window.open(f.href,"_blank"):window.location.assign(f.href))},S=K.ExternalLink;return(0,p.jsxs)(ee,{children:[(0,p.jsx)(te,{asChild:!0,children:t}),(0,p.jsxs)(oe,{align:R,side:w,sideOffset:v,className:n("w-72 p-2 overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md",r),children:[(0,p.jsxs)("div",{className:"flex items-center gap-3 px-4 pt-4 pb-3",children:[(0,p.jsxs)(B,{className:"h-9 w-9 rounded-full",children:[(0,p.jsx)(G,{src:D,alt:C}),(0,p.jsx)(O,{className:"rounded-full",children:ct(C)})]}),(0,p.jsxs)("div",{className:"min-w-0",children:[(0,p.jsx)("div",{className:"text-sm font-semibold truncate",children:C}),(0,p.jsx)("div",{className:"text-xs text-muted-foreground truncate",children:g})]})]}),(0,p.jsx)(F,{}),(0,p.jsxs)(I,{className:"cursor-pointer py-2",onClick:()=>c?.(),children:[(0,p.jsx)(K.Settings,{className:"mr-2 h-4 w-4"}),(0,p.jsx)("span",{children:"Manage account"})]}),y.map((f,i)=>{let l=f.icon??S;return(0,p.jsxs)(I,{className:"cursor-pointer py-2",onClick:()=>M(f),children:[(0,p.jsx)(l,{className:"mr-2 h-4 w-4"}),(0,p.jsx)("span",{children:f.label})]},`${f.label}-${i}`)}),(0,p.jsx)(F,{}),(0,p.jsxs)(I,{className:"cursor-pointer py-2 rounded-md font-semibold text-red-600 dark:text-red-300 hover:bg-red-50 hover:text-red-700 focus:bg-red-50 focus:text-red-700 dark:hover:bg-red-500/20 dark:focus:bg-red-500/25 dark:hover:text-red-100 dark:focus:text-red-100 border border-transparent dark:border-red-500/30 ring-0 focus-visible:ring-2 focus-visible:ring-red-400/40 dark:focus-visible:ring-red-400/40",onClick:()=>d?.(),children:[(0,p.jsx)(K.LogOut,{className:"mr-2 h-4 w-4 text-red-600 dark:text-red-300"}),(0,p.jsx)("span",{children:"Sign out"})]})]})]})};var Ke=require("lucide-react");var He=require("class-variance-authority");var de=require("react/jsx-runtime"),mt=(0,He.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 ie({className:t,variant:o,...r}){return(0,de.jsx)("div",{"data-slot":"alert",role:"alert",className:n(mt({variant:o}),t),...r})}function $e({className:t,...o}){return(0,de.jsx)("div",{"data-slot":"alert-title",className:n("col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight",t),...o})}function se({className:t,...o}){return(0,de.jsx)("div",{"data-slot":"alert-description",className:n("text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",t),...o})}var A=require("react/jsx-runtime"),We=t=>{let o=t.title??"Placeholder Alert",r=t.description??"This is a placeholder alert.";return(0,A.jsx)("div",{className:"grid w-full max-w-xl items-start gap-4",children:(0,A.jsxs)(ie,{children:[(0,A.jsx)(_,{Icon:Ke.CheckCircle2Icon}),(0,A.jsx)($e,{children:o}),(0,A.jsx)(se,{children:r})]})})};var V=require("react");var W=require("lucide-react"),s=require("react/jsx-runtime"),qe=({onValidate:t})=>{let[o,r]=(0,V.useState)(["","","","","",""]),[c,d]=(0,V.useState)(!1),[y,w]=(0,V.useState)(""),[R,v]=(0,V.useState)(!1),g=(0,V.useRef)([]),C=(i,l)=>{if(!/^\d*$/.test(l))return;let b=[...o];b[i]=l.slice(-1),r(b),w(""),v(!1),l&&i<5&&g.current[i+1]?.focus()},D=(i,l)=>{l.key==="Backspace"&&!o[i]&&i>0&&g.current[i-1]?.focus(),l.key==="v"&&(l.ctrlKey||l.metaKey)&&(l.preventDefault(),navigator.clipboard.readText().then(b=>{let X=b.replace(/\D/g,"").slice(0,6).split(""),L=[...o];X.forEach((E,le)=>{le<6&&(L[le]=E)}),r(L);let u=Math.min(X.length,5);g.current[u]?.focus()}))},M=async()=>{let i=o.join("");if(i.length!==6){w("Please enter all 6 digits");return}d(!0),w("");try{await t(i),v(!0)}catch{w("Invalid TOTP code. Please try again.")}finally{d(!1)}},S=i=>{i.preventDefault(),M()},f=()=>{r(["","","","","",""]),w(""),v(!1),d(!1),g.current[0]?.focus()};return R?(0,s.jsx)("div",{className:"max-w-md mx-auto",children:(0,s.jsx)(j,{className:"border-green-200 bg-green-50",children:(0,s.jsx)(H,{className:"pt-6",children:(0,s.jsxs)("div",{className:"text-center space-y-4",children:[(0,s.jsx)("div",{className:"mx-auto w-16 h-16 bg-green-100 rounded-full flex items-center justify-center",children:(0,s.jsx)(W.CheckCircle,{className:"w-8 h-8 text-green-600"})}),(0,s.jsxs)("div",{children:[(0,s.jsx)("h3",{className:"text-lg font-semibold text-green-900",children:"Verification Successful!"}),(0,s.jsx)("p",{className:"text-sm text-green-700 mt-1",children:"Your TOTP code has been validated."})]}),(0,s.jsx)(x,{onClick:f,variant:"outline",className:"bg-white",children:"Verify Another Code"})]})})})}):(0,s.jsx)("div",{className:"max-w-md mx-auto",children:(0,s.jsx)(j,{children:(0,s.jsx)(H,{className:"pt-6",children:(0,s.jsxs)("div",{className:"text-center space-y-6",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"mx-auto w-12 h-12 bg-blue-100 rounded-full flex items-center justify-center mb-4",children:(0,s.jsx)(W.Shield,{className:"w-6 h-6 text-blue-600"})}),(0,s.jsx)("h3",{className:"text-lg font-semibold",children:"Enter Verification Code"}),(0,s.jsx)("p",{className:"text-sm text-muted-foreground mt-1",children:"Enter the 6-digit code from your authenticator app"})]}),(0,s.jsxs)("form",{onSubmit:S,className:"space-y-6",children:[(0,s.jsx)("div",{className:"flex justify-center gap-2",children:o.map((i,l)=>(0,s.jsx)(j,{className:"w-12 h-14 border-2 focus-within:border-blue-500 transition-colors",children:(0,s.jsx)(H,{className:"p-0 h-full flex items-center justify-center",children:(0,s.jsx)("input",{ref:b=>{g.current[l]=b},type:"tel",inputMode:"numeric",maxLength:1,value:i,onChange:b=>C(l,b.target.value),onKeyDown:b=>D(l,b),className:"w-full h-full text-center text-2xl font-bold border-none outline-none bg-transparent",autoComplete:"one-time-code",disabled:c,style:{height:"auto"}})})},l))}),y&&(0,s.jsxs)(ie,{variant:"destructive",children:[(0,s.jsx)(W.AlertCircle,{className:"h-4 w-4"}),(0,s.jsx)(se,{children:y})]}),(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsx)(x,{type:"submit",className:"w-full",disabled:c||o.some(i=>i===""),children:c?"Verifying...":"Verify Code"}),(0,s.jsx)(x,{type:"button",variant:"ghost",size:"sm",onClick:f,className:"w-full text-xs",children:"Clear Code"})]})]}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:"Codes refresh every 30 seconds"})]})})})})};
|
|
2
|
+
"use strict";var Ye=Object.create;var X=Object.defineProperty;var Je=Object.getOwnPropertyDescriptor;var Qe=Object.getOwnPropertyNames;var Ze=Object.getPrototypeOf,et=Object.prototype.hasOwnProperty;var tt=(t,o)=>{for(var r in o)X(t,r,{get:o[r],enumerable:!0})},ue=(t,o,r,c)=>{if(o&&typeof o=="object"||typeof o=="function")for(let d of Qe(o))!et.call(t,d)&&d!==r&&X(t,d,{get:()=>o[d],enumerable:!(c=Je(o,d))||c.enumerable});return t};var K=(t,o,r)=>(r=t!=null?Ye(Ze(t)):{},ue(o||!t||!t.__esModule?X(r,"default",{value:t,enumerable:!0}):r,t)),ot=t=>ue(X({},"__esModule",{value:!0}),t);var pt={};tt(pt,{Button:()=>v,ClientOnly:()=>ye,Navbar:()=>Se,PlaceholderAlert:()=>We,TOTPValidator:()=>qe,UserDropdown:()=>je,UserProfile:()=>Ue});module.exports=ot(pt);var ge=K(require("react")),be=require("@radix-ui/react-slot"),xe=require("class-variance-authority");var fe=require("clsx"),ve=require("tailwind-merge");function i(...t){return(0,ve.twMerge)((0,fe.clsx)(t))}var he=require("react/jsx-runtime"),rt=(0,xe.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=ge.forwardRef(({className:t,variant:o,size:r,asChild:c=!1,...d},b)=>(0,he.jsx)(c?be.Slot:"button",{className:i(rt({variant:o,size:r,className:t})),ref:b,...d}));v.displayName="Button";var Y=require("react"),J=require("react/jsx-runtime"),ye=({children:t})=>{let[o,r]=(0,Y.useState)(!1);return(0,Y.useEffect)(()=>{r(!0)},[]),o?(0,J.jsx)(J.Fragment,{children:t}):null};var Me=require("react"),_=require("lucide-react");var E=K(require("@radix-ui/react-avatar"));var Q=require("react/jsx-runtime");function z({className:t,...o}){return(0,Q.jsx)(E.Root,{"data-slot":"avatar",className:i("relative flex size-8 shrink-0 overflow-hidden rounded-full",t),...o})}function B({className:t,...o}){return(0,Q.jsx)(E.Image,{"data-slot":"avatar-image",className:i("aspect-square size-full",t),...o})}function G({className:t,...o}){return(0,Q.jsx)(E.Fallback,{"data-slot":"avatar-fallback",className:i("bg-muted flex size-full items-center justify-center rounded-full",t),...o})}var m=K(require("@radix-ui/react-dropdown-menu")),ce=require("lucide-react");var C=require("react/jsx-runtime");function Z({...t}){return(0,C.jsx)(m.Root,{"data-slot":"dropdown-menu",...t})}function ee({...t}){return(0,C.jsx)(m.Trigger,{"data-slot":"dropdown-menu-trigger",...t})}function te({className:t,sideOffset:o=4,...r}){return(0,C.jsx)(m.Portal,{children:(0,C.jsx)(m.Content,{"data-slot":"dropdown-menu-content",sideOffset:o,className:i("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),...r})})}function we({...t}){return(0,C.jsx)(m.Group,{"data-slot":"dropdown-menu-group",...t})}function I({className:t,inset:o,variant:r="default",...c}){return(0,C.jsx)(m.Item,{"data-slot":"dropdown-menu-item","data-inset":o,"data-variant":r,className:i("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),...c})}function Ne({className:t,inset:o,...r}){return(0,C.jsx)(m.Label,{"data-slot":"dropdown-menu-label","data-inset":o,className:i("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",t),...r})}function O({className:t,...o}){return(0,C.jsx)(m.Separator,{"data-slot":"dropdown-menu-separator",className:i("bg-border -mx-1 my-1 h-px",t),...o})}var g=K(require("@radix-ui/react-dialog")),Ce=require("lucide-react");var w=require("react/jsx-runtime"),at=Ce.X;function Pe({...t}){return(0,w.jsx)(g.Root,{"data-slot":"sheet",...t})}function ke({...t}){return(0,w.jsx)(g.Trigger,{"data-slot":"sheet-trigger",...t})}function nt({...t}){return(0,w.jsx)(g.Portal,{"data-slot":"sheet-portal",...t})}function it({className:t,...o}){return(0,w.jsx)(g.Overlay,{"data-slot":"sheet-overlay",className:i("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 De({className:t,children:o,side:r="right",...c}){return(0,w.jsxs)(nt,{children:[(0,w.jsx)(it,{}),(0,w.jsxs)(g.Content,{"data-slot":"sheet-content",className:i("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",t),...c,children:[o,(0,w.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,w.jsx)(at,{className:"size-4"}),(0,w.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})}var re=require("react"),oe=require("react/jsx-runtime"),st={className:"mr-2 h-4 w-4","aria-hidden":"true"},dt=t=>{let[o,r]=(0,re.useState)(!1);return(0,re.useEffect)(()=>{r(!0)},[]),o?(0,oe.jsx)(t,{...st}):(0,oe.jsx)("span",{className:"mr-2 h-4 w-4","aria-hidden":"true"})},F=({Icon:t})=>(0,oe.jsx)("span",{className:"inline-flex items-center justify-center",children:dt(t)});var a=require("react/jsx-runtime");function Se({items:t=[],children:o,className:r,logoText:c="ACME Corp",user:d={name:"John Doe",email:"john@example.com",image:"https://i.pravatar.cc/150?u=a042581f4e29026704d"},onNavigateHome:b=()=>console.log("Navigating to home"),onNavItemClick:x=k=>console.log(`Navigating to ${k}`),onProfileSelected:R,onLogout:h=()=>console.log("Logout clicked"),isLoading:y=!1,identityHost:D="https://stg-id.authdog.xyz",environmentId:N="58be35b0-708f-49f6-84f0-6695d307d997"}){let[k,M]=(0,Me.useState)(!1),S=d!=null&&d.id!==null&&d.id!==void 0;return(0,a.jsx)("header",{className:i("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:b,children:c}),(0,a.jsx)("nav",{className:"hidden md:flex gap-6",children:t?.map((n,l)=>(0,a.jsx)("span",{onClick:()=>{n.disabled||x(n.href)},className:i("text-sm font-medium transition-colors hover:text-primary cursor-pointer",n.disabled&&"cursor-not-allowed opacity-80"),children:n.title},l))})]}),(0,a.jsxs)("div",{className:"flex items-center gap-4",children:[o,S?(0,a.jsxs)(Z,{children:[(0,a.jsx)(ee,{asChild:!0,children:(0,a.jsx)(v,{variant:"ghost",className:"relative h-8 w-8 rounded-full",disabled:y,children:(0,a.jsx)(z,{className:"h-8 w-8",children:y?(0,a.jsx)("div",{className:"h-8 w-8 animate-pulse bg-muted rounded-full"}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(B,{src:d.photos?.[0]?.value||"/placeholder.svg",alt:d.displayName}),(0,a.jsx)(G,{children:d.displayName?.charAt(0)})]})})})}),(0,a.jsx)(te,{className:"w-56",align:"end",forceMount:!0,children:y?(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)(Ne,{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)(O,{}),(0,a.jsx)(we,{children:(0,a.jsxs)(I,{onClick:R,children:[(0,a.jsx)(F,{Icon:_.User}),(0,a.jsx)("span",{children:"Profile"})]})}),(0,a.jsx)(O,{}),(0,a.jsxs)(I,{onClick:h,children:[(0,a.jsx)(F,{Icon:_.LogOut}),(0,a.jsx)("span",{children:"Log out"})]})]})})]}):(0,a.jsx)(v,{variant:"default","aria-label":"Sign in",onClick:()=>{if(!N)throw new Error("Environment ID is required");if(!D)throw new Error("Identity Host is required");let n=`${D}/signin/${N}`;window.open(n,"_blank")},children:"Sign in"}),(0,a.jsxs)(Pe,{open:k,onOpenChange:M,children:[(0,a.jsx)(ke,{asChild:!0,children:(0,a.jsx)(v,{variant:"ghost",size:"icon",className:"md:hidden","aria-label":"Open Menu",children:(0,a.jsx)(F,{Icon:_.Menu})})}),(0,a.jsx)(De,{side:"left",className:"pr-0",children:(0,a.jsx)("nav",{className:"grid gap-2 py-6",children:t?.map((n,l)=>(0,a.jsx)("a",{href:n.href,className:i("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},l))})})]})]})]})})}var P=require("react");var Re=require("@radix-ui/react-slot"),Ie=require("class-variance-authority");var Te=require("react/jsx-runtime"),lt=(0,Ie.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 ae({className:t,variant:o,asChild:r=!1,...c}){return(0,Te.jsx)(r?Re.Slot:"span",{"data-slot":"badge",className:i(lt({variant:o}),t),...c})}var T=require("react/jsx-runtime");function U({className:t,...o}){return(0,T.jsx)("div",{"data-slot":"card",className:i("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",t),...o})}function Ae({className:t,...o}){return(0,T.jsx)("div",{"data-slot":"card-header",className:i("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",t),...o})}function Ve({className:t,...o}){return(0,T.jsx)("div",{"data-slot":"card-title",className:i("leading-none font-semibold",t),...o})}function Le({className:t,...o}){return(0,T.jsx)("div",{"data-slot":"card-description",className:i("text-muted-foreground text-sm",t),...o})}function j({className:t,...o}){return(0,T.jsx)("div",{"data-slot":"card-content",className:i("px-6",t),...o})}function Ee({className:t,...o}){return(0,T.jsx)("div",{"data-slot":"card-footer",className:i("flex items-center px-6 [.border-t]:pt-6",t),...o})}var Be=require("react/jsx-runtime");function ze({className:t,type:o,...r}){return(0,Be.jsx)("input",{type:o,"data-slot":"input",className:i("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","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",t),...r})}var Ge=K(require("@radix-ui/react-label"));var Fe=require("react/jsx-runtime");function Oe({className:t,...o}){return(0,Fe.jsx)(Ge.Root,{"data-slot":"label",className:i("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",t),...o})}var _e=require("lucide-react"),e=require("react/jsx-runtime"),Ue=({loading:t,user:o,handleAuthenticated:r,onRequestEmailVerification:c,onVerifyEmail:d,onAddEmail:b})=>{let[x,R]=(0,P.useState)(!1),[h,y]=(0,P.useState)("profile"),[D,N]=(0,P.useState)(null),[k,M]=(0,P.useState)({}),[S,n]=(0,P.useState)(!1),[l,f]=(0,P.useState)("");(0,P.useEffect)(()=>{R(!0)},[]),(0,P.useEffect)(()=>{!t&&r&&r()},[t,o,r]);let W={className:"mr-2 h-4 w-4","aria-hidden":"true"},q=u=>x?(0,e.jsx)(u,{...W}):null;return!x||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.jsx)("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 ${h==="profile"?"bg-muted text-foreground":"text-muted-foreground hover:bg-muted/50"}`,children:[q(_e.User),"Profile"]})})]}),(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:h==="profile"?"Profile details":h==="security"?"Security settings":"Preferences"})}),h==="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)(z,{className:"h-12 w-12 mr-4 border",children:[(0,e.jsx)(B,{src:o.photos?.[0]?.value,alt:"Profile picture"}),(0,e.jsx)(G,{children:o.displayName?.split(" ").map(u=>u[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.jsxs)("div",{className:"space-y-2.5",children:[o.emails.map((u,L)=>{let me=(o?.verifications||[]).find(le=>le.email===u.value)?.verified===!0,pe=k[u.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:u.value}),(0,e.jsx)("div",{className:"mt-1",children:me?(0,e.jsx)(ae,{className:"text-xs rounded-full px-2.5 py-0.5 bg-green-100 text-green-800 border border-green-300 dark:bg-green-500/20 dark:text-green-200 dark:border-green-400/40",children:"Verified"}):(0,e.jsx)(ae,{className:"text-xs rounded-full px-2.5 py-0.5 bg-amber-100 text-amber-800 border border-amber-300 dark:bg-amber-500/20 dark:text-amber-200 dark:border-amber-400/40",children:"Not verified"})})]}),(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[L===0&&(0,e.jsx)(ae,{variant:"outline",className:"text-xs bg-muted text-foreground hover:bg-muted",children:"Primary"}),!me&&(0,e.jsx)(e.Fragment,{children:D===u.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:pe,onChange:le=>M(Xe=>({...Xe,[u.value]:le.target.value}))}),(0,e.jsx)("button",{className:"h-7 rounded-md border border-border px-2 text-xs",onClick:async()=>{d&&await d(u.value,pe)},children:"Verify"}),(0,e.jsx)("button",{className:"h-7 rounded-md border border-border px-2 text-xs",onClick:()=>N(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()=>{c&&await c(u.value),N(u.value)},children:"Send code"})})})]})]},u.value)}),(0,e.jsx)("div",{className:"mt-2",children:S?(0,e.jsx)("div",{className:"max-w-md",children:(0,e.jsxs)(U,{children:[(0,e.jsxs)(Ae,{children:[(0,e.jsx)(Ve,{children:"Add email address"}),(0,e.jsx)(Le,{children:"You'll need to verify this email address before it can be added to your account."})]}),(0,e.jsx)(j,{children:(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)(Oe,{htmlFor:"new-email",children:"Email address"}),(0,e.jsx)(ze,{id:"new-email",placeholder:"Enter your email address",value:l,onChange:u=>f(u.target.value),onKeyDown:async u=>{if(u.key==="Enter"){let L=String(l||"").trim().toLowerCase();if(!L)return;b&&await b(L),n(!1),f("")}}})]})}),(0,e.jsxs)(Ee,{className:"justify-end gap-2",children:[(0,e.jsx)(v,{variant:"ghost",onClick:()=>{n(!1),f("")},children:"Cancel"}),(0,e.jsx)(v,{onClick:async()=>{let u=String(l||"").trim().toLowerCase();u&&(b&&await b(u),n(!1),f(""))},children:"Add"})]})]})}):(0,e.jsx)(v,{variant:"outline",size:"sm",className:"text-xs",onClick:()=>n(!0),children:"Add email"})})]})]}),(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)})]})]}):h==="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 H=require("lucide-react"),p=require("react/jsx-runtime"),ct=t=>t&&String(t).trim().split(/\s+/).slice(0,2).map(c=>c[0]?.toUpperCase()).join("")||"?",je=({trigger:t,user:o,className:r,onManageAccount:c,onSignout:d,links:b=[],side:x="bottom",align:R="end",sideOffset:h=8,modal:y=!1})=>{let D=o?.emails?.[0]?.value||o?.email||"",N=o?.displayName||o?.name||"",k=o?.photos?.[0]?.value||o?.avatar||"",M=n=>{if(n.onClick)return n.onClick();n.href&&(n.href.startsWith("http")?window.open(n.href,"_blank"):window.location.assign(n.href))},S=H.ExternalLink;return(0,p.jsxs)(Z,{modal:y,children:[(0,p.jsx)(ee,{asChild:!0,children:t}),(0,p.jsxs)(te,{align:R,side:x,sideOffset:h,className:i("w-72 p-2 overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md",r),children:[(0,p.jsxs)("div",{className:"flex items-center gap-3 px-4 pt-4 pb-3",children:[(0,p.jsxs)(z,{className:"h-9 w-9 rounded-full",children:[(0,p.jsx)(B,{src:k,alt:N}),(0,p.jsx)(G,{className:"rounded-full",children:ct(N)})]}),(0,p.jsxs)("div",{className:"min-w-0",children:[(0,p.jsx)("div",{className:"text-sm font-semibold truncate",children:N}),(0,p.jsx)("div",{className:"text-xs text-muted-foreground truncate",children:D})]})]}),(0,p.jsx)(O,{}),(0,p.jsxs)(I,{className:"cursor-pointer py-2",onClick:()=>c?.(),children:[(0,p.jsx)(H.Settings,{className:"mr-2 h-4 w-4"}),(0,p.jsx)("span",{children:"Manage account"})]}),b.map((n,l)=>{let f=n.icon??S;return(0,p.jsxs)(I,{className:"cursor-pointer py-2",onClick:()=>M(n),children:[(0,p.jsx)(f,{className:"mr-2 h-4 w-4"}),(0,p.jsx)("span",{children:n.label})]},`${n.label}-${l}`)}),(0,p.jsx)(O,{}),(0,p.jsxs)(I,{className:"cursor-pointer py-2 rounded-md font-semibold text-red-600 dark:text-red-300 hover:bg-red-50 hover:text-red-700 focus:bg-red-50 focus:text-red-700 dark:hover:bg-red-500/20 dark:focus:bg-red-500/25 dark:hover:text-red-100 dark:focus:text-red-100 border border-transparent dark:border-red-500/30 ring-0 focus-visible:ring-2 focus-visible:ring-red-400/40 dark:focus-visible:ring-red-400/40",onClick:()=>d?.(),children:[(0,p.jsx)(H.LogOut,{className:"mr-2 h-4 w-4 text-red-600 dark:text-red-300"}),(0,p.jsx)("span",{children:"Sign out"})]})]})]})};var Ke=require("lucide-react");var He=require("class-variance-authority");var se=require("react/jsx-runtime"),mt=(0,He.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 ne({className:t,variant:o,...r}){return(0,se.jsx)("div",{"data-slot":"alert",role:"alert",className:i(mt({variant:o}),t),...r})}function $e({className:t,...o}){return(0,se.jsx)("div",{"data-slot":"alert-title",className:i("col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight",t),...o})}function ie({className:t,...o}){return(0,se.jsx)("div",{"data-slot":"alert-description",className:i("text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",t),...o})}var A=require("react/jsx-runtime"),We=t=>{let o=t.title??"Placeholder Alert",r=t.description??"This is a placeholder alert.";return(0,A.jsx)("div",{className:"grid w-full max-w-xl items-start gap-4",children:(0,A.jsxs)(ne,{children:[(0,A.jsx)(F,{Icon:Ke.CheckCircle2Icon}),(0,A.jsx)($e,{children:o}),(0,A.jsx)(ie,{children:r})]})})};var V=require("react");var $=require("lucide-react"),s=require("react/jsx-runtime"),qe=({onValidate:t})=>{let[o,r]=(0,V.useState)(["","","","","",""]),[c,d]=(0,V.useState)(!1),[b,x]=(0,V.useState)(""),[R,h]=(0,V.useState)(!1),y=(0,V.useRef)([]),D=(n,l)=>{if(!/^\d*$/.test(l))return;let f=[...o];f[n]=l.slice(-1),r(f),x(""),h(!1),l&&n<5&&y.current[n+1]?.focus()},N=(n,l)=>{l.key==="Backspace"&&!o[n]&&n>0&&y.current[n-1]?.focus(),l.key==="v"&&(l.ctrlKey||l.metaKey)&&(l.preventDefault(),navigator.clipboard.readText().then(f=>{let W=f.replace(/\D/g,"").slice(0,6).split(""),q=[...o];W.forEach((L,de)=>{de<6&&(q[de]=L)}),r(q);let u=Math.min(W.length,5);y.current[u]?.focus()}))},k=async()=>{let n=o.join("");if(n.length!==6){x("Please enter all 6 digits");return}d(!0),x("");try{await t(n),h(!0)}catch{x("Invalid TOTP code. Please try again.")}finally{d(!1)}},M=n=>{n.preventDefault(),k()},S=()=>{r(["","","","","",""]),x(""),h(!1),d(!1),y.current[0]?.focus()};return R?(0,s.jsx)("div",{className:"max-w-md mx-auto",children:(0,s.jsx)(U,{className:"border-green-200 bg-green-50",children:(0,s.jsx)(j,{className:"pt-6",children:(0,s.jsxs)("div",{className:"text-center space-y-4",children:[(0,s.jsx)("div",{className:"mx-auto w-16 h-16 bg-green-100 rounded-full flex items-center justify-center",children:(0,s.jsx)($.CheckCircle,{className:"w-8 h-8 text-green-600"})}),(0,s.jsxs)("div",{children:[(0,s.jsx)("h3",{className:"text-lg font-semibold text-green-900",children:"Verification Successful!"}),(0,s.jsx)("p",{className:"text-sm text-green-700 mt-1",children:"Your TOTP code has been validated."})]}),(0,s.jsx)(v,{onClick:S,variant:"outline",className:"bg-white",children:"Verify Another Code"})]})})})}):(0,s.jsx)("div",{className:"max-w-md mx-auto",children:(0,s.jsx)(U,{children:(0,s.jsx)(j,{className:"pt-6",children:(0,s.jsxs)("div",{className:"text-center space-y-6",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"mx-auto w-12 h-12 bg-blue-100 rounded-full flex items-center justify-center mb-4",children:(0,s.jsx)($.Shield,{className:"w-6 h-6 text-blue-600"})}),(0,s.jsx)("h3",{className:"text-lg font-semibold",children:"Enter Verification Code"}),(0,s.jsx)("p",{className:"text-sm text-muted-foreground mt-1",children:"Enter the 6-digit code from your authenticator app"})]}),(0,s.jsxs)("form",{onSubmit:M,className:"space-y-6",children:[(0,s.jsx)("div",{className:"flex justify-center gap-2",children:o.map((n,l)=>(0,s.jsx)(U,{className:"w-12 h-14 border-2 focus-within:border-blue-500 transition-colors",children:(0,s.jsx)(j,{className:"p-0 h-full flex items-center justify-center",children:(0,s.jsx)("input",{ref:f=>{y.current[l]=f},type:"tel",inputMode:"numeric",maxLength:1,value:n,onChange:f=>D(l,f.target.value),onKeyDown:f=>N(l,f),className:"w-full h-full text-center text-2xl font-bold border-none outline-none bg-transparent",autoComplete:"one-time-code",disabled:c,style:{height:"auto"}})})},l))}),b&&(0,s.jsxs)(ne,{variant:"destructive",children:[(0,s.jsx)($.AlertCircle,{className:"h-4 w-4"}),(0,s.jsx)(ie,{children:b})]}),(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsx)(v,{type:"submit",className:"w-full",disabled:c||o.some(n=>n===""),children:c?"Verifying...":"Verify Code"}),(0,s.jsx)(v,{type:"button",variant:"ghost",size:"sm",onClick:S,className:"w-full text-xs",children:"Clear Code"})]})]}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:"Codes refresh every 30 seconds"})]})})})})};
|
|
3
3
|
//# sourceMappingURL=index.js.map
|