@authdog/react-elements 0.0.45 → 0.0.46
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 +7 -1
- package/dist/index.d.ts +7 -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 +1 -1
- package/src/components/core/navbar.tsx +12 -3
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import*as fe from"react";import{Slot as ze}from"@radix-ui/react-slot";import{cva as Be}from"class-variance-authority";import{clsx as Ve}from"clsx";import{twMerge as Le}from"tailwind-merge";function a(...e){return Le(Ve(e))}import{jsx as Oe}from"react/jsx-runtime";var Ge=Be("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"}}),h=fe.forwardRef(({className:e,variant:t,size:r,asChild:i=!1,...f},u)=>Oe(i?ze:"button",{className:a(Ge({variant:t,size:r,className:e})),ref:u,...f}));h.displayName="Button";import{useEffect as Fe,useState as _e}from"react";import{Fragment as je,jsx as Ue}from"react/jsx-runtime";var We=({children:e})=>{let[t,r]=_e(!1);return Fe(()=>{r(!0)},[]),t?Ue(je,{children:e}):null};import{useState as we}from"react";import{User as vt,LogOut as gt,Menu as bt}from"lucide-react";import*as O from"@radix-ui/react-avatar";import{jsx as ae}from"react/jsx-runtime";function F({className:e,...t}){return ae(O.Root,{"data-slot":"avatar",className:a("relative flex size-8 shrink-0 overflow-hidden rounded-full",e),...t})}function _({className:e,...t}){return ae(O.Image,{"data-slot":"avatar-image",className:a("aspect-square size-full",e),...t})}function W({className:e,...t}){return ae(O.Fallback,{"data-slot":"avatar-fallback",className:a("bg-muted flex size-full items-center justify-center rounded-full",e),...t})}import*as C from"react";import*as n from"@radix-ui/react-dropdown-menu";import{Check as He,ChevronRight as Ke,Circle as $e}from"lucide-react";import{jsx as b,jsxs as se}from"react/jsx-runtime";var Ye=He,qe=$e,Xe=Ke;function X({...e}){return b(n.Root,{"data-slot":"dropdown-menu",...e})}var j=C.forwardRef(({...e},t)=>b(n.Trigger,{ref:t,"data-slot":"dropdown-menu-trigger",...e}));j.displayName=n.Trigger.displayName;var q=C.forwardRef(({className:e,sideOffset:t=4,...r},i)=>b(n.Portal,{children:b(n.Content,{ref:i,"data-slot":"dropdown-menu-content",sideOffset:t,className:a("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})}));q.displayName=n.Content.displayName;var ne=C.forwardRef(({...e},t)=>b(n.Group,{ref:t,"data-slot":"dropdown-menu-group",...e}));ne.displayName=n.Group.displayName;var E=C.forwardRef(({className:e,inset:t,variant:r="default",...i},f)=>b(n.Item,{ref:f,"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":r,className:a("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),...i}));E.displayName=n.Item.displayName;var Je=C.forwardRef(({className:e,children:t,checked:r,...i},f)=>se(n.CheckboxItem,{ref:f,"data-slot":"dropdown-menu-checkbox-item",className:a("focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),checked:r,...i,children:[b("span",{className:"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",children:b(n.ItemIndicator,{children:b(Ye,{className:"size-4"})})}),t]}));Je.displayName=n.CheckboxItem.displayName;var Qe=C.forwardRef(({...e},t)=>b(n.RadioGroup,{ref:t,"data-slot":"dropdown-menu-radio-group",...e}));Qe.displayName=n.RadioGroup.displayName;var Ze=C.forwardRef(({className:e,children:t,...r},i)=>se(n.RadioItem,{ref:i,"data-slot":"dropdown-menu-radio-item",className:a("focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...r,children:[b("span",{className:"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",children:b(n.ItemIndicator,{children:b(qe,{className:"size-2 fill-current"})})}),t]}));Ze.displayName=n.RadioItem.displayName;var ie=C.forwardRef(({className:e,inset:t,...r},i)=>b(n.Label,{ref:i,"data-slot":"dropdown-menu-label","data-inset":t,className:a("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",e),...r}));ie.displayName=n.Label.displayName;var z=C.forwardRef(({className:e,...t},r)=>b(n.Separator,{ref:r,"data-slot":"dropdown-menu-separator",className:a("bg-border -mx-1 my-1 h-px",e),...t}));z.displayName=n.Separator.displayName;var et=C.forwardRef(({className:e,...t},r)=>b("span",{ref:r,"data-slot":"dropdown-menu-shortcut",className:a("text-muted-foreground ml-auto text-xs tracking-widest",e),...t}));et.displayName="DropdownMenuShortcut";var tt=C.forwardRef(({className:e,inset:t,children:r,...i},f)=>se(n.SubTrigger,{ref:f,"data-slot":"dropdown-menu-sub-trigger","data-inset":t,className:a("focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[inset]:pl-8",e),...i,children:[r,b(Xe,{className:"ml-auto size-4"})]}));tt.displayName=n.SubTrigger.displayName;var ot=C.forwardRef(({className:e,...t},r)=>b(n.SubContent,{ref:r,"data-slot":"dropdown-menu-sub-content",className:a("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 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg",e),...t}));ot.displayName=n.SubContent.displayName;import*as y from"@radix-ui/react-dialog";import{X as rt}from"lucide-react";import{jsx as B,jsxs as de}from"react/jsx-runtime";var at=rt;function ve({...e}){return B(y.Root,{"data-slot":"sheet",...e})}function ge({...e}){return B(y.Trigger,{"data-slot":"sheet-trigger",...e})}function nt({...e}){return B(y.Portal,{"data-slot":"sheet-portal",...e})}function it({className:e,...t}){return B(y.Overlay,{"data-slot":"sheet-overlay",className:a("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 be({className:e,children:t,side:r="right",...i}){return de(nt,{children:[B(it,{}),de(y.Content,{"data-slot":"sheet-content",className:a("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),...i,children:[t,de(y.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:[B(at,{className:"size-4"}),B("span",{className:"sr-only",children:"Close"})]})]})]})}import{useEffect as st,useState as dt}from"react";import{jsx as le}from"react/jsx-runtime";var lt={className:"mr-2 h-4 w-4","aria-hidden":"true"},U=({Icon:e})=>{let[t,r]=dt(!1);return st(()=>{r(!0)},[]),le("span",{className:"inline-flex items-center justify-center",children:t?le(e,{...lt}):le("span",{className:"mr-2 h-4 w-4","aria-hidden":"true"})})};import{useEffect as mt,useState as ct}from"react";import{Sun as pt,Moon as ut}from"lucide-react";import{jsx as me}from"react/jsx-runtime";var he="authdog-theme",ft=()=>{if(typeof window>"u")return"light";let e=window.localStorage.getItem(he);return e==="light"||e==="dark"?e:window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"},xe=e=>{document.documentElement.classList.toggle("dark",e==="dark")},ye=()=>{let[e,t]=ct("light");return mt(()=>{let i=ft();xe(i),t(i)},[]),me(h,{variant:"ghost",size:"icon","aria-label":e==="dark"?"Switch to light theme":"Switch to dark theme",onClick:()=>{let i=e==="dark"?"light":"dark";xe(i);try{window.localStorage.setItem(he,i)}catch{}t(i)},children:e==="dark"?me(pt,{className:"h-4 w-4"}):me(ut,{className:"h-4 w-4"})})};import{Fragment as Ne,jsx as s,jsxs as R}from"react/jsx-runtime";function xt({items:e=[],children:t,className:r,logoText:i="ACME Corp",logoSrc:f,user:u={name:"John Doe",email:"john@example.com",image:"https://i.pravatar.cc/150?u=a042581f4e29026704d"},onNavigateHome:N=()=>console.log("Navigating to home"),onNavItemClick:L=M=>console.log(`Navigating to ${M}`),onProfileSelected:P,onLogout:k=()=>console.log("Logout clicked"),isLoading:D=!1,identityHost:S="https://stg-id.authdog.xyz",environmentId:I="58be35b0-708f-49f6-84f0-6695d307d997"}){let[M,T]=we(!1),[l,p]=we(!1),g=u!=null&&u.id!==null&&u.id!==void 0;return s("header",{className:a("w-full border-b bg-background",r),children:R("div",{className:a("mx-auto flex h-16 w-full max-w-6xl items-center justify-between px-4 md:px-6"),children:[R("div",{className:"flex items-center gap-3 md:gap-4",children:[R("button",{type:"button",onClick:N,className:a("group inline-flex items-center gap-2 md:gap-3 rounded-md px-1 py-1 text-left","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background"),"aria-label":"Go to homepage",children:[f&&!l&&s("span",{className:"inline-flex h-8 w-8 items-center justify-center overflow-hidden rounded-md bg-muted/80 ring-1 ring-border",children:s("img",{src:f,alt:i,className:"h-7 w-7 object-contain",onError:()=>p(!0)})}),s("span",{className:"text-base font-semibold tracking-tight md:text-lg group-hover:text-primary",children:i})]}),t]}),R("div",{className:"flex flex-1 items-center justify-end gap-6",children:[s("nav",{className:"hidden md:flex items-center gap-6",children:e?.map((x,v)=>s("span",{onClick:()=>{x.disabled||L(x.href)},className:a("text-sm font-medium transition-colors hover:text-primary cursor-pointer",x.disabled&&"cursor-not-allowed opacity-80"),children:x.title},v))}),R("div",{className:"flex items-center gap-3",children:[R(ve,{open:M,onOpenChange:T,children:[s(ge,{asChild:!0,children:s(h,{variant:"ghost",size:"icon",className:"md:hidden","aria-label":"Open Menu",children:s(U,{Icon:bt})})}),s(be,{side:"left",className:"pr-0",children:s("nav",{className:"grid gap-2 py-6",children:e?.map((x,v)=>s("a",{href:x.href,className:a("flex w-full items-center rounded-md px-3 py-2 text-sm font-medium hover:bg-accent",x.disabled&&"cursor-not-allowed opacity-80"),onClick:()=>T(!1),children:x.title},v))})})]}),s(ye,{}),g?R(X,{children:[s(j,{asChild:!0,children:s(h,{variant:"ghost",className:"relative h-8 w-8 rounded-full",disabled:D,children:s(F,{className:"h-8 w-8",children:D?s("div",{className:"h-8 w-8 animate-pulse bg-muted rounded-full"}):R(Ne,{children:[s(_,{src:u.photos?.[0]?.value||"/placeholder.svg",alt:u.displayName}),s(W,{children:u.displayName?.charAt(0)})]})})})}),s(q,{className:"w-56",align:"end",forceMount:!0,children:D?R("div",{className:"p-4",children:[s("div",{className:"h-4 w-3/4 animate-pulse bg-muted rounded mb-2"}),s("div",{className:"h-3 w-1/2 animate-pulse bg-muted rounded"})]}):R(Ne,{children:[s(ie,{className:"font-normal",children:R("div",{className:"flex flex-col space-y-1",children:[s("p",{className:"text-sm font-medium leading-none",children:u.displayName}),s("p",{className:"text-xs leading-none text-muted-foreground",children:u.emails?.[0]?.value})]})}),s(z,{}),s(ne,{children:R(E,{onClick:P,children:[s(U,{Icon:vt}),s("span",{children:"Profile"})]})}),s(z,{}),R(E,{onClick:k,children:[s(U,{Icon:gt}),s("span",{children:"Log out"})]})]})})]}):s(h,{variant:"default","aria-label":"Sign in",onClick:()=>{if(!I)throw new Error("Environment ID is required");if(!S)throw new Error("Identity Host is required");let x=`${S}/signin/${I}`;window.open(x,"_blank")},children:"Sign in"})]})]})]})})}import{useEffect as Te,useState as Y}from"react";import{Slot as ht}from"@radix-ui/react-slot";import{cva as yt}from"class-variance-authority";import{jsx as Nt}from"react/jsx-runtime";var wt=yt("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 J({className:e,variant:t,asChild:r=!1,...i}){return Nt(r?ht:"span",{"data-slot":"badge",className:a(wt({variant:t}),e),...i})}import{jsx as $}from"react/jsx-runtime";function H({className:e,...t}){return $("div",{"data-slot":"card",className:a("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",e),...t})}function Pe({className:e,...t}){return $("div",{"data-slot":"card-header",className:a("@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",e),...t})}function Ce({className:e,...t}){return $("div",{"data-slot":"card-title",className:a("leading-none font-semibold",e),...t})}function Re({className:e,...t}){return $("div",{"data-slot":"card-description",className:a("text-muted-foreground text-sm",e),...t})}function K({className:e,...t}){return $("div",{"data-slot":"card-content",className:a("px-6",e),...t})}function ke({className:e,...t}){return $("div",{"data-slot":"card-footer",className:a("flex items-center px-6 [.border-t]:pt-6",e),...t})}import{jsx as Pt}from"react/jsx-runtime";function Me({className:e,type:t,...r}){return Pt("input",{type:t,"data-slot":"input",className:a("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",e),...r})}import*as De from"@radix-ui/react-label";import{jsx as Ct}from"react/jsx-runtime";function Se({className:e,...t}){return Ct(De.Root,{"data-slot":"label",className:a("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",e),...t})}import{User as Rt}from"lucide-react";import{Fragment as Ie,jsx as o,jsxs as d}from"react/jsx-runtime";var kt=({loading:e,user:t,handleAuthenticated:r,onRequestEmailVerification:i,onVerifyEmail:f,onAddEmail:u})=>{let[N,L]=Y(!1),[P,k]=Y("profile"),[D,S]=Y(null),[I,M]=Y({}),[T,l]=Y(!1),[p,g]=Y("");Te(()=>{L(!0)},[]),Te(()=>{!e&&r&&r()},[e,t,r]);let x={className:"mr-2 h-4 w-4","aria-hidden":"true"},v=m=>N?o(m,{...x}):null;return!N||e?o("div",{children:"Loading..."}):t?d("div",{className:"grid grid-cols-[14rem,1fr] w-full bg-transparent",children:[d("div",{className:"h-full border-r border-border p-3 md:p-4 bg-transparent flex flex-col min-w-0",children:[d("div",{className:"mb-3 md:mb-4",children:[o("h1",{className:"text-xl font-bold text-foreground",children:"Account"}),o("p",{className:"text-sm text-muted-foreground",children:"Manage your account info."})]}),o("nav",{className:"space-y-1 flex-1",children:d("button",{onClick:()=>k("profile"),className:`flex items-center w-full px-3 py-2 text-sm rounded-md ${P==="profile"?"bg-muted text-foreground":"text-muted-foreground hover:bg-muted/50"}`,children:[v(Rt),"Profile"]})})]}),d("div",{className:"h-full p-3 md:p-5 min-w-0 bg-transparent",children:[o("div",{className:"flex justify-between items-center mb-3 md:mb-4",children:o("h2",{className:"text-xl font-semibold text-foreground",children:P==="profile"?"Profile details":P==="security"?"Security settings":"Preferences"})}),P==="profile"?d("div",{className:"space-y-5 md:space-y-6",children:[d("div",{children:[o("h3",{className:"text-sm font-medium mb-3 text-foreground",children:"Profile"}),o("div",{className:"flex items-center justify-between",children:d("div",{className:"flex items-center",children:[d(F,{className:"h-12 w-12 mr-4 border",children:[o(_,{src:t.photos?.[0]?.value,alt:"Profile picture"}),o(W,{children:t.displayName?.split(" ").map(m=>m[0]).join("")})]}),o("span",{className:"font-medium text-foreground",children:t.displayName})]})})]}),d("div",{children:[o("h3",{className:"text-sm font-medium mb-3 text-foreground",children:"Email addresses"}),d("div",{className:"space-y-2.5",children:[t.emails.map((m,A)=>{let pe=(t?.verifications||[]).find(re=>re.email===m.value)?.verified===!0,ue=I[m.value]||"";return d("div",{className:"flex items-start justify-between gap-2",children:[d("div",{className:"flex flex-col",children:[o("span",{className:"text-foreground",children:m.value}),o("div",{className:"mt-1",children:pe?o(J,{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"}):o(J,{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"})})]}),d("div",{className:"flex items-center gap-2",children:[A===0&&o(J,{variant:"outline",className:"text-xs bg-muted text-foreground hover:bg-muted",children:"Primary"}),!pe&&o(Ie,{children:D===m.value?d("div",{className:"flex items-center gap-1",children:[o("input",{className:"h-7 w-24 text-sm rounded-md border border-border bg-background px-2 text-foreground",placeholder:"Code",value:ue,onChange:re=>M(Ee=>({...Ee,[m.value]:re.target.value}))}),o("button",{className:"h-7 rounded-md border border-border px-2 text-xs",onClick:async()=>{f&&await f(m.value,ue)},children:"Verify"}),o("button",{className:"h-7 rounded-md border border-border px-2 text-xs",onClick:()=>S(null),children:"Cancel"})]}):o(Ie,{children:o("button",{className:"h-7 rounded-md border border-border px-2 text-xs",onClick:async()=>{i&&await i(m.value),S(m.value)},children:"Send code"})})})]})]},m.value)}),o("div",{className:"mt-2",children:T?o("div",{className:"max-w-md",children:d(H,{children:[d(Pe,{children:[o(Ce,{children:"Add email address"}),o(Re,{children:"You'll need to verify this email address before it can be added to your account."})]}),o(K,{children:d("div",{className:"space-y-2",children:[o(Se,{htmlFor:"new-email",children:"Email address"}),o(Me,{id:"new-email",placeholder:"Enter your email address",value:p,onChange:m=>g(m.target.value),onKeyDown:async m=>{if(m.key==="Enter"){let A=String(p||"").trim().toLowerCase();if(!A)return;u&&await u(A),l(!1),g("")}}})]})}),d(ke,{className:"justify-end gap-2",children:[o(h,{variant:"ghost",onClick:()=>{l(!1),g("")},children:"Cancel"}),o(h,{onClick:async()=>{let m=String(p||"").trim().toLowerCase();m&&(u&&await u(m),l(!1),g(""))},children:"Add"})]})]})}):o(h,{variant:"outline",size:"sm",className:"text-xs",onClick:()=>l(!0),children:"Add email"})})]})]}),d("div",{children:[o("h3",{className:"text-sm font-medium mb-3 text-gray-900 dark:text-gray-100",children:"Connected accounts"}),o("div",{className:"space-y-2.5",children:d("div",{className:"flex items-center justify-between",children:[o("div",{className:"flex items-center",children:o("div",{className:"mr-2",children:o("span",{className:"text-gray-900 dark:text-gray-100",children:t.provider})})}),o("span",{className:"text-sm text-gray-500 dark:text-gray-400",children:t?.emails?.[0]?.value})]},t.provider)})]})]}):P==="security"?d("div",{className:"space-y-5 md:space-y-6",children:[o("div",{className:"border rounded-md overflow-hidden",children:d("div",{className:"flex items-center justify-between px-4 py-3",children:[o("div",{className:"text-sm text-gray-700 dark:text-gray-300",children:"Password"}),o("button",{className:"text-sm text-indigo-600 hover:underline",children:"Set password"})]})}),o("div",{className:"border rounded-md overflow-hidden",children:d("div",{className:"flex items-center justify-between px-4 py-3",children:[o("div",{className:"text-sm text-gray-700 dark:text-gray-300",children:"Passkeys"}),o("button",{className:"text-sm text-indigo-600 hover:underline",children:"+\xA0Add a passkey"})]})}),o("div",{className:"border rounded-md overflow-hidden",children:d("div",{className:"flex items-center justify-between px-4 py-3",children:[o("div",{className:"text-sm text-gray-700 dark:text-gray-300",children:"Two-step verification"}),o("button",{className:"text-sm text-indigo-600 hover:underline",children:"+\xA0Add two-step verification"})]})}),d("div",{className:"border rounded-md overflow-hidden",children:[o("div",{className:"px-4 py-3 border-b text-sm font-medium text-gray-900 dark:text-gray-100",children:"Active devices"}),o("div",{className:"p-4 space-y-3",children:d("div",{className:"text-sm",children:[d("div",{className:"flex items-center gap-2",children:[o("span",{className:"inline-block h-5 w-5 rounded-sm bg-gray-900 dark:bg-white"}),o("span",{className:"font-medium",children:"X11"}),o("span",{className:"text-xs rounded-md border px-2 py-0.5 text-gray-600 dark:text-gray-300",children:"This device"})]}),o("div",{className:"text-gray-600 dark:text-gray-400 mt-1",children:"Firefox 142.0"}),o("div",{className:"text-gray-600 dark:text-gray-400",children:"127.0.0.1 (Local), (Your City)"}),o("div",{className:"text-gray-600 dark:text-gray-400",children:"Today at 7:08 PM"})]})})]}),o("div",{className:"border rounded-md overflow-hidden",children:d("div",{className:"flex items-center justify-between px-4 py-3",children:[o("div",{className:"text-sm text-gray-700 dark:text-gray-300",children:"Delete account"}),o("button",{className:"text-sm text-red-600 hover:underline",children:"Delete account"})]})})]}):o("div",{className:"space-y-5 md:space-y-6",children:d("div",{children:[o("h3",{className:"text-sm font-medium mb-3 text-gray-900 dark:text-gray-100",children:"Preferences"}),d("div",{className:"space-y-3 text-sm",children:[d("div",{className:"flex items-center justify-between",children:[o("span",{className:"text-gray-700 dark:text-gray-300",children:"Locale"}),o("span",{className:"text-gray-500 dark:text-gray-400",children:"Auto"})]}),d("div",{className:"flex items-center justify-between",children:[o("span",{className:"text-gray-700 dark:text-gray-300",children:"Theme"}),o("span",{className:"text-gray-500 dark:text-gray-400",children:"System"})]})]})]})})]})]}):o("div",{children:"No user"})};import{LogOut as Mt,Settings as Dt,ExternalLink as St}from"lucide-react";import{jsx as w,jsxs as V}from"react/jsx-runtime";var Tt=e=>e&&String(e).trim().split(/\s+/).slice(0,2).map(i=>i[0]?.toUpperCase()).join("")||"?",It=({trigger:e,user:t,className:r,onManageAccount:i,onSignout:f,links:u=[],side:N="bottom",align:L="end",sideOffset:P=8,modal:k=!1,triggerAsChild:D=!1,triggerWrapperClassName:S})=>{let I=t?.emails?.[0]?.value||t?.email||"",M=t?.displayName||t?.name||"",T=t?.photos?.[0]?.value||t?.avatar||"",l=v=>{if(v.onClick)return v.onClick();v.href&&(v.href.startsWith("http")?window.open(v.href,"_blank"):window.location.assign(v.href))},p=St,g=Dt,x=Mt;return V(X,{modal:k,children:[D?w(j,{asChild:!0,children:e}):w(j,{className:a("inline-flex items-center justify-center bg-transparent p-0 border-0 outline-none focus-visible:outline-none",S),children:e}),V(q,{align:L,side:N,sideOffset:P,className:a("w-72 p-2 overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md",r),children:[V("div",{className:"flex items-center gap-3 px-4 pt-4 pb-3",children:[V(F,{className:"h-9 w-9 rounded-full",children:[w(_,{src:T,alt:M}),w(W,{className:"rounded-full",children:Tt(M)})]}),V("div",{className:"min-w-0",children:[w("div",{className:"text-sm font-semibold truncate",children:M}),w("div",{className:"text-xs text-muted-foreground truncate",children:I})]})]}),w(z,{}),V(E,{className:"cursor-pointer py-2",onClick:()=>i?.(),children:[w(g,{className:"mr-2 h-4 w-4"}),w("span",{children:"Manage account"})]}),u.map((v,m)=>{let A=v.icon??p;return V(E,{className:"cursor-pointer py-2",onClick:()=>l(v),children:[w(A,{className:"mr-2 h-4 w-4"}),w("span",{children:v.label})]},`${v.label}-${m}`)}),w(z,{}),V(E,{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:()=>f?.(),children:[w(x,{className:"mr-2 h-4 w-4 text-red-600 dark:text-red-300"}),w("span",{children:"Sign out"})]})]})]})};import{CheckCircle2Icon as Vt}from"lucide-react";import{cva as At}from"class-variance-authority";import{jsx as ce}from"react/jsx-runtime";var Et=At("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 Q({className:e,variant:t,...r}){return ce("div",{"data-slot":"alert",role:"alert",className:a(Et({variant:t}),e),...r})}function Ae({className:e,...t}){return ce("div",{"data-slot":"alert-title",className:a("col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight",e),...t})}function Z({className:e,...t}){return ce("div",{"data-slot":"alert-description",className:a("text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",e),...t})}import{jsx as ee,jsxs as zt}from"react/jsx-runtime";var Lt=e=>{let t=e.title??"Placeholder Alert",r=e.description??"This is a placeholder alert.";return ee("div",{className:"grid w-full max-w-xl items-start gap-4",children:zt(Q,{children:[ee(U,{Icon:Vt}),ee(Ae,{children:t}),ee(Z,{children:r})]})})};import{useState as te,useRef as Bt}from"react";import{Shield as Gt,CheckCircle as Ot,AlertCircle as Ft}from"lucide-react";import{jsx as c,jsxs as G}from"react/jsx-runtime";var _t=({onValidate:e})=>{let[t,r]=te(["","","","","",""]),[i,f]=te(!1),[u,N]=te(""),[L,P]=te(!1),k=Bt([]),D=(l,p)=>{if(!/^\d*$/.test(p))return;let g=[...t];g[l]=p.slice(-1),r(g),N(""),P(!1),p&&l<5&&k.current[l+1]?.focus()},S=(l,p)=>{p.key==="Backspace"&&!t[l]&&l>0&&k.current[l-1]?.focus(),p.key==="v"&&(p.ctrlKey||p.metaKey)&&(p.preventDefault(),navigator.clipboard.readText().then(g=>{let x=g.replace(/\D/g,"").slice(0,6).split(""),v=[...t];x.forEach((A,oe)=>{oe<6&&(v[oe]=A)}),r(v);let m=Math.min(x.length,5);k.current[m]?.focus()}))},I=async()=>{let l=t.join("");if(l.length!==6){N("Please enter all 6 digits");return}f(!0),N("");try{await e(l),P(!0)}catch{N("Invalid TOTP code. Please try again.")}finally{f(!1)}},M=l=>{l.preventDefault(),I()},T=()=>{r(["","","","","",""]),N(""),P(!1),f(!1),k.current[0]?.focus()};return L?c("div",{className:"max-w-md mx-auto",children:c(H,{className:"border-green-200 bg-green-50",children:c(K,{className:"pt-6",children:G("div",{className:"text-center space-y-4",children:[c("div",{className:"mx-auto w-16 h-16 bg-green-100 rounded-full flex items-center justify-center",children:c(Ot,{className:"w-8 h-8 text-green-600"})}),G("div",{children:[c("h3",{className:"text-lg font-semibold text-green-900",children:"Verification Successful!"}),c("p",{className:"text-sm text-green-700 mt-1",children:"Your TOTP code has been validated."})]}),c(h,{onClick:T,variant:"outline",className:"bg-white",children:"Verify Another Code"})]})})})}):c("div",{className:"max-w-md mx-auto",children:c(H,{children:c(K,{className:"pt-6",children:G("div",{className:"text-center space-y-6",children:[G("div",{children:[c("div",{className:"mx-auto w-12 h-12 bg-blue-100 rounded-full flex items-center justify-center mb-4",children:c(Gt,{className:"w-6 h-6 text-blue-600"})}),c("h3",{className:"text-lg font-semibold",children:"Enter Verification Code"}),c("p",{className:"text-sm text-muted-foreground mt-1",children:"Enter the 6-digit code from your authenticator app"})]}),G("form",{onSubmit:M,className:"space-y-6",children:[c("div",{className:"flex justify-center gap-2",children:t.map((l,p)=>c(H,{className:"w-12 h-14 border-2 focus-within:border-blue-500 transition-colors",children:c(K,{className:"p-0 h-full flex items-center justify-center",children:c("input",{ref:g=>{k.current[p]=g},type:"tel",inputMode:"numeric",maxLength:1,value:l,onChange:g=>D(p,g.target.value),onKeyDown:g=>S(p,g),className:"w-full h-full text-center text-2xl font-bold border-none outline-none bg-transparent",autoComplete:"one-time-code",disabled:i,style:{height:"auto"}})})},p))}),u&&G(Q,{variant:"destructive",children:[c(Ft,{className:"h-4 w-4"}),c(Z,{children:u})]}),G("div",{className:"space-y-3",children:[c(h,{type:"submit",className:"w-full",disabled:i||t.some(l=>l===""),children:i?"Verifying...":"Verify Code"}),c(h,{type:"button",variant:"ghost",size:"sm",onClick:T,className:"w-full text-xs",children:"Clear Code"})]})]}),c("p",{className:"text-xs text-muted-foreground",children:"Codes refresh every 30 seconds"})]})})})})};export{h as Button,We as ClientOnly,xt as Navbar,Lt as PlaceholderAlert,_t as TOTPValidator,It as UserDropdown,kt as UserProfile};
|
|
2
|
+
import*as fe from"react";import{Slot as ze}from"@radix-ui/react-slot";import{cva as Be}from"class-variance-authority";import{clsx as Ve}from"clsx";import{twMerge as Le}from"tailwind-merge";function a(...e){return Le(Ve(e))}import{jsx as Oe}from"react/jsx-runtime";var Ge=Be("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=fe.forwardRef(({className:e,variant:t,size:r,asChild:i=!1,...v},w)=>Oe(i?ze:"button",{className:a(Ge({variant:t,size:r,className:e})),ref:w,...v}));x.displayName="Button";import{useEffect as Fe,useState as _e}from"react";import{Fragment as je,jsx as Ue}from"react/jsx-runtime";var We=({children:e})=>{let[t,r]=_e(!1);return Fe(()=>{r(!0)},[]),t?Ue(je,{children:e}):null};import{useState as we}from"react";import{User as vt,LogOut as gt,Menu as bt}from"lucide-react";import*as O from"@radix-ui/react-avatar";import{jsx as ae}from"react/jsx-runtime";function F({className:e,...t}){return ae(O.Root,{"data-slot":"avatar",className:a("relative flex size-8 shrink-0 overflow-hidden rounded-full",e),...t})}function _({className:e,...t}){return ae(O.Image,{"data-slot":"avatar-image",className:a("aspect-square size-full",e),...t})}function W({className:e,...t}){return ae(O.Fallback,{"data-slot":"avatar-fallback",className:a("bg-muted flex size-full items-center justify-center rounded-full",e),...t})}import*as P from"react";import*as n from"@radix-ui/react-dropdown-menu";import{Check as He,ChevronRight as Ke,Circle as $e}from"lucide-react";import{jsx as b,jsxs as se}from"react/jsx-runtime";var Ye=He,qe=$e,Xe=Ke;function X({...e}){return b(n.Root,{"data-slot":"dropdown-menu",...e})}var j=P.forwardRef(({...e},t)=>b(n.Trigger,{ref:t,"data-slot":"dropdown-menu-trigger",...e}));j.displayName=n.Trigger.displayName;var q=P.forwardRef(({className:e,sideOffset:t=4,...r},i)=>b(n.Portal,{children:b(n.Content,{ref:i,"data-slot":"dropdown-menu-content",sideOffset:t,className:a("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})}));q.displayName=n.Content.displayName;var ne=P.forwardRef(({...e},t)=>b(n.Group,{ref:t,"data-slot":"dropdown-menu-group",...e}));ne.displayName=n.Group.displayName;var A=P.forwardRef(({className:e,inset:t,variant:r="default",...i},v)=>b(n.Item,{ref:v,"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":r,className:a("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),...i}));A.displayName=n.Item.displayName;var Je=P.forwardRef(({className:e,children:t,checked:r,...i},v)=>se(n.CheckboxItem,{ref:v,"data-slot":"dropdown-menu-checkbox-item",className:a("focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),checked:r,...i,children:[b("span",{className:"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",children:b(n.ItemIndicator,{children:b(Ye,{className:"size-4"})})}),t]}));Je.displayName=n.CheckboxItem.displayName;var Qe=P.forwardRef(({...e},t)=>b(n.RadioGroup,{ref:t,"data-slot":"dropdown-menu-radio-group",...e}));Qe.displayName=n.RadioGroup.displayName;var Ze=P.forwardRef(({className:e,children:t,...r},i)=>se(n.RadioItem,{ref:i,"data-slot":"dropdown-menu-radio-item",className:a("focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...r,children:[b("span",{className:"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",children:b(n.ItemIndicator,{children:b(qe,{className:"size-2 fill-current"})})}),t]}));Ze.displayName=n.RadioItem.displayName;var ie=P.forwardRef(({className:e,inset:t,...r},i)=>b(n.Label,{ref:i,"data-slot":"dropdown-menu-label","data-inset":t,className:a("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",e),...r}));ie.displayName=n.Label.displayName;var z=P.forwardRef(({className:e,...t},r)=>b(n.Separator,{ref:r,"data-slot":"dropdown-menu-separator",className:a("bg-border -mx-1 my-1 h-px",e),...t}));z.displayName=n.Separator.displayName;var et=P.forwardRef(({className:e,...t},r)=>b("span",{ref:r,"data-slot":"dropdown-menu-shortcut",className:a("text-muted-foreground ml-auto text-xs tracking-widest",e),...t}));et.displayName="DropdownMenuShortcut";var tt=P.forwardRef(({className:e,inset:t,children:r,...i},v)=>se(n.SubTrigger,{ref:v,"data-slot":"dropdown-menu-sub-trigger","data-inset":t,className:a("focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[inset]:pl-8",e),...i,children:[r,b(Xe,{className:"ml-auto size-4"})]}));tt.displayName=n.SubTrigger.displayName;var ot=P.forwardRef(({className:e,...t},r)=>b(n.SubContent,{ref:r,"data-slot":"dropdown-menu-sub-content",className:a("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 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg",e),...t}));ot.displayName=n.SubContent.displayName;import*as h from"@radix-ui/react-dialog";import{X as rt}from"lucide-react";import{jsx as B,jsxs as de}from"react/jsx-runtime";var at=rt;function ve({...e}){return B(h.Root,{"data-slot":"sheet",...e})}function ge({...e}){return B(h.Trigger,{"data-slot":"sheet-trigger",...e})}function nt({...e}){return B(h.Portal,{"data-slot":"sheet-portal",...e})}function it({className:e,...t}){return B(h.Overlay,{"data-slot":"sheet-overlay",className:a("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 be({className:e,children:t,side:r="right",...i}){return de(nt,{children:[B(it,{}),de(h.Content,{"data-slot":"sheet-content",className:a("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),...i,children:[t,de(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:[B(at,{className:"size-4"}),B("span",{className:"sr-only",children:"Close"})]})]})]})}import{useEffect as st,useState as dt}from"react";import{jsx as le}from"react/jsx-runtime";var lt={className:"mr-2 h-4 w-4","aria-hidden":"true"},U=({Icon:e})=>{let[t,r]=dt(!1);return st(()=>{r(!0)},[]),le("span",{className:"inline-flex items-center justify-center",children:t?le(e,{...lt}):le("span",{className:"mr-2 h-4 w-4","aria-hidden":"true"})})};import{useEffect as mt,useState as ct}from"react";import{Sun as pt,Moon as ut}from"lucide-react";import{jsx as me}from"react/jsx-runtime";var he="authdog-theme",ft=()=>{if(typeof window>"u")return"light";let e=window.localStorage.getItem(he);return e==="light"||e==="dark"?e:window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"},xe=e=>{document.documentElement.classList.toggle("dark",e==="dark")},ye=()=>{let[e,t]=ct("light");return mt(()=>{let i=ft();xe(i),t(i)},[]),me(x,{variant:"ghost",size:"icon","aria-label":e==="dark"?"Switch to light theme":"Switch to dark theme",onClick:()=>{let i=e==="dark"?"light":"dark";xe(i);try{window.localStorage.setItem(he,i)}catch{}t(i)},children:e==="dark"?me(pt,{className:"h-4 w-4"}):me(ut,{className:"h-4 w-4"})})};import{Fragment as Ne,jsx as s,jsxs as C}from"react/jsx-runtime";function xt({items:e=[],children:t,className:r,logoText:i="ACME Corp",logoSrc:v,altText:w,user:f={name:"John Doe",email:"john@example.com",image:"https://i.pravatar.cc/150?u=a042581f4e29026704d"},onNavigateHome:V=()=>console.log("Navigating to home"),onNavItemClick:N=D=>console.log(`Navigating to ${D}`),onProfileSelected:R,onLogout:L=()=>console.log("Logout clicked"),isLoading:k=!1,identityHost:S="https://stg-id.authdog.xyz",environmentId:M="58be35b0-708f-49f6-84f0-6695d307d997"}){let[D,c]=we(!1),[u,g]=we(!1),T=f!=null&&f.id!==null&&f.id!==void 0;return s("header",{className:a("w-full border-b bg-background",r),children:C("div",{className:a("mx-auto flex h-16 w-full max-w-6xl items-center justify-between px-4 md:px-6"),children:[C("div",{className:"flex items-center gap-3 md:gap-4",children:[C("button",{type:"button",onClick:V,className:a("group inline-flex items-center gap-2 md:gap-3 rounded-md px-1 py-1 text-left","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background"),"aria-label":"Go to homepage",children:[v&&!u&&s("span",{className:"inline-flex h-8 w-8 items-center justify-center overflow-hidden rounded-md bg-muted/80 ring-1 ring-border",children:s("img",{src:v,alt:i,className:"h-7 w-7 object-contain",onError:()=>g(!0)})}),w??s("span",{className:"text-base font-semibold tracking-tight md:text-lg group-hover:text-primary",children:i})]}),t]}),C("div",{className:"flex flex-1 items-center justify-end gap-6",children:[s("nav",{className:"hidden md:flex items-center gap-6",children:e?.map((m,l)=>s("span",{onClick:()=>{m.disabled||N(m.href)},className:a("text-sm font-medium transition-colors hover:text-primary cursor-pointer",m.disabled&&"cursor-not-allowed opacity-80"),children:m.title},l))}),C("div",{className:"flex items-center gap-3",children:[C(ve,{open:D,onOpenChange:c,children:[s(ge,{asChild:!0,children:s(x,{variant:"ghost",size:"icon",className:"md:hidden","aria-label":"Open Menu",children:s(U,{Icon:bt})})}),s(be,{side:"left",className:"pr-0",children:s("nav",{className:"grid gap-2 py-6",children:e?.map((m,l)=>s("a",{href:m.href,className:a("flex w-full items-center rounded-md px-3 py-2 text-sm font-medium hover:bg-accent",m.disabled&&"cursor-not-allowed opacity-80"),onClick:()=>c(!1),children:m.title},l))})})]}),s(ye,{}),T?C(X,{children:[s(j,{asChild:!0,children:s(x,{variant:"ghost",className:"relative h-8 w-8 rounded-full",disabled:k,children:s(F,{className:"h-8 w-8",children:k?s("div",{className:"h-8 w-8 animate-pulse bg-muted rounded-full"}):C(Ne,{children:[s(_,{src:f.photos?.[0]?.value||"/placeholder.svg",alt:f.displayName}),s(W,{children:f.displayName?.charAt(0)})]})})})}),s(q,{className:"w-56",align:"end",forceMount:!0,children:k?C("div",{className:"p-4",children:[s("div",{className:"h-4 w-3/4 animate-pulse bg-muted rounded mb-2"}),s("div",{className:"h-3 w-1/2 animate-pulse bg-muted rounded"})]}):C(Ne,{children:[s(ie,{className:"font-normal",children:C("div",{className:"flex flex-col space-y-1",children:[s("p",{className:"text-sm font-medium leading-none",children:f.displayName}),s("p",{className:"text-xs leading-none text-muted-foreground",children:f.emails?.[0]?.value})]})}),s(z,{}),s(ne,{children:C(A,{onClick:R,children:[s(U,{Icon:vt}),s("span",{children:"Profile"})]})}),s(z,{}),C(A,{onClick:L,children:[s(U,{Icon:gt}),s("span",{children:"Log out"})]})]})})]}):s(x,{variant:"default","aria-label":"Sign in",onClick:()=>{if(!M)throw new Error("Environment ID is required");if(!S)throw new Error("Identity Host is required");let m=`${S}/signin/${M}`;window.open(m,"_blank")},children:"Sign in"})]})]})]})})}import{useEffect as Te,useState as Y}from"react";import{Slot as ht}from"@radix-ui/react-slot";import{cva as yt}from"class-variance-authority";import{jsx as Nt}from"react/jsx-runtime";var wt=yt("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 J({className:e,variant:t,asChild:r=!1,...i}){return Nt(r?ht:"span",{"data-slot":"badge",className:a(wt({variant:t}),e),...i})}import{jsx as $}from"react/jsx-runtime";function H({className:e,...t}){return $("div",{"data-slot":"card",className:a("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",e),...t})}function Pe({className:e,...t}){return $("div",{"data-slot":"card-header",className:a("@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",e),...t})}function Ce({className:e,...t}){return $("div",{"data-slot":"card-title",className:a("leading-none font-semibold",e),...t})}function Re({className:e,...t}){return $("div",{"data-slot":"card-description",className:a("text-muted-foreground text-sm",e),...t})}function K({className:e,...t}){return $("div",{"data-slot":"card-content",className:a("px-6",e),...t})}function ke({className:e,...t}){return $("div",{"data-slot":"card-footer",className:a("flex items-center px-6 [.border-t]:pt-6",e),...t})}import{jsx as Pt}from"react/jsx-runtime";function Me({className:e,type:t,...r}){return Pt("input",{type:t,"data-slot":"input",className:a("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",e),...r})}import*as De from"@radix-ui/react-label";import{jsx as Ct}from"react/jsx-runtime";function Se({className:e,...t}){return Ct(De.Root,{"data-slot":"label",className:a("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",e),...t})}import{User as Rt}from"lucide-react";import{Fragment as Ie,jsx as o,jsxs as d}from"react/jsx-runtime";var kt=({loading:e,user:t,handleAuthenticated:r,onRequestEmailVerification:i,onVerifyEmail:v,onAddEmail:w})=>{let[f,V]=Y(!1),[N,R]=Y("profile"),[L,k]=Y(null),[S,M]=Y({}),[D,c]=Y(!1),[u,g]=Y("");Te(()=>{V(!0)},[]),Te(()=>{!e&&r&&r()},[e,t,r]);let T={className:"mr-2 h-4 w-4","aria-hidden":"true"},m=l=>f?o(l,{...T}):null;return!f||e?o("div",{children:"Loading..."}):t?d("div",{className:"grid grid-cols-[14rem,1fr] w-full bg-transparent",children:[d("div",{className:"h-full border-r border-border p-3 md:p-4 bg-transparent flex flex-col min-w-0",children:[d("div",{className:"mb-3 md:mb-4",children:[o("h1",{className:"text-xl font-bold text-foreground",children:"Account"}),o("p",{className:"text-sm text-muted-foreground",children:"Manage your account info."})]}),o("nav",{className:"space-y-1 flex-1",children:d("button",{onClick:()=>R("profile"),className:`flex items-center w-full px-3 py-2 text-sm rounded-md ${N==="profile"?"bg-muted text-foreground":"text-muted-foreground hover:bg-muted/50"}`,children:[m(Rt),"Profile"]})})]}),d("div",{className:"h-full p-3 md:p-5 min-w-0 bg-transparent",children:[o("div",{className:"flex justify-between items-center mb-3 md:mb-4",children:o("h2",{className:"text-xl font-semibold text-foreground",children:N==="profile"?"Profile details":N==="security"?"Security settings":"Preferences"})}),N==="profile"?d("div",{className:"space-y-5 md:space-y-6",children:[d("div",{children:[o("h3",{className:"text-sm font-medium mb-3 text-foreground",children:"Profile"}),o("div",{className:"flex items-center justify-between",children:d("div",{className:"flex items-center",children:[d(F,{className:"h-12 w-12 mr-4 border",children:[o(_,{src:t.photos?.[0]?.value,alt:"Profile picture"}),o(W,{children:t.displayName?.split(" ").map(l=>l[0]).join("")})]}),o("span",{className:"font-medium text-foreground",children:t.displayName})]})})]}),d("div",{children:[o("h3",{className:"text-sm font-medium mb-3 text-foreground",children:"Email addresses"}),d("div",{className:"space-y-2.5",children:[t.emails.map((l,I)=>{let pe=(t?.verifications||[]).find(re=>re.email===l.value)?.verified===!0,ue=S[l.value]||"";return d("div",{className:"flex items-start justify-between gap-2",children:[d("div",{className:"flex flex-col",children:[o("span",{className:"text-foreground",children:l.value}),o("div",{className:"mt-1",children:pe?o(J,{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"}):o(J,{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"})})]}),d("div",{className:"flex items-center gap-2",children:[I===0&&o(J,{variant:"outline",className:"text-xs bg-muted text-foreground hover:bg-muted",children:"Primary"}),!pe&&o(Ie,{children:L===l.value?d("div",{className:"flex items-center gap-1",children:[o("input",{className:"h-7 w-24 text-sm rounded-md border border-border bg-background px-2 text-foreground",placeholder:"Code",value:ue,onChange:re=>M(Ee=>({...Ee,[l.value]:re.target.value}))}),o("button",{className:"h-7 rounded-md border border-border px-2 text-xs",onClick:async()=>{v&&await v(l.value,ue)},children:"Verify"}),o("button",{className:"h-7 rounded-md border border-border px-2 text-xs",onClick:()=>k(null),children:"Cancel"})]}):o(Ie,{children:o("button",{className:"h-7 rounded-md border border-border px-2 text-xs",onClick:async()=>{i&&await i(l.value),k(l.value)},children:"Send code"})})})]})]},l.value)}),o("div",{className:"mt-2",children:D?o("div",{className:"max-w-md",children:d(H,{children:[d(Pe,{children:[o(Ce,{children:"Add email address"}),o(Re,{children:"You'll need to verify this email address before it can be added to your account."})]}),o(K,{children:d("div",{className:"space-y-2",children:[o(Se,{htmlFor:"new-email",children:"Email address"}),o(Me,{id:"new-email",placeholder:"Enter your email address",value:u,onChange:l=>g(l.target.value),onKeyDown:async l=>{if(l.key==="Enter"){let I=String(u||"").trim().toLowerCase();if(!I)return;w&&await w(I),c(!1),g("")}}})]})}),d(ke,{className:"justify-end gap-2",children:[o(x,{variant:"ghost",onClick:()=>{c(!1),g("")},children:"Cancel"}),o(x,{onClick:async()=>{let l=String(u||"").trim().toLowerCase();l&&(w&&await w(l),c(!1),g(""))},children:"Add"})]})]})}):o(x,{variant:"outline",size:"sm",className:"text-xs",onClick:()=>c(!0),children:"Add email"})})]})]}),d("div",{children:[o("h3",{className:"text-sm font-medium mb-3 text-gray-900 dark:text-gray-100",children:"Connected accounts"}),o("div",{className:"space-y-2.5",children:d("div",{className:"flex items-center justify-between",children:[o("div",{className:"flex items-center",children:o("div",{className:"mr-2",children:o("span",{className:"text-gray-900 dark:text-gray-100",children:t.provider})})}),o("span",{className:"text-sm text-gray-500 dark:text-gray-400",children:t?.emails?.[0]?.value})]},t.provider)})]})]}):N==="security"?d("div",{className:"space-y-5 md:space-y-6",children:[o("div",{className:"border rounded-md overflow-hidden",children:d("div",{className:"flex items-center justify-between px-4 py-3",children:[o("div",{className:"text-sm text-gray-700 dark:text-gray-300",children:"Password"}),o("button",{className:"text-sm text-indigo-600 hover:underline",children:"Set password"})]})}),o("div",{className:"border rounded-md overflow-hidden",children:d("div",{className:"flex items-center justify-between px-4 py-3",children:[o("div",{className:"text-sm text-gray-700 dark:text-gray-300",children:"Passkeys"}),o("button",{className:"text-sm text-indigo-600 hover:underline",children:"+\xA0Add a passkey"})]})}),o("div",{className:"border rounded-md overflow-hidden",children:d("div",{className:"flex items-center justify-between px-4 py-3",children:[o("div",{className:"text-sm text-gray-700 dark:text-gray-300",children:"Two-step verification"}),o("button",{className:"text-sm text-indigo-600 hover:underline",children:"+\xA0Add two-step verification"})]})}),d("div",{className:"border rounded-md overflow-hidden",children:[o("div",{className:"px-4 py-3 border-b text-sm font-medium text-gray-900 dark:text-gray-100",children:"Active devices"}),o("div",{className:"p-4 space-y-3",children:d("div",{className:"text-sm",children:[d("div",{className:"flex items-center gap-2",children:[o("span",{className:"inline-block h-5 w-5 rounded-sm bg-gray-900 dark:bg-white"}),o("span",{className:"font-medium",children:"X11"}),o("span",{className:"text-xs rounded-md border px-2 py-0.5 text-gray-600 dark:text-gray-300",children:"This device"})]}),o("div",{className:"text-gray-600 dark:text-gray-400 mt-1",children:"Firefox 142.0"}),o("div",{className:"text-gray-600 dark:text-gray-400",children:"127.0.0.1 (Local), (Your City)"}),o("div",{className:"text-gray-600 dark:text-gray-400",children:"Today at 7:08 PM"})]})})]}),o("div",{className:"border rounded-md overflow-hidden",children:d("div",{className:"flex items-center justify-between px-4 py-3",children:[o("div",{className:"text-sm text-gray-700 dark:text-gray-300",children:"Delete account"}),o("button",{className:"text-sm text-red-600 hover:underline",children:"Delete account"})]})})]}):o("div",{className:"space-y-5 md:space-y-6",children:d("div",{children:[o("h3",{className:"text-sm font-medium mb-3 text-gray-900 dark:text-gray-100",children:"Preferences"}),d("div",{className:"space-y-3 text-sm",children:[d("div",{className:"flex items-center justify-between",children:[o("span",{className:"text-gray-700 dark:text-gray-300",children:"Locale"}),o("span",{className:"text-gray-500 dark:text-gray-400",children:"Auto"})]}),d("div",{className:"flex items-center justify-between",children:[o("span",{className:"text-gray-700 dark:text-gray-300",children:"Theme"}),o("span",{className:"text-gray-500 dark:text-gray-400",children:"System"})]})]})]})})]})]}):o("div",{children:"No user"})};import{LogOut as Mt,Settings as Dt,ExternalLink as St}from"lucide-react";import{jsx as y,jsxs as E}from"react/jsx-runtime";var Tt=e=>e&&String(e).trim().split(/\s+/).slice(0,2).map(i=>i[0]?.toUpperCase()).join("")||"?",It=({trigger:e,user:t,className:r,onManageAccount:i,onSignout:v,links:w=[],side:f="bottom",align:V="end",sideOffset:N=8,modal:R=!1,triggerAsChild:L=!1,triggerWrapperClassName:k})=>{let S=t?.emails?.[0]?.value||t?.email||"",M=t?.displayName||t?.name||"",D=t?.photos?.[0]?.value||t?.avatar||"",c=m=>{if(m.onClick)return m.onClick();m.href&&(m.href.startsWith("http")?window.open(m.href,"_blank"):window.location.assign(m.href))},u=St,g=Dt,T=Mt;return E(X,{modal:R,children:[L?y(j,{asChild:!0,children:e}):y(j,{className:a("inline-flex items-center justify-center bg-transparent p-0 border-0 outline-none focus-visible:outline-none",k),children:e}),E(q,{align:V,side:f,sideOffset:N,className:a("w-72 p-2 overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md",r),children:[E("div",{className:"flex items-center gap-3 px-4 pt-4 pb-3",children:[E(F,{className:"h-9 w-9 rounded-full",children:[y(_,{src:D,alt:M}),y(W,{className:"rounded-full",children:Tt(M)})]}),E("div",{className:"min-w-0",children:[y("div",{className:"text-sm font-semibold truncate",children:M}),y("div",{className:"text-xs text-muted-foreground truncate",children:S})]})]}),y(z,{}),E(A,{className:"cursor-pointer py-2",onClick:()=>i?.(),children:[y(g,{className:"mr-2 h-4 w-4"}),y("span",{children:"Manage account"})]}),w.map((m,l)=>{let I=m.icon??u;return E(A,{className:"cursor-pointer py-2",onClick:()=>c(m),children:[y(I,{className:"mr-2 h-4 w-4"}),y("span",{children:m.label})]},`${m.label}-${l}`)}),y(z,{}),E(A,{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:()=>v?.(),children:[y(T,{className:"mr-2 h-4 w-4 text-red-600 dark:text-red-300"}),y("span",{children:"Sign out"})]})]})]})};import{CheckCircle2Icon as Vt}from"lucide-react";import{cva as At}from"class-variance-authority";import{jsx as ce}from"react/jsx-runtime";var Et=At("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 Q({className:e,variant:t,...r}){return ce("div",{"data-slot":"alert",role:"alert",className:a(Et({variant:t}),e),...r})}function Ae({className:e,...t}){return ce("div",{"data-slot":"alert-title",className:a("col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight",e),...t})}function Z({className:e,...t}){return ce("div",{"data-slot":"alert-description",className:a("text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",e),...t})}import{jsx as ee,jsxs as zt}from"react/jsx-runtime";var Lt=e=>{let t=e.title??"Placeholder Alert",r=e.description??"This is a placeholder alert.";return ee("div",{className:"grid w-full max-w-xl items-start gap-4",children:zt(Q,{children:[ee(U,{Icon:Vt}),ee(Ae,{children:t}),ee(Z,{children:r})]})})};import{useState as te,useRef as Bt}from"react";import{Shield as Gt,CheckCircle as Ot,AlertCircle as Ft}from"lucide-react";import{jsx as p,jsxs as G}from"react/jsx-runtime";var _t=({onValidate:e})=>{let[t,r]=te(["","","","","",""]),[i,v]=te(!1),[w,f]=te(""),[V,N]=te(!1),R=Bt([]),L=(c,u)=>{if(!/^\d*$/.test(u))return;let g=[...t];g[c]=u.slice(-1),r(g),f(""),N(!1),u&&c<5&&R.current[c+1]?.focus()},k=(c,u)=>{u.key==="Backspace"&&!t[c]&&c>0&&R.current[c-1]?.focus(),u.key==="v"&&(u.ctrlKey||u.metaKey)&&(u.preventDefault(),navigator.clipboard.readText().then(g=>{let T=g.replace(/\D/g,"").slice(0,6).split(""),m=[...t];T.forEach((I,oe)=>{oe<6&&(m[oe]=I)}),r(m);let l=Math.min(T.length,5);R.current[l]?.focus()}))},S=async()=>{let c=t.join("");if(c.length!==6){f("Please enter all 6 digits");return}v(!0),f("");try{await e(c),N(!0)}catch{f("Invalid TOTP code. Please try again.")}finally{v(!1)}},M=c=>{c.preventDefault(),S()},D=()=>{r(["","","","","",""]),f(""),N(!1),v(!1),R.current[0]?.focus()};return V?p("div",{className:"max-w-md mx-auto",children:p(H,{className:"border-green-200 bg-green-50",children:p(K,{className:"pt-6",children:G("div",{className:"text-center space-y-4",children:[p("div",{className:"mx-auto w-16 h-16 bg-green-100 rounded-full flex items-center justify-center",children:p(Ot,{className:"w-8 h-8 text-green-600"})}),G("div",{children:[p("h3",{className:"text-lg font-semibold text-green-900",children:"Verification Successful!"}),p("p",{className:"text-sm text-green-700 mt-1",children:"Your TOTP code has been validated."})]}),p(x,{onClick:D,variant:"outline",className:"bg-white",children:"Verify Another Code"})]})})})}):p("div",{className:"max-w-md mx-auto",children:p(H,{children:p(K,{className:"pt-6",children:G("div",{className:"text-center space-y-6",children:[G("div",{children:[p("div",{className:"mx-auto w-12 h-12 bg-blue-100 rounded-full flex items-center justify-center mb-4",children:p(Gt,{className:"w-6 h-6 text-blue-600"})}),p("h3",{className:"text-lg font-semibold",children:"Enter Verification Code"}),p("p",{className:"text-sm text-muted-foreground mt-1",children:"Enter the 6-digit code from your authenticator app"})]}),G("form",{onSubmit:M,className:"space-y-6",children:[p("div",{className:"flex justify-center gap-2",children:t.map((c,u)=>p(H,{className:"w-12 h-14 border-2 focus-within:border-blue-500 transition-colors",children:p(K,{className:"p-0 h-full flex items-center justify-center",children:p("input",{ref:g=>{R.current[u]=g},type:"tel",inputMode:"numeric",maxLength:1,value:c,onChange:g=>L(u,g.target.value),onKeyDown:g=>k(u,g),className:"w-full h-full text-center text-2xl font-bold border-none outline-none bg-transparent",autoComplete:"one-time-code",disabled:i,style:{height:"auto"}})})},u))}),w&&G(Q,{variant:"destructive",children:[p(Ft,{className:"h-4 w-4"}),p(Z,{children:w})]}),G("div",{className:"space-y-3",children:[p(x,{type:"submit",className:"w-full",disabled:i||t.some(c=>c===""),children:i?"Verifying...":"Verify Code"}),p(x,{type:"button",variant:"ghost",size:"sm",onClick:D,className:"w-full text-xs",children:"Clear Code"})]})]}),p("p",{className:"text-xs text-muted-foreground",children:"Codes refresh every 30 seconds"})]})})})})};export{x as Button,We as ClientOnly,xt as Navbar,Lt as PlaceholderAlert,_t as TOTPValidator,It as UserDropdown,kt as UserProfile};
|
|
3
3
|
//# sourceMappingURL=index.mjs.map
|