@authdog/react-elements 0.0.46 → 0.0.48

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.
@@ -1,5 +1,5 @@
1
1
 
2
- > @authdog/react-elements@0.0.46 build /home/runner/work/web-sdk/web-sdk/packages/react-elements
2
+ > @authdog/react-elements@0.0.48 build /home/runner/work/web-sdk/web-sdk/packages/react-elements
3
3
  > pnpm tsup && pnpm build:styles
4
4
 
5
5
  CLI 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, src/components/ui/theme-toggle.tsx
@@ -10,7 +10,7 @@
10
10
  CLI Cleaning output folder
11
11
  ESM Build start
12
12
  CJS Build start
13
- CJS dist/index.js 34.51 KB
13
+ CJS dist/index.js 34.90 KB
14
14
  CJS dist/lib/utils.js 620.00 B
15
15
  CJS dist/components/ui/alert.js 1.65 KB
16
16
  CJS dist/components/ui/avatar.js 1.34 KB
@@ -22,8 +22,8 @@
22
22
  CJS dist/components/ui/label.js 1.14 KB
23
23
  CJS dist/components/ui/separator.js 1.18 KB
24
24
  CJS dist/components/ui/sheet.js 3.36 KB
25
- CJS dist/components/ui/theme-toggle.js 2.69 KB
26
- CJS dist/index.js.map 97.34 KB
25
+ CJS dist/components/ui/theme-toggle.js 2.72 KB
26
+ CJS dist/index.js.map 99.69 KB
27
27
  CJS dist/lib/utils.js.map 520.00 B
28
28
  CJS dist/components/ui/alert.js.map 3.00 KB
29
29
  CJS dist/components/ui/avatar.js.map 2.30 KB
@@ -35,9 +35,9 @@
35
35
  CJS dist/components/ui/label.js.map 1.43 KB
36
36
  CJS dist/components/ui/separator.js.map 1.63 KB
37
37
  CJS dist/components/ui/sheet.js.map 6.76 KB
38
- CJS dist/components/ui/theme-toggle.js.map 5.58 KB
39
- CJS ⚡️ Build success in 330ms
40
- ESM dist/index.mjs 32.03 KB
38
+ CJS dist/components/ui/theme-toggle.js.map 5.62 KB
39
+ CJS ⚡️ Build success in 405ms
40
+ ESM dist/index.mjs 32.41 KB
41
41
  ESM dist/lib/utils.mjs 166.00 B
42
42
  ESM dist/components/ui/alert.mjs 1.19 KB
43
43
  ESM dist/components/ui/avatar.mjs 749.00 B
@@ -49,8 +49,8 @@
49
49
  ESM dist/components/ui/label.mjs 566.00 B
50
50
  ESM dist/components/ui/separator.mjs 604.00 B
51
51
  ESM dist/components/ui/sheet.mjs 2.68 KB
52
- ESM dist/components/ui/theme-toggle.mjs 2.10 KB
53
- ESM dist/index.mjs.map 98.00 KB
52
+ ESM dist/components/ui/theme-toggle.mjs 2.13 KB
53
+ ESM dist/index.mjs.map 100.28 KB
54
54
  ESM dist/lib/utils.mjs.map 415.00 B
55
55
  ESM dist/components/ui/alert.mjs.map 2.82 KB
56
56
  ESM dist/components/ui/avatar.mjs.map 2.12 KB
@@ -62,14 +62,14 @@
62
62
  ESM dist/components/ui/label.mjs.map 1.31 KB
63
63
  ESM dist/components/ui/separator.mjs.map 1.50 KB
64
64
  ESM dist/components/ui/sheet.mjs.map 6.49 KB
65
- ESM dist/components/ui/theme-toggle.mjs.map 5.51 KB
66
- ESM ⚡️ Build success in 334ms
65
+ ESM dist/components/ui/theme-toggle.mjs.map 5.56 KB
66
+ ESM ⚡️ Build success in 414ms
67
67
  DTS Build start
68
- DTS ⚡️ Build success in 16089ms
69
- DTS dist/index.d.mts 3.99 KB
70
- DTS dist/index.d.ts 3.99 KB
68
+ DTS ⚡️ Build success in 16077ms
69
+ DTS dist/index.d.mts 4.66 KB
70
+ DTS dist/index.d.ts 4.66 KB
71
71
 
72
- > @authdog/react-elements@0.0.46 build:styles /home/runner/work/web-sdk/web-sdk/packages/react-elements
72
+ > @authdog/react-elements@0.0.48 build:styles /home/runner/work/web-sdk/web-sdk/packages/react-elements
73
73
  > postcss src/global.css -o dist/styles.css
74
74
 
75
75
  Browserslist: browsers data (caniuse-lite) is 6 months old. Please run:
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @authdog/react-elements
2
2
 
3
+ ## 0.0.48
4
+
5
+ ### Patch Changes
6
+
7
+ - 1be5751: Fix cursor nav elements
8
+ - 3c9f2fc: Enhance display dropdown avatar
9
+
10
+ ## 0.0.47
11
+
12
+ ### Patch Changes
13
+
14
+ - f71033d: Make avatar links customizable
15
+
3
16
  ## 0.0.46
4
17
 
5
18
  ### Patch Changes
@@ -1,3 +1,3 @@
1
1
  "use client";
2
- "use strict";"use client";var x=Object.create;var a=Object.defineProperty;var k=Object.getOwnPropertyDescriptor;var M=Object.getOwnPropertyNames;var T=Object.getPrototypeOf,B=Object.prototype.hasOwnProperty;var S=(e,t)=>{for(var o in t)a(e,o,{get:t[o],enumerable:!0})},l=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of M(t))!B.call(e,n)&&n!==o&&a(e,n,{get:()=>t[n],enumerable:!(r=k(t,n))||r.enumerable});return e};var V=(e,t,o)=>(o=e!=null?x(T(e)):{},l(t||!e||!e.__esModule?a(o,"default",{value:e,enumerable:!0}):o,e)),C=e=>l(a({},"__esModule",{value:!0}),e);var L={};S(L,{ThemeToggle:()=>R});module.exports=C(L);var s=require("react"),d=require("lucide-react");var g=V(require("react")),h=require("@radix-ui/react-slot"),p=require("class-variance-authority");var u=require("clsx"),m=require("tailwind-merge");function f(...e){return(0,m.twMerge)((0,u.clsx)(e))}var b=require("react/jsx-runtime"),E=(0,p.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"}}),c=g.forwardRef(({className:e,variant:t,size:o,asChild:r=!1,...n},w)=>(0,b.jsx)(r?h.Slot:"button",{className:f(E({variant:t,size:o,className:e})),ref:w,...n}));c.displayName="Button";var i=require("react/jsx-runtime"),y="authdog-theme",P=()=>{if(typeof window>"u")return"light";let e=window.localStorage.getItem(y);return e==="light"||e==="dark"?e:window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"},v=e=>{document.documentElement.classList.toggle("dark",e==="dark")},R=()=>{let[e,t]=(0,s.useState)("light");return(0,s.useEffect)(()=>{let r=P();v(r),t(r)},[]),(0,i.jsx)(c,{variant:"ghost",size:"icon","aria-label":e==="dark"?"Switch to light theme":"Switch to dark theme",onClick:()=>{let r=e==="dark"?"light":"dark";v(r);try{window.localStorage.setItem(y,r)}catch{}t(r)},children:e==="dark"?(0,i.jsx)(d.Sun,{className:"h-4 w-4"}):(0,i.jsx)(d.Moon,{className:"h-4 w-4"})})};
2
+ "use strict";"use client";var x=Object.create;var a=Object.defineProperty;var k=Object.getOwnPropertyDescriptor;var M=Object.getOwnPropertyNames;var T=Object.getPrototypeOf,B=Object.prototype.hasOwnProperty;var S=(e,t)=>{for(var o in t)a(e,o,{get:t[o],enumerable:!0})},l=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of M(t))!B.call(e,n)&&n!==o&&a(e,n,{get:()=>t[n],enumerable:!(r=k(t,n))||r.enumerable});return e};var V=(e,t,o)=>(o=e!=null?x(T(e)):{},l(t||!e||!e.__esModule?a(o,"default",{value:e,enumerable:!0}):o,e)),C=e=>l(a({},"__esModule",{value:!0}),e);var R={};S(R,{ThemeToggle:()=>P});module.exports=C(R);var s=require("react"),d=require("lucide-react");var g=V(require("react")),h=require("@radix-ui/react-slot"),p=require("class-variance-authority");var u=require("clsx"),m=require("tailwind-merge");function f(...e){return(0,m.twMerge)((0,u.clsx)(e))}var b=require("react/jsx-runtime"),E=(0,p.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"}}),c=g.forwardRef(({className:e,variant:t,size:o,asChild:r=!1,...n},w)=>(0,b.jsx)(r?h.Slot:"button",{className:f(E({variant:t,size:o,className:e})),ref:w,...n}));c.displayName="Button";var i=require("react/jsx-runtime"),y="authdog-theme",N=()=>{if(typeof window>"u")return"light";let e=window.localStorage.getItem(y);return e==="light"||e==="dark"?e:window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"},v=e=>{document.documentElement.classList.toggle("dark",e==="dark")},P=()=>{let[e,t]=(0,s.useState)("light");return(0,s.useEffect)(()=>{let r=N();v(r),t(r)},[]),(0,i.jsx)(c,{variant:"ghost",size:"icon",className:"cursor-pointer","aria-label":e==="dark"?"Switch to light theme":"Switch to dark theme",onClick:()=>{let r=e==="dark"?"light":"dark";v(r);try{window.localStorage.setItem(y,r)}catch{}t(r)},children:e==="dark"?(0,i.jsx)(d.Sun,{className:"h-4 w-4"}):(0,i.jsx)(d.Moon,{className:"h-4 w-4"})})};
3
3
  //# sourceMappingURL=theme-toggle.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/ui/theme-toggle.tsx","../../../src/components/ui/button.tsx","../../../src/lib/utils.ts"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useState } from \"react\";\nimport { Sun, Moon } from \"lucide-react\";\n\nimport { Button } from \"./button\";\n\nconst STORAGE_KEY = \"authdog-theme\";\n\ntype ThemeMode = \"light\" | \"dark\";\n\nconst getPreferredTheme = (): ThemeMode => {\n if (typeof window === \"undefined\") return \"light\";\n const stored = window.localStorage.getItem(STORAGE_KEY);\n if (stored === \"light\" || stored === \"dark\") {\n return stored;\n }\n return window.matchMedia(\"(prefers-color-scheme: dark)\").matches ? \"dark\" : \"light\";\n};\n\nconst applyTheme = (mode: ThemeMode) => {\n document.documentElement.classList.toggle(\"dark\", mode === \"dark\");\n};\n\nexport const ThemeToggle = () => {\n const [mode, setMode] = useState<ThemeMode>(\"light\");\n\n useEffect(() => {\n const initial = getPreferredTheme();\n applyTheme(initial);\n setMode(initial);\n }, []);\n\n const toggle = () => {\n const nextMode: ThemeMode = mode === \"dark\" ? \"light\" : \"dark\";\n applyTheme(nextMode);\n try {\n window.localStorage.setItem(STORAGE_KEY, nextMode);\n } catch {\n // ignore\n }\n setMode(nextMode);\n };\n\n return (\n <Button\n variant=\"ghost\"\n size=\"icon\"\n aria-label={mode === \"dark\" ? \"Switch to light theme\" : \"Switch to dark theme\"}\n onClick={toggle}\n >\n {mode === \"dark\" ? <Sun className=\"h-4 w-4\" /> : <Moon className=\"h-4 w-4\" />}\n </Button>\n );\n};\n","import * as React from \"react\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\n\nimport { cn } from \"../../lib/utils\";\n\nconst buttonVariants = cva(\n \"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\",\n {\n variants: {\n variant: {\n default: \"bg-primary text-primary-foreground hover:bg-primary/90\",\n destructive:\n \"bg-destructive text-destructive-foreground hover:bg-destructive/90\",\n outline:\n \"border border-input bg-background hover:bg-accent hover:text-accent-foreground\",\n secondary:\n \"bg-secondary text-secondary-foreground hover:bg-secondary/80\",\n ghost: \"hover:bg-accent hover:text-accent-foreground\",\n link: \"text-primary underline-offset-4 hover:underline\",\n },\n size: {\n default: \"h-10 px-4 py-2\",\n sm: \"h-9 rounded-md px-3\",\n lg: \"h-11 rounded-md px-8\",\n icon: \"h-10 w-10\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\",\n },\n },\n);\n\nexport interface ButtonProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement>,\n VariantProps<typeof buttonVariants> {\n asChild?: boolean;\n}\n\nconst Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n ({ className, variant, size, asChild = false, ...props }, ref) => {\n const Comp = asChild ? Slot : \"button\";\n return (\n <Comp\n className={cn(buttonVariants({ variant, size, className }))}\n ref={ref}\n {...props}\n />\n );\n },\n);\nButton.displayName = \"Button\";\n\nexport { Button, buttonVariants };\n","import { type ClassValue, clsx } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n"],"mappings":";ukBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,iBAAAE,IAAA,eAAAC,EAAAH,GAEA,IAAAI,EAAoC,iBACpCC,EAA0B,wBCH1B,IAAAC,EAAuB,oBACvBC,EAAqB,gCACrBC,EAAuC,oCCFvC,IAAAC,EAAsC,gBACtCC,EAAwB,0BAEjB,SAASC,KAAMC,EAAsB,CAC1C,SAAO,cAAQ,QAAKA,CAAM,CAAC,CAC7B,CDwCM,IAAAC,EAAA,6BAvCAC,KAAiB,OACrB,yRACA,CACE,SAAU,CACR,QAAS,CACP,QAAS,yDACT,YACE,qEACF,QACE,iFACF,UACE,+DACF,MAAO,+CACP,KAAM,iDACR,EACA,KAAM,CACJ,QAAS,iBACT,GAAI,sBACJ,GAAI,uBACJ,KAAM,WACR,CACF,EACA,gBAAiB,CACf,QAAS,UACT,KAAM,SACR,CACF,CACF,EAQMC,EAAe,aACnB,CAAC,CAAE,UAAAC,EAAW,QAAAC,EAAS,KAAAC,EAAM,QAAAC,EAAU,GAAO,GAAGC,CAAM,EAAGC,OAGtD,OAFWF,EAAU,OAAO,SAE3B,CACC,UAAWG,EAAGR,EAAe,CAAE,QAAAG,EAAS,KAAAC,EAAM,UAAAF,CAAU,CAAC,CAAC,EAC1D,IAAKK,EACJ,GAAGD,EACN,CAGN,EACAL,EAAO,YAAc,SDFI,IAAAQ,EAAA,6BA5CnBC,EAAc,gBAIdC,EAAoB,IAAiB,CACzC,GAAI,OAAO,OAAW,IAAa,MAAO,QAC1C,IAAMC,EAAS,OAAO,aAAa,QAAQF,CAAW,EACtD,OAAIE,IAAW,SAAWA,IAAW,OAC5BA,EAEF,OAAO,WAAW,8BAA8B,EAAE,QAAU,OAAS,OAC9E,EAEMC,EAAcC,GAAoB,CACtC,SAAS,gBAAgB,UAAU,OAAO,OAAQA,IAAS,MAAM,CACnE,EAEaC,EAAc,IAAM,CAC/B,GAAM,CAACD,EAAME,CAAO,KAAI,YAAoB,OAAO,EAEnD,sBAAU,IAAM,CACd,IAAMC,EAAUN,EAAkB,EAClCE,EAAWI,CAAO,EAClBD,EAAQC,CAAO,CACjB,EAAG,CAAC,CAAC,KAcH,OAACC,EAAA,CACC,QAAQ,QACR,KAAK,OACL,aAAYJ,IAAS,OAAS,wBAA0B,uBACxD,QAhBW,IAAM,CACnB,IAAMK,EAAsBL,IAAS,OAAS,QAAU,OACxDD,EAAWM,CAAQ,EACnB,GAAI,CACF,OAAO,aAAa,QAAQT,EAAaS,CAAQ,CACnD,MAAQ,CAER,CACAH,EAAQG,CAAQ,CAClB,EASK,SAAAL,IAAS,UAAS,OAAC,OAAI,UAAU,UAAU,KAAK,OAAC,QAAK,UAAU,UAAU,EAC7E,CAEJ","names":["theme_toggle_exports","__export","ThemeToggle","__toCommonJS","import_react","import_lucide_react","React","import_react_slot","import_class_variance_authority","import_clsx","import_tailwind_merge","cn","inputs","import_jsx_runtime","buttonVariants","Button","className","variant","size","asChild","props","ref","cn","import_jsx_runtime","STORAGE_KEY","getPreferredTheme","stored","applyTheme","mode","ThemeToggle","setMode","initial","Button","nextMode"]}
1
+ {"version":3,"sources":["../../../src/components/ui/theme-toggle.tsx","../../../src/components/ui/button.tsx","../../../src/lib/utils.ts"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useState } from \"react\";\nimport { Sun, Moon } from \"lucide-react\";\n\nimport { Button } from \"./button\";\n\nconst STORAGE_KEY = \"authdog-theme\";\n\ntype ThemeMode = \"light\" | \"dark\";\n\nconst getPreferredTheme = (): ThemeMode => {\n if (typeof window === \"undefined\") return \"light\";\n const stored = window.localStorage.getItem(STORAGE_KEY);\n if (stored === \"light\" || stored === \"dark\") {\n return stored;\n }\n return window.matchMedia(\"(prefers-color-scheme: dark)\").matches ? \"dark\" : \"light\";\n};\n\nconst applyTheme = (mode: ThemeMode) => {\n document.documentElement.classList.toggle(\"dark\", mode === \"dark\");\n};\n\nexport const ThemeToggle = () => {\n const [mode, setMode] = useState<ThemeMode>(\"light\");\n\n useEffect(() => {\n const initial = getPreferredTheme();\n applyTheme(initial);\n setMode(initial);\n }, []);\n\n const toggle = () => {\n const nextMode: ThemeMode = mode === \"dark\" ? \"light\" : \"dark\";\n applyTheme(nextMode);\n try {\n window.localStorage.setItem(STORAGE_KEY, nextMode);\n } catch {\n // ignore\n }\n setMode(nextMode);\n };\n\n return (\n <Button\n variant=\"ghost\"\n size=\"icon\"\n className=\"cursor-pointer\"\n aria-label={mode === \"dark\" ? \"Switch to light theme\" : \"Switch to dark theme\"}\n onClick={toggle}\n >\n {mode === \"dark\" ? <Sun className=\"h-4 w-4\" /> : <Moon className=\"h-4 w-4\" />}\n </Button>\n );\n};\n","import * as React from \"react\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\n\nimport { cn } from \"../../lib/utils\";\n\nconst buttonVariants = cva(\n \"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\",\n {\n variants: {\n variant: {\n default: \"bg-primary text-primary-foreground hover:bg-primary/90\",\n destructive:\n \"bg-destructive text-destructive-foreground hover:bg-destructive/90\",\n outline:\n \"border border-input bg-background hover:bg-accent hover:text-accent-foreground\",\n secondary:\n \"bg-secondary text-secondary-foreground hover:bg-secondary/80\",\n ghost: \"hover:bg-accent hover:text-accent-foreground\",\n link: \"text-primary underline-offset-4 hover:underline\",\n },\n size: {\n default: \"h-10 px-4 py-2\",\n sm: \"h-9 rounded-md px-3\",\n lg: \"h-11 rounded-md px-8\",\n icon: \"h-10 w-10\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\",\n },\n },\n);\n\nexport interface ButtonProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement>,\n VariantProps<typeof buttonVariants> {\n asChild?: boolean;\n}\n\nconst Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n ({ className, variant, size, asChild = false, ...props }, ref) => {\n const Comp = asChild ? Slot : \"button\";\n return (\n <Comp\n className={cn(buttonVariants({ variant, size, className }))}\n ref={ref}\n {...props}\n />\n );\n },\n);\nButton.displayName = \"Button\";\n\nexport { Button, buttonVariants };\n","import { type ClassValue, clsx } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n"],"mappings":";ukBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,iBAAAE,IAAA,eAAAC,EAAAH,GAEA,IAAAI,EAAoC,iBACpCC,EAA0B,wBCH1B,IAAAC,EAAuB,oBACvBC,EAAqB,gCACrBC,EAAuC,oCCFvC,IAAAC,EAAsC,gBACtCC,EAAwB,0BAEjB,SAASC,KAAMC,EAAsB,CAC1C,SAAO,cAAQ,QAAKA,CAAM,CAAC,CAC7B,CDwCM,IAAAC,EAAA,6BAvCAC,KAAiB,OACrB,yRACA,CACE,SAAU,CACR,QAAS,CACP,QAAS,yDACT,YACE,qEACF,QACE,iFACF,UACE,+DACF,MAAO,+CACP,KAAM,iDACR,EACA,KAAM,CACJ,QAAS,iBACT,GAAI,sBACJ,GAAI,uBACJ,KAAM,WACR,CACF,EACA,gBAAiB,CACf,QAAS,UACT,KAAM,SACR,CACF,CACF,EAQMC,EAAe,aACnB,CAAC,CAAE,UAAAC,EAAW,QAAAC,EAAS,KAAAC,EAAM,QAAAC,EAAU,GAAO,GAAGC,CAAM,EAAGC,OAGtD,OAFWF,EAAU,OAAO,SAE3B,CACC,UAAWG,EAAGR,EAAe,CAAE,QAAAG,EAAS,KAAAC,EAAM,UAAAF,CAAU,CAAC,CAAC,EAC1D,IAAKK,EACJ,GAAGD,EACN,CAGN,EACAL,EAAO,YAAc,SDDI,IAAAQ,EAAA,6BA7CnBC,EAAc,gBAIdC,EAAoB,IAAiB,CACzC,GAAI,OAAO,OAAW,IAAa,MAAO,QAC1C,IAAMC,EAAS,OAAO,aAAa,QAAQF,CAAW,EACtD,OAAIE,IAAW,SAAWA,IAAW,OAC5BA,EAEF,OAAO,WAAW,8BAA8B,EAAE,QAAU,OAAS,OAC9E,EAEMC,EAAcC,GAAoB,CACtC,SAAS,gBAAgB,UAAU,OAAO,OAAQA,IAAS,MAAM,CACnE,EAEaC,EAAc,IAAM,CAC/B,GAAM,CAACD,EAAME,CAAO,KAAI,YAAoB,OAAO,EAEnD,sBAAU,IAAM,CACd,IAAMC,EAAUN,EAAkB,EAClCE,EAAWI,CAAO,EAClBD,EAAQC,CAAO,CACjB,EAAG,CAAC,CAAC,KAcH,OAACC,EAAA,CACC,QAAQ,QACR,KAAK,OACL,UAAU,iBACV,aAAYJ,IAAS,OAAS,wBAA0B,uBACxD,QAjBW,IAAM,CACnB,IAAMK,EAAsBL,IAAS,OAAS,QAAU,OACxDD,EAAWM,CAAQ,EACnB,GAAI,CACF,OAAO,aAAa,QAAQT,EAAaS,CAAQ,CACnD,MAAQ,CAER,CACAH,EAAQG,CAAQ,CAClB,EAUK,SAAAL,IAAS,UAAS,OAAC,OAAI,UAAU,UAAU,KAAK,OAAC,QAAK,UAAU,UAAU,EAC7E,CAEJ","names":["theme_toggle_exports","__export","ThemeToggle","__toCommonJS","import_react","import_lucide_react","React","import_react_slot","import_class_variance_authority","import_clsx","import_tailwind_merge","cn","inputs","import_jsx_runtime","buttonVariants","Button","className","variant","size","asChild","props","ref","cn","import_jsx_runtime","STORAGE_KEY","getPreferredTheme","stored","applyTheme","mode","ThemeToggle","setMode","initial","Button","nextMode"]}
@@ -1,3 +1,3 @@
1
1
  "use client";
2
- "use client";import{useEffect as v,useState as y}from"react";import{Sun as w,Moon as x}from"lucide-react";import*as s from"react";import{Slot as g}from"@radix-ui/react-slot";import{cva as h}from"class-variance-authority";import{clsx as m}from"clsx";import{twMerge as f}from"tailwind-merge";function i(...e){return f(m(e))}import{jsx as b}from"react/jsx-runtime";var p=h("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"}}),r=s.forwardRef(({className:e,variant:o,size:a,asChild:t=!1,...l},u)=>b(t?g:"button",{className:i(p({variant:o,size:a,className:e})),ref:u,...l}));r.displayName="Button";import{jsx as n}from"react/jsx-runtime";var c="authdog-theme",k=()=>{if(typeof window>"u")return"light";let e=window.localStorage.getItem(c);return e==="light"||e==="dark"?e:window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"},d=e=>{document.documentElement.classList.toggle("dark",e==="dark")},H=()=>{let[e,o]=y("light");return v(()=>{let t=k();d(t),o(t)},[]),n(r,{variant:"ghost",size:"icon","aria-label":e==="dark"?"Switch to light theme":"Switch to dark theme",onClick:()=>{let t=e==="dark"?"light":"dark";d(t);try{window.localStorage.setItem(c,t)}catch{}o(t)},children:e==="dark"?n(w,{className:"h-4 w-4"}):n(x,{className:"h-4 w-4"})})};export{H as ThemeToggle};
2
+ "use client";import{useEffect as v,useState as y}from"react";import{Sun as w,Moon as x}from"lucide-react";import*as s from"react";import{Slot as g}from"@radix-ui/react-slot";import{cva as h}from"class-variance-authority";import{clsx as m}from"clsx";import{twMerge as f}from"tailwind-merge";function i(...e){return f(m(e))}import{jsx as b}from"react/jsx-runtime";var p=h("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"}}),r=s.forwardRef(({className:e,variant:o,size:a,asChild:t=!1,...l},u)=>b(t?g:"button",{className:i(p({variant:o,size:a,className:e})),ref:u,...l}));r.displayName="Button";import{jsx as n}from"react/jsx-runtime";var c="authdog-theme",k=()=>{if(typeof window>"u")return"light";let e=window.localStorage.getItem(c);return e==="light"||e==="dark"?e:window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"},d=e=>{document.documentElement.classList.toggle("dark",e==="dark")},H=()=>{let[e,o]=y("light");return v(()=>{let t=k();d(t),o(t)},[]),n(r,{variant:"ghost",size:"icon",className:"cursor-pointer","aria-label":e==="dark"?"Switch to light theme":"Switch to dark theme",onClick:()=>{let t=e==="dark"?"light":"dark";d(t);try{window.localStorage.setItem(c,t)}catch{}o(t)},children:e==="dark"?n(w,{className:"h-4 w-4"}):n(x,{className:"h-4 w-4"})})};export{H as ThemeToggle};
3
3
  //# sourceMappingURL=theme-toggle.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/ui/theme-toggle.tsx","../../../src/components/ui/button.tsx","../../../src/lib/utils.ts"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useState } from \"react\";\nimport { Sun, Moon } from \"lucide-react\";\n\nimport { Button } from \"./button\";\n\nconst STORAGE_KEY = \"authdog-theme\";\n\ntype ThemeMode = \"light\" | \"dark\";\n\nconst getPreferredTheme = (): ThemeMode => {\n if (typeof window === \"undefined\") return \"light\";\n const stored = window.localStorage.getItem(STORAGE_KEY);\n if (stored === \"light\" || stored === \"dark\") {\n return stored;\n }\n return window.matchMedia(\"(prefers-color-scheme: dark)\").matches ? \"dark\" : \"light\";\n};\n\nconst applyTheme = (mode: ThemeMode) => {\n document.documentElement.classList.toggle(\"dark\", mode === \"dark\");\n};\n\nexport const ThemeToggle = () => {\n const [mode, setMode] = useState<ThemeMode>(\"light\");\n\n useEffect(() => {\n const initial = getPreferredTheme();\n applyTheme(initial);\n setMode(initial);\n }, []);\n\n const toggle = () => {\n const nextMode: ThemeMode = mode === \"dark\" ? \"light\" : \"dark\";\n applyTheme(nextMode);\n try {\n window.localStorage.setItem(STORAGE_KEY, nextMode);\n } catch {\n // ignore\n }\n setMode(nextMode);\n };\n\n return (\n <Button\n variant=\"ghost\"\n size=\"icon\"\n aria-label={mode === \"dark\" ? \"Switch to light theme\" : \"Switch to dark theme\"}\n onClick={toggle}\n >\n {mode === \"dark\" ? <Sun className=\"h-4 w-4\" /> : <Moon className=\"h-4 w-4\" />}\n </Button>\n );\n};\n","import * as React from \"react\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\n\nimport { cn } from \"../../lib/utils\";\n\nconst buttonVariants = cva(\n \"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\",\n {\n variants: {\n variant: {\n default: \"bg-primary text-primary-foreground hover:bg-primary/90\",\n destructive:\n \"bg-destructive text-destructive-foreground hover:bg-destructive/90\",\n outline:\n \"border border-input bg-background hover:bg-accent hover:text-accent-foreground\",\n secondary:\n \"bg-secondary text-secondary-foreground hover:bg-secondary/80\",\n ghost: \"hover:bg-accent hover:text-accent-foreground\",\n link: \"text-primary underline-offset-4 hover:underline\",\n },\n size: {\n default: \"h-10 px-4 py-2\",\n sm: \"h-9 rounded-md px-3\",\n lg: \"h-11 rounded-md px-8\",\n icon: \"h-10 w-10\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\",\n },\n },\n);\n\nexport interface ButtonProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement>,\n VariantProps<typeof buttonVariants> {\n asChild?: boolean;\n}\n\nconst Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n ({ className, variant, size, asChild = false, ...props }, ref) => {\n const Comp = asChild ? Slot : \"button\";\n return (\n <Comp\n className={cn(buttonVariants({ variant, size, className }))}\n ref={ref}\n {...props}\n />\n );\n },\n);\nButton.displayName = \"Button\";\n\nexport { Button, buttonVariants };\n","import { type ClassValue, clsx } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n"],"mappings":";aAEA,OAAS,aAAAA,EAAW,YAAAC,MAAgB,QACpC,OAAS,OAAAC,EAAK,QAAAC,MAAY,eCH1B,UAAYC,MAAW,QACvB,OAAS,QAAAC,MAAY,uBACrB,OAAS,OAAAC,MAA8B,2BCFvC,OAA0B,QAAAC,MAAY,OACtC,OAAS,WAAAC,MAAe,iBAEjB,SAASC,KAAMC,EAAsB,CAC1C,OAAOF,EAAQD,EAAKG,CAAM,CAAC,CAC7B,CDwCM,cAAAC,MAAA,oBAvCN,IAAMC,EAAiBC,EACrB,yRACA,CACE,SAAU,CACR,QAAS,CACP,QAAS,yDACT,YACE,qEACF,QACE,iFACF,UACE,+DACF,MAAO,+CACP,KAAM,iDACR,EACA,KAAM,CACJ,QAAS,iBACT,GAAI,sBACJ,GAAI,uBACJ,KAAM,WACR,CACF,EACA,gBAAiB,CACf,QAAS,UACT,KAAM,SACR,CACF,CACF,EAQMC,EAAe,aACnB,CAAC,CAAE,UAAAC,EAAW,QAAAC,EAAS,KAAAC,EAAM,QAAAC,EAAU,GAAO,GAAGC,CAAM,EAAGC,IAGtDT,EAFWO,EAAUG,EAAO,SAE3B,CACC,UAAWC,EAAGV,EAAe,CAAE,QAAAI,EAAS,KAAAC,EAAM,UAAAF,CAAU,CAAC,CAAC,EAC1D,IAAKK,EACJ,GAAGD,EACN,CAGN,EACAL,EAAO,YAAc,SDFI,cAAAS,MAAA,oBA5CzB,IAAMC,EAAc,gBAIdC,EAAoB,IAAiB,CACzC,GAAI,OAAO,OAAW,IAAa,MAAO,QAC1C,IAAMC,EAAS,OAAO,aAAa,QAAQF,CAAW,EACtD,OAAIE,IAAW,SAAWA,IAAW,OAC5BA,EAEF,OAAO,WAAW,8BAA8B,EAAE,QAAU,OAAS,OAC9E,EAEMC,EAAcC,GAAoB,CACtC,SAAS,gBAAgB,UAAU,OAAO,OAAQA,IAAS,MAAM,CACnE,EAEaC,EAAc,IAAM,CAC/B,GAAM,CAACD,EAAME,CAAO,EAAIC,EAAoB,OAAO,EAEnD,OAAAC,EAAU,IAAM,CACd,IAAMC,EAAUR,EAAkB,EAClCE,EAAWM,CAAO,EAClBH,EAAQG,CAAO,CACjB,EAAG,CAAC,CAAC,EAcHV,EAACW,EAAA,CACC,QAAQ,QACR,KAAK,OACL,aAAYN,IAAS,OAAS,wBAA0B,uBACxD,QAhBW,IAAM,CACnB,IAAMO,EAAsBP,IAAS,OAAS,QAAU,OACxDD,EAAWQ,CAAQ,EACnB,GAAI,CACF,OAAO,aAAa,QAAQX,EAAaW,CAAQ,CACnD,MAAQ,CAER,CACAL,EAAQK,CAAQ,CAClB,EASK,SAAAP,IAAS,OAASL,EAACa,EAAA,CAAI,UAAU,UAAU,EAAKb,EAACc,EAAA,CAAK,UAAU,UAAU,EAC7E,CAEJ","names":["useEffect","useState","Sun","Moon","React","Slot","cva","clsx","twMerge","cn","inputs","jsx","buttonVariants","cva","Button","className","variant","size","asChild","props","ref","Slot","cn","jsx","STORAGE_KEY","getPreferredTheme","stored","applyTheme","mode","ThemeToggle","setMode","useState","useEffect","initial","Button","nextMode","Sun","Moon"]}
1
+ {"version":3,"sources":["../../../src/components/ui/theme-toggle.tsx","../../../src/components/ui/button.tsx","../../../src/lib/utils.ts"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useState } from \"react\";\nimport { Sun, Moon } from \"lucide-react\";\n\nimport { Button } from \"./button\";\n\nconst STORAGE_KEY = \"authdog-theme\";\n\ntype ThemeMode = \"light\" | \"dark\";\n\nconst getPreferredTheme = (): ThemeMode => {\n if (typeof window === \"undefined\") return \"light\";\n const stored = window.localStorage.getItem(STORAGE_KEY);\n if (stored === \"light\" || stored === \"dark\") {\n return stored;\n }\n return window.matchMedia(\"(prefers-color-scheme: dark)\").matches ? \"dark\" : \"light\";\n};\n\nconst applyTheme = (mode: ThemeMode) => {\n document.documentElement.classList.toggle(\"dark\", mode === \"dark\");\n};\n\nexport const ThemeToggle = () => {\n const [mode, setMode] = useState<ThemeMode>(\"light\");\n\n useEffect(() => {\n const initial = getPreferredTheme();\n applyTheme(initial);\n setMode(initial);\n }, []);\n\n const toggle = () => {\n const nextMode: ThemeMode = mode === \"dark\" ? \"light\" : \"dark\";\n applyTheme(nextMode);\n try {\n window.localStorage.setItem(STORAGE_KEY, nextMode);\n } catch {\n // ignore\n }\n setMode(nextMode);\n };\n\n return (\n <Button\n variant=\"ghost\"\n size=\"icon\"\n className=\"cursor-pointer\"\n aria-label={mode === \"dark\" ? \"Switch to light theme\" : \"Switch to dark theme\"}\n onClick={toggle}\n >\n {mode === \"dark\" ? <Sun className=\"h-4 w-4\" /> : <Moon className=\"h-4 w-4\" />}\n </Button>\n );\n};\n","import * as React from \"react\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\n\nimport { cn } from \"../../lib/utils\";\n\nconst buttonVariants = cva(\n \"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\",\n {\n variants: {\n variant: {\n default: \"bg-primary text-primary-foreground hover:bg-primary/90\",\n destructive:\n \"bg-destructive text-destructive-foreground hover:bg-destructive/90\",\n outline:\n \"border border-input bg-background hover:bg-accent hover:text-accent-foreground\",\n secondary:\n \"bg-secondary text-secondary-foreground hover:bg-secondary/80\",\n ghost: \"hover:bg-accent hover:text-accent-foreground\",\n link: \"text-primary underline-offset-4 hover:underline\",\n },\n size: {\n default: \"h-10 px-4 py-2\",\n sm: \"h-9 rounded-md px-3\",\n lg: \"h-11 rounded-md px-8\",\n icon: \"h-10 w-10\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\",\n },\n },\n);\n\nexport interface ButtonProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement>,\n VariantProps<typeof buttonVariants> {\n asChild?: boolean;\n}\n\nconst Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n ({ className, variant, size, asChild = false, ...props }, ref) => {\n const Comp = asChild ? Slot : \"button\";\n return (\n <Comp\n className={cn(buttonVariants({ variant, size, className }))}\n ref={ref}\n {...props}\n />\n );\n },\n);\nButton.displayName = \"Button\";\n\nexport { Button, buttonVariants };\n","import { type ClassValue, clsx } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n"],"mappings":";aAEA,OAAS,aAAAA,EAAW,YAAAC,MAAgB,QACpC,OAAS,OAAAC,EAAK,QAAAC,MAAY,eCH1B,UAAYC,MAAW,QACvB,OAAS,QAAAC,MAAY,uBACrB,OAAS,OAAAC,MAA8B,2BCFvC,OAA0B,QAAAC,MAAY,OACtC,OAAS,WAAAC,MAAe,iBAEjB,SAASC,KAAMC,EAAsB,CAC1C,OAAOF,EAAQD,EAAKG,CAAM,CAAC,CAC7B,CDwCM,cAAAC,MAAA,oBAvCN,IAAMC,EAAiBC,EACrB,yRACA,CACE,SAAU,CACR,QAAS,CACP,QAAS,yDACT,YACE,qEACF,QACE,iFACF,UACE,+DACF,MAAO,+CACP,KAAM,iDACR,EACA,KAAM,CACJ,QAAS,iBACT,GAAI,sBACJ,GAAI,uBACJ,KAAM,WACR,CACF,EACA,gBAAiB,CACf,QAAS,UACT,KAAM,SACR,CACF,CACF,EAQMC,EAAe,aACnB,CAAC,CAAE,UAAAC,EAAW,QAAAC,EAAS,KAAAC,EAAM,QAAAC,EAAU,GAAO,GAAGC,CAAM,EAAGC,IAGtDT,EAFWO,EAAUG,EAAO,SAE3B,CACC,UAAWC,EAAGV,EAAe,CAAE,QAAAI,EAAS,KAAAC,EAAM,UAAAF,CAAU,CAAC,CAAC,EAC1D,IAAKK,EACJ,GAAGD,EACN,CAGN,EACAL,EAAO,YAAc,SDDI,cAAAS,MAAA,oBA7CzB,IAAMC,EAAc,gBAIdC,EAAoB,IAAiB,CACzC,GAAI,OAAO,OAAW,IAAa,MAAO,QAC1C,IAAMC,EAAS,OAAO,aAAa,QAAQF,CAAW,EACtD,OAAIE,IAAW,SAAWA,IAAW,OAC5BA,EAEF,OAAO,WAAW,8BAA8B,EAAE,QAAU,OAAS,OAC9E,EAEMC,EAAcC,GAAoB,CACtC,SAAS,gBAAgB,UAAU,OAAO,OAAQA,IAAS,MAAM,CACnE,EAEaC,EAAc,IAAM,CAC/B,GAAM,CAACD,EAAME,CAAO,EAAIC,EAAoB,OAAO,EAEnD,OAAAC,EAAU,IAAM,CACd,IAAMC,EAAUR,EAAkB,EAClCE,EAAWM,CAAO,EAClBH,EAAQG,CAAO,CACjB,EAAG,CAAC,CAAC,EAcHV,EAACW,EAAA,CACC,QAAQ,QACR,KAAK,OACL,UAAU,iBACV,aAAYN,IAAS,OAAS,wBAA0B,uBACxD,QAjBW,IAAM,CACnB,IAAMO,EAAsBP,IAAS,OAAS,QAAU,OACxDD,EAAWQ,CAAQ,EACnB,GAAI,CACF,OAAO,aAAa,QAAQX,EAAaW,CAAQ,CACnD,MAAQ,CAER,CACAL,EAAQK,CAAQ,CAClB,EAUK,SAAAP,IAAS,OAASL,EAACa,EAAA,CAAI,UAAU,UAAU,EAAKb,EAACc,EAAA,CAAK,UAAU,UAAU,EAC7E,CAEJ","names":["useEffect","useState","Sun","Moon","React","Slot","cva","clsx","twMerge","cn","inputs","jsx","buttonVariants","cva","Button","className","variant","size","asChild","props","ref","Slot","cn","jsx","STORAGE_KEY","getPreferredTheme","stored","applyTheme","mode","ThemeToggle","setMode","useState","useEffect","initial","Button","nextMode","Sun","Moon"]}
package/dist/index.d.mts CHANGED
@@ -22,6 +22,14 @@ interface NavItem {
22
22
  href: string;
23
23
  disabled?: boolean;
24
24
  }
25
+ interface DropdownMenuItem {
26
+ name: string;
27
+ uri: string;
28
+ icon?: React__default.ComponentType<{
29
+ className?: string;
30
+ }>;
31
+ disabled?: boolean;
32
+ }
25
33
  interface NavbarProps {
26
34
  items?: NavItem[] | undefined;
27
35
  children?: React__default.ReactNode;
@@ -38,12 +46,25 @@ interface NavbarProps {
38
46
  user?: any;
39
47
  onNavigateHome?: () => void;
40
48
  onNavItemClick?: (href: string) => void;
49
+ /**
50
+ * Custom dropdown menu items that appear in the user avatar dropdown.
51
+ * If not provided, defaults to a "Profile" link.
52
+ */
53
+ dropdownMenuItems?: DropdownMenuItem[];
54
+ /**
55
+ * Callback when a dropdown menu item is clicked.
56
+ * Receives the URI of the clicked item.
57
+ */
58
+ onDropdownMenuItemClick?: (uri: string) => void;
59
+ /**
60
+ * @deprecated Use dropdownMenuItems with a custom item instead
61
+ */
41
62
  onProfileSelected?: () => void;
42
63
  onLogout?: () => void;
43
64
  identityHost?: string;
44
65
  environmentId?: string;
45
66
  }
46
- declare function Navbar({ items, children, className, logoText, logoSrc, altText, user, onNavigateHome, onNavItemClick, onProfileSelected, onLogout, isLoading, identityHost, environmentId, }: NavbarProps): react_jsx_runtime.JSX.Element;
67
+ declare function Navbar({ items, children, className, logoText, logoSrc, altText, user, onNavigateHome, onNavItemClick, dropdownMenuItems, onDropdownMenuItemClick, onProfileSelected, onLogout, isLoading, identityHost, environmentId, }: NavbarProps): react_jsx_runtime.JSX.Element;
47
68
 
48
69
  interface UserProfileProps {
49
70
  loading: boolean;
@@ -112,4 +133,4 @@ interface TOTPValidatorProps {
112
133
  }
113
134
  declare const TOTPValidator: ({ onValidate }: TOTPValidatorProps) => react_jsx_runtime.JSX.Element;
114
135
 
115
- export { Button, ClientOnly, Navbar, PlaceholderAlert, TOTPValidator, UserDropdown, UserProfile };
136
+ export { Button, ClientOnly, type DropdownMenuItem, type NavItem, Navbar, PlaceholderAlert, TOTPValidator, UserDropdown, UserProfile };
package/dist/index.d.ts CHANGED
@@ -22,6 +22,14 @@ interface NavItem {
22
22
  href: string;
23
23
  disabled?: boolean;
24
24
  }
25
+ interface DropdownMenuItem {
26
+ name: string;
27
+ uri: string;
28
+ icon?: React__default.ComponentType<{
29
+ className?: string;
30
+ }>;
31
+ disabled?: boolean;
32
+ }
25
33
  interface NavbarProps {
26
34
  items?: NavItem[] | undefined;
27
35
  children?: React__default.ReactNode;
@@ -38,12 +46,25 @@ interface NavbarProps {
38
46
  user?: any;
39
47
  onNavigateHome?: () => void;
40
48
  onNavItemClick?: (href: string) => void;
49
+ /**
50
+ * Custom dropdown menu items that appear in the user avatar dropdown.
51
+ * If not provided, defaults to a "Profile" link.
52
+ */
53
+ dropdownMenuItems?: DropdownMenuItem[];
54
+ /**
55
+ * Callback when a dropdown menu item is clicked.
56
+ * Receives the URI of the clicked item.
57
+ */
58
+ onDropdownMenuItemClick?: (uri: string) => void;
59
+ /**
60
+ * @deprecated Use dropdownMenuItems with a custom item instead
61
+ */
41
62
  onProfileSelected?: () => void;
42
63
  onLogout?: () => void;
43
64
  identityHost?: string;
44
65
  environmentId?: string;
45
66
  }
46
- declare function Navbar({ items, children, className, logoText, logoSrc, altText, user, onNavigateHome, onNavItemClick, onProfileSelected, onLogout, isLoading, identityHost, environmentId, }: NavbarProps): react_jsx_runtime.JSX.Element;
67
+ declare function Navbar({ items, children, className, logoText, logoSrc, altText, user, onNavigateHome, onNavItemClick, dropdownMenuItems, onDropdownMenuItemClick, onProfileSelected, onLogout, isLoading, identityHost, environmentId, }: NavbarProps): react_jsx_runtime.JSX.Element;
47
68
 
48
69
  interface UserProfileProps {
49
70
  loading: boolean;
@@ -112,4 +133,4 @@ interface TOTPValidatorProps {
112
133
  }
113
134
  declare const TOTPValidator: ({ onValidate }: TOTPValidatorProps) => react_jsx_runtime.JSX.Element;
114
135
 
115
- export { Button, ClientOnly, Navbar, PlaceholderAlert, TOTPValidator, UserDropdown, UserProfile };
136
+ export { Button, ClientOnly, type DropdownMenuItem, type NavItem, Navbar, PlaceholderAlert, TOTPValidator, UserDropdown, UserProfile };
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
1
  "use client";
2
- "use strict";var rt=Object.create;var Z=Object.defineProperty;var at=Object.getOwnPropertyDescriptor;var nt=Object.getOwnPropertyNames;var it=Object.getPrototypeOf,st=Object.prototype.hasOwnProperty;var dt=(e,t)=>{for(var r in t)Z(e,r,{get:t[r],enumerable:!0})},ye=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let c of nt(t))!st.call(e,c)&&c!==r&&Z(e,c,{get:()=>t[c],enumerable:!(i=at(t,c))||i.enumerable});return e};var O=(e,t,r)=>(r=e!=null?rt(it(e)):{},ye(t||!e||!e.__esModule?Z(r,"default",{value:e,enumerable:!0}):r,e)),lt=e=>ye(Z({},"__esModule",{value:!0}),e);var Dt={};dt(Dt,{Button:()=>x,ClientOnly:()=>Me,Navbar:()=>Le,PlaceholderAlert:()=>et,TOTPValidator:()=>tt,UserDropdown:()=>Xe,UserProfile:()=>qe});module.exports=lt(Dt);var Pe=O(require("react")),Ce=require("@radix-ui/react-slot"),Re=require("class-variance-authority");var we=require("clsx"),Ne=require("tailwind-merge");function n(...e){return(0,Ne.twMerge)((0,we.clsx)(e))}var ke=require("react/jsx-runtime"),mt=(0,Re.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=Pe.forwardRef(({className:e,variant:t,size:r,asChild:i=!1,...c},y)=>(0,ke.jsx)(i?Ce.Slot:"button",{className:n(mt({variant:t,size:r,className:e})),ref:y,...c}));x.displayName="Button";var ee=require("react"),te=require("react/jsx-runtime"),Me=({children:e})=>{let[t,r]=(0,ee.useState)(!1);return(0,ee.useEffect)(()=>{r(!0)},[]),t?(0,te.jsx)(te.Fragment,{children:e}):null};var be=require("react"),$=require("lucide-react");var F=O(require("@radix-ui/react-avatar"));var oe=require("react/jsx-runtime");function _({className:e,...t}){return(0,oe.jsx)(F.Root,{"data-slot":"avatar",className:n("relative flex size-8 shrink-0 overflow-hidden rounded-full",e),...t})}function W({className:e,...t}){return(0,oe.jsx)(F.Image,{"data-slot":"avatar-image",className:n("aspect-square size-full",e),...t})}function j({className:e,...t}){return(0,oe.jsx)(F.Fallback,{"data-slot":"avatar-fallback",className:n("bg-muted flex size-full items-center justify-center rounded-full",e),...t})}var N=O(require("react")),s=O(require("@radix-ui/react-dropdown-menu")),U=require("lucide-react");var v=require("react/jsx-runtime"),ct=U.Check,pt=U.Circle,ut=U.ChevronRight;function re({...e}){return(0,v.jsx)(s.Root,{"data-slot":"dropdown-menu",...e})}var H=N.forwardRef(({...e},t)=>(0,v.jsx)(s.Trigger,{ref:t,"data-slot":"dropdown-menu-trigger",...e}));H.displayName=s.Trigger.displayName;var Q=N.forwardRef(({className:e,sideOffset:t=4,...r},i)=>(0,v.jsx)(s.Portal,{children:(0,v.jsx)(s.Content,{ref:i,"data-slot":"dropdown-menu-content",sideOffset:t,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",e),...r})}));Q.displayName=s.Content.displayName;var ve=N.forwardRef(({...e},t)=>(0,v.jsx)(s.Group,{ref:t,"data-slot":"dropdown-menu-group",...e}));ve.displayName=s.Group.displayName;var A=N.forwardRef(({className:e,inset:t,variant:r="default",...i},c)=>(0,v.jsx)(s.Item,{ref:c,"data-slot":"dropdown-menu-item","data-inset":t,"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",e),...i}));A.displayName=s.Item.displayName;var ft=N.forwardRef(({className:e,children:t,checked:r,...i},c)=>(0,v.jsxs)(s.CheckboxItem,{ref:c,"data-slot":"dropdown-menu-checkbox-item",className:n("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:[(0,v.jsx)("span",{className:"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",children:(0,v.jsx)(s.ItemIndicator,{children:(0,v.jsx)(ct,{className:"size-4"})})}),t]}));ft.displayName=s.CheckboxItem.displayName;var vt=N.forwardRef(({...e},t)=>(0,v.jsx)(s.RadioGroup,{ref:t,"data-slot":"dropdown-menu-radio-group",...e}));vt.displayName=s.RadioGroup.displayName;var gt=N.forwardRef(({className:e,children:t,...r},i)=>(0,v.jsxs)(s.RadioItem,{ref:i,"data-slot":"dropdown-menu-radio-item",className:n("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:[(0,v.jsx)("span",{className:"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",children:(0,v.jsx)(s.ItemIndicator,{children:(0,v.jsx)(pt,{className:"size-2 fill-current"})})}),t]}));gt.displayName=s.RadioItem.displayName;var ge=N.forwardRef(({className:e,inset:t,...r},i)=>(0,v.jsx)(s.Label,{ref:i,"data-slot":"dropdown-menu-label","data-inset":t,className:n("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",e),...r}));ge.displayName=s.Label.displayName;var L=N.forwardRef(({className:e,...t},r)=>(0,v.jsx)(s.Separator,{ref:r,"data-slot":"dropdown-menu-separator",className:n("bg-border -mx-1 my-1 h-px",e),...t}));L.displayName=s.Separator.displayName;var bt=N.forwardRef(({className:e,...t},r)=>(0,v.jsx)("span",{ref:r,"data-slot":"dropdown-menu-shortcut",className:n("text-muted-foreground ml-auto text-xs tracking-widest",e),...t}));bt.displayName="DropdownMenuShortcut";var xt=N.forwardRef(({className:e,inset:t,children:r,...i},c)=>(0,v.jsxs)(s.SubTrigger,{ref:c,"data-slot":"dropdown-menu-sub-trigger","data-inset":t,className:n("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,(0,v.jsx)(ut,{className:"ml-auto size-4"})]}));xt.displayName=s.SubTrigger.displayName;var ht=N.forwardRef(({className:e,...t},r)=>(0,v.jsx)(s.SubContent,{ref:r,"data-slot":"dropdown-menu-sub-content",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 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg",e),...t}));ht.displayName=s.SubContent.displayName;var h=O(require("@radix-ui/react-dialog")),De=require("lucide-react");var P=require("react/jsx-runtime"),yt=De.X;function Se({...e}){return(0,P.jsx)(h.Root,{"data-slot":"sheet",...e})}function Te({...e}){return(0,P.jsx)(h.Trigger,{"data-slot":"sheet-trigger",...e})}function wt({...e}){return(0,P.jsx)(h.Portal,{"data-slot":"sheet-portal",...e})}function Nt({className:e,...t}){return(0,P.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",e),...t})}function Ie({className:e,children:t,side:r="right",...i}){return(0,P.jsxs)(wt,{children:[(0,P.jsx)(Nt,{}),(0,P.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",e),...i,children:[t,(0,P.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,P.jsx)(yt,{className:"size-4"}),(0,P.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})}var ne=require("react"),ae=require("react/jsx-runtime"),Pt={className:"mr-2 h-4 w-4","aria-hidden":"true"},K=({Icon:e})=>{let[t,r]=(0,ne.useState)(!1);return(0,ne.useEffect)(()=>{r(!0)},[]),(0,ae.jsx)("span",{className:"inline-flex items-center justify-center",children:t?(0,ae.jsx)(e,{...Pt}):(0,ae.jsx)("span",{className:"mr-2 h-4 w-4","aria-hidden":"true"})})};var se=require("react"),de=require("lucide-react");var ie=require("react/jsx-runtime"),Ee="authdog-theme",Ct=()=>{if(typeof window>"u")return"light";let e=window.localStorage.getItem(Ee);return e==="light"||e==="dark"?e:window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"},Ae=e=>{document.documentElement.classList.toggle("dark",e==="dark")},Ve=()=>{let[e,t]=(0,se.useState)("light");return(0,se.useEffect)(()=>{let i=Ct();Ae(i),t(i)},[]),(0,ie.jsx)(x,{variant:"ghost",size:"icon","aria-label":e==="dark"?"Switch to light theme":"Switch to dark theme",onClick:()=>{let i=e==="dark"?"light":"dark";Ae(i);try{window.localStorage.setItem(Ee,i)}catch{}t(i)},children:e==="dark"?(0,ie.jsx)(de.Sun,{className:"h-4 w-4"}):(0,ie.jsx)(de.Moon,{className:"h-4 w-4"})})};var a=require("react/jsx-runtime");function Le({items:e=[],children:t,className:r,logoText:i="ACME Corp",logoSrc:c,altText:y,user:g={name:"John Doe",email:"john@example.com",image:"https://i.pravatar.cc/150?u=a042581f4e29026704d"},onNavigateHome:E=()=>console.log("Navigating to home"),onNavItemClick:w=M=>console.log(`Navigating to ${M}`),onProfileSelected:C,onLogout:V=()=>console.log("Logout clicked"),isLoading:R=!1,identityHost:S="https://stg-id.authdog.xyz",environmentId:k="58be35b0-708f-49f6-84f0-6695d307d997"}){let[M,p]=(0,be.useState)(!1),[f,b]=(0,be.useState)(!1),T=g!=null&&g.id!==null&&g.id!==void 0;return(0,a.jsx)("header",{className:n("w-full border-b bg-background",r),children:(0,a.jsxs)("div",{className:n("mx-auto flex h-16 w-full max-w-6xl items-center justify-between px-4 md:px-6"),children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 md:gap-4",children:[(0,a.jsxs)("button",{type:"button",onClick:E,className:n("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:[c&&!f&&(0,a.jsx)("span",{className:"inline-flex h-8 w-8 items-center justify-center overflow-hidden rounded-md bg-muted/80 ring-1 ring-border",children:(0,a.jsx)("img",{src:c,alt:i,className:"h-7 w-7 object-contain",onError:()=>b(!0)})}),y??(0,a.jsx)("span",{className:"text-base font-semibold tracking-tight md:text-lg group-hover:text-primary",children:i})]}),t]}),(0,a.jsxs)("div",{className:"flex flex-1 items-center justify-end gap-6",children:[(0,a.jsx)("nav",{className:"hidden md:flex items-center gap-6",children:e?.map((m,l)=>(0,a.jsx)("span",{onClick:()=>{m.disabled||w(m.href)},className:n("text-sm font-medium transition-colors hover:text-primary cursor-pointer",m.disabled&&"cursor-not-allowed opacity-80"),children:m.title},l))}),(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsxs)(Se,{open:M,onOpenChange:p,children:[(0,a.jsx)(Te,{asChild:!0,children:(0,a.jsx)(x,{variant:"ghost",size:"icon",className:"md:hidden","aria-label":"Open Menu",children:(0,a.jsx)(K,{Icon:$.Menu})})}),(0,a.jsx)(Ie,{side:"left",className:"pr-0",children:(0,a.jsx)("nav",{className:"grid gap-2 py-6",children:e?.map((m,l)=>(0,a.jsx)("a",{href:m.href,className:n("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:()=>p(!1),children:m.title},l))})})]}),(0,a.jsx)(Ve,{}),T?(0,a.jsxs)(re,{children:[(0,a.jsx)(H,{asChild:!0,children:(0,a.jsx)(x,{variant:"ghost",className:"relative h-8 w-8 rounded-full",disabled:R,children:(0,a.jsx)(_,{className:"h-8 w-8",children:R?(0,a.jsx)("div",{className:"h-8 w-8 animate-pulse bg-muted rounded-full"}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(W,{src:g.photos?.[0]?.value||"/placeholder.svg",alt:g.displayName}),(0,a.jsx)(j,{children:g.displayName?.charAt(0)})]})})})}),(0,a.jsx)(Q,{className:"w-56",align:"end",forceMount:!0,children:R?(0,a.jsxs)("div",{className:"p-4",children:[(0,a.jsx)("div",{className:"h-4 w-3/4 animate-pulse bg-muted rounded mb-2"}),(0,a.jsx)("div",{className:"h-3 w-1/2 animate-pulse bg-muted rounded"})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(ge,{className:"font-normal",children:(0,a.jsxs)("div",{className:"flex flex-col space-y-1",children:[(0,a.jsx)("p",{className:"text-sm font-medium leading-none",children:g.displayName}),(0,a.jsx)("p",{className:"text-xs leading-none text-muted-foreground",children:g.emails?.[0]?.value})]})}),(0,a.jsx)(L,{}),(0,a.jsx)(ve,{children:(0,a.jsxs)(A,{onClick:C,children:[(0,a.jsx)(K,{Icon:$.User}),(0,a.jsx)("span",{children:"Profile"})]})}),(0,a.jsx)(L,{}),(0,a.jsxs)(A,{onClick:V,children:[(0,a.jsx)(K,{Icon:$.LogOut}),(0,a.jsx)("span",{children:"Log out"})]})]})})]}):(0,a.jsx)(x,{variant:"default","aria-label":"Sign in",onClick:()=>{if(!k)throw new Error("Environment ID is required");if(!S)throw new Error("Identity Host is required");let m=`${S}/signin/${k}`;window.open(m,"_blank")},children:"Sign in"})]})]})]})})}var D=require("react");var ze=require("@radix-ui/react-slot"),Be=require("class-variance-authority");var Ge=require("react/jsx-runtime"),Rt=(0,Be.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 le({className:e,variant:t,asChild:r=!1,...i}){return(0,Ge.jsx)(r?ze.Slot:"span",{"data-slot":"badge",className:n(Rt({variant:t}),e),...i})}var z=require("react/jsx-runtime");function Y({className:e,...t}){return(0,z.jsx)("div",{"data-slot":"card",className:n("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",e),...t})}function Oe({className:e,...t}){return(0,z.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",e),...t})}function Fe({className:e,...t}){return(0,z.jsx)("div",{"data-slot":"card-title",className:n("leading-none font-semibold",e),...t})}function _e({className:e,...t}){return(0,z.jsx)("div",{"data-slot":"card-description",className:n("text-muted-foreground text-sm",e),...t})}function q({className:e,...t}){return(0,z.jsx)("div",{"data-slot":"card-content",className:n("px-6",e),...t})}function We({className:e,...t}){return(0,z.jsx)("div",{"data-slot":"card-footer",className:n("flex items-center px-6 [.border-t]:pt-6",e),...t})}var Ue=require("react/jsx-runtime");function je({className:e,type:t,...r}){return(0,Ue.jsx)("input",{type:t,"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",e),...r})}var He=O(require("@radix-ui/react-label"));var $e=require("react/jsx-runtime");function Ke({className:e,...t}){return(0,$e.jsx)(He.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",e),...t})}var Ye=require("lucide-react"),o=require("react/jsx-runtime"),qe=({loading:e,user:t,handleAuthenticated:r,onRequestEmailVerification:i,onVerifyEmail:c,onAddEmail:y})=>{let[g,E]=(0,D.useState)(!1),[w,C]=(0,D.useState)("profile"),[V,R]=(0,D.useState)(null),[S,k]=(0,D.useState)({}),[M,p]=(0,D.useState)(!1),[f,b]=(0,D.useState)("");(0,D.useEffect)(()=>{E(!0)},[]),(0,D.useEffect)(()=>{!e&&r&&r()},[e,t,r]);let T={className:"mr-2 h-4 w-4","aria-hidden":"true"},m=l=>g?(0,o.jsx)(l,{...T}):null;return!g||e?(0,o.jsx)("div",{children:"Loading..."}):t?(0,o.jsxs)("div",{className:"grid grid-cols-[14rem,1fr] w-full bg-transparent",children:[(0,o.jsxs)("div",{className:"h-full border-r border-border p-3 md:p-4 bg-transparent flex flex-col min-w-0",children:[(0,o.jsxs)("div",{className:"mb-3 md:mb-4",children:[(0,o.jsx)("h1",{className:"text-xl font-bold text-foreground",children:"Account"}),(0,o.jsx)("p",{className:"text-sm text-muted-foreground",children:"Manage your account info."})]}),(0,o.jsx)("nav",{className:"space-y-1 flex-1",children:(0,o.jsxs)("button",{onClick:()=>C("profile"),className:`flex items-center w-full px-3 py-2 text-sm rounded-md ${w==="profile"?"bg-muted text-foreground":"text-muted-foreground hover:bg-muted/50"}`,children:[m(Ye.User),"Profile"]})})]}),(0,o.jsxs)("div",{className:"h-full p-3 md:p-5 min-w-0 bg-transparent",children:[(0,o.jsx)("div",{className:"flex justify-between items-center mb-3 md:mb-4",children:(0,o.jsx)("h2",{className:"text-xl font-semibold text-foreground",children:w==="profile"?"Profile details":w==="security"?"Security settings":"Preferences"})}),w==="profile"?(0,o.jsxs)("div",{className:"space-y-5 md:space-y-6",children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("h3",{className:"text-sm font-medium mb-3 text-foreground",children:"Profile"}),(0,o.jsx)("div",{className:"flex items-center justify-between",children:(0,o.jsxs)("div",{className:"flex items-center",children:[(0,o.jsxs)(_,{className:"h-12 w-12 mr-4 border",children:[(0,o.jsx)(W,{src:t.photos?.[0]?.value,alt:"Profile picture"}),(0,o.jsx)(j,{children:t.displayName?.split(" ").map(l=>l[0]).join("")})]}),(0,o.jsx)("span",{className:"font-medium text-foreground",children:t.displayName})]})})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)("h3",{className:"text-sm font-medium mb-3 text-foreground",children:"Email addresses"}),(0,o.jsxs)("div",{className:"space-y-2.5",children:[t.emails.map((l,I)=>{let xe=(t?.verifications||[]).find(fe=>fe.email===l.value)?.verified===!0,he=S[l.value]||"";return(0,o.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,o.jsxs)("div",{className:"flex flex-col",children:[(0,o.jsx)("span",{className:"text-foreground",children:l.value}),(0,o.jsx)("div",{className:"mt-1",children:xe?(0,o.jsx)(le,{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,o.jsx)(le,{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,o.jsxs)("div",{className:"flex items-center gap-2",children:[I===0&&(0,o.jsx)(le,{variant:"outline",className:"text-xs bg-muted text-foreground hover:bg-muted",children:"Primary"}),!xe&&(0,o.jsx)(o.Fragment,{children:V===l.value?(0,o.jsxs)("div",{className:"flex items-center gap-1",children:[(0,o.jsx)("input",{className:"h-7 w-24 text-sm rounded-md border border-border bg-background px-2 text-foreground",placeholder:"Code",value:he,onChange:fe=>k(ot=>({...ot,[l.value]:fe.target.value}))}),(0,o.jsx)("button",{className:"h-7 rounded-md border border-border px-2 text-xs",onClick:async()=>{c&&await c(l.value,he)},children:"Verify"}),(0,o.jsx)("button",{className:"h-7 rounded-md border border-border px-2 text-xs",onClick:()=>R(null),children:"Cancel"})]}):(0,o.jsx)(o.Fragment,{children:(0,o.jsx)("button",{className:"h-7 rounded-md border border-border px-2 text-xs",onClick:async()=>{i&&await i(l.value),R(l.value)},children:"Send code"})})})]})]},l.value)}),(0,o.jsx)("div",{className:"mt-2",children:M?(0,o.jsx)("div",{className:"max-w-md",children:(0,o.jsxs)(Y,{children:[(0,o.jsxs)(Oe,{children:[(0,o.jsx)(Fe,{children:"Add email address"}),(0,o.jsx)(_e,{children:"You'll need to verify this email address before it can be added to your account."})]}),(0,o.jsx)(q,{children:(0,o.jsxs)("div",{className:"space-y-2",children:[(0,o.jsx)(Ke,{htmlFor:"new-email",children:"Email address"}),(0,o.jsx)(je,{id:"new-email",placeholder:"Enter your email address",value:f,onChange:l=>b(l.target.value),onKeyDown:async l=>{if(l.key==="Enter"){let I=String(f||"").trim().toLowerCase();if(!I)return;y&&await y(I),p(!1),b("")}}})]})}),(0,o.jsxs)(We,{className:"justify-end gap-2",children:[(0,o.jsx)(x,{variant:"ghost",onClick:()=>{p(!1),b("")},children:"Cancel"}),(0,o.jsx)(x,{onClick:async()=>{let l=String(f||"").trim().toLowerCase();l&&(y&&await y(l),p(!1),b(""))},children:"Add"})]})]})}):(0,o.jsx)(x,{variant:"outline",size:"sm",className:"text-xs",onClick:()=>p(!0),children:"Add email"})})]})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)("h3",{className:"text-sm font-medium mb-3 text-gray-900 dark:text-gray-100",children:"Connected accounts"}),(0,o.jsx)("div",{className:"space-y-2.5",children:(0,o.jsxs)("div",{className:"flex items-center justify-between",children:[(0,o.jsx)("div",{className:"flex items-center",children:(0,o.jsx)("div",{className:"mr-2",children:(0,o.jsx)("span",{className:"text-gray-900 dark:text-gray-100",children:t.provider})})}),(0,o.jsx)("span",{className:"text-sm text-gray-500 dark:text-gray-400",children:t?.emails?.[0]?.value})]},t.provider)})]})]}):w==="security"?(0,o.jsxs)("div",{className:"space-y-5 md:space-y-6",children:[(0,o.jsx)("div",{className:"border rounded-md overflow-hidden",children:(0,o.jsxs)("div",{className:"flex items-center justify-between px-4 py-3",children:[(0,o.jsx)("div",{className:"text-sm text-gray-700 dark:text-gray-300",children:"Password"}),(0,o.jsx)("button",{className:"text-sm text-indigo-600 hover:underline",children:"Set password"})]})}),(0,o.jsx)("div",{className:"border rounded-md overflow-hidden",children:(0,o.jsxs)("div",{className:"flex items-center justify-between px-4 py-3",children:[(0,o.jsx)("div",{className:"text-sm text-gray-700 dark:text-gray-300",children:"Passkeys"}),(0,o.jsx)("button",{className:"text-sm text-indigo-600 hover:underline",children:"+\xA0Add a passkey"})]})}),(0,o.jsx)("div",{className:"border rounded-md overflow-hidden",children:(0,o.jsxs)("div",{className:"flex items-center justify-between px-4 py-3",children:[(0,o.jsx)("div",{className:"text-sm text-gray-700 dark:text-gray-300",children:"Two-step verification"}),(0,o.jsx)("button",{className:"text-sm text-indigo-600 hover:underline",children:"+\xA0Add two-step verification"})]})}),(0,o.jsxs)("div",{className:"border rounded-md overflow-hidden",children:[(0,o.jsx)("div",{className:"px-4 py-3 border-b text-sm font-medium text-gray-900 dark:text-gray-100",children:"Active devices"}),(0,o.jsx)("div",{className:"p-4 space-y-3",children:(0,o.jsxs)("div",{className:"text-sm",children:[(0,o.jsxs)("div",{className:"flex items-center gap-2",children:[(0,o.jsx)("span",{className:"inline-block h-5 w-5 rounded-sm bg-gray-900 dark:bg-white"}),(0,o.jsx)("span",{className:"font-medium",children:"X11"}),(0,o.jsx)("span",{className:"text-xs rounded-md border px-2 py-0.5 text-gray-600 dark:text-gray-300",children:"This device"})]}),(0,o.jsx)("div",{className:"text-gray-600 dark:text-gray-400 mt-1",children:"Firefox 142.0"}),(0,o.jsx)("div",{className:"text-gray-600 dark:text-gray-400",children:"127.0.0.1 (Local), (Your City)"}),(0,o.jsx)("div",{className:"text-gray-600 dark:text-gray-400",children:"Today at 7:08 PM"})]})})]}),(0,o.jsx)("div",{className:"border rounded-md overflow-hidden",children:(0,o.jsxs)("div",{className:"flex items-center justify-between px-4 py-3",children:[(0,o.jsx)("div",{className:"text-sm text-gray-700 dark:text-gray-300",children:"Delete account"}),(0,o.jsx)("button",{className:"text-sm text-red-600 hover:underline",children:"Delete account"})]})})]}):(0,o.jsx)("div",{className:"space-y-5 md:space-y-6",children:(0,o.jsxs)("div",{children:[(0,o.jsx)("h3",{className:"text-sm font-medium mb-3 text-gray-900 dark:text-gray-100",children:"Preferences"}),(0,o.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,o.jsxs)("div",{className:"flex items-center justify-between",children:[(0,o.jsx)("span",{className:"text-gray-700 dark:text-gray-300",children:"Locale"}),(0,o.jsx)("span",{className:"text-gray-500 dark:text-gray-400",children:"Auto"})]}),(0,o.jsxs)("div",{className:"flex items-center justify-between",children:[(0,o.jsx)("span",{className:"text-gray-700 dark:text-gray-300",children:"Theme"}),(0,o.jsx)("span",{className:"text-gray-500 dark:text-gray-400",children:"System"})]})]})]})})]})]}):(0,o.jsx)("div",{children:"No user"})};var X=require("lucide-react"),u=require("react/jsx-runtime"),kt=e=>e&&String(e).trim().split(/\s+/).slice(0,2).map(i=>i[0]?.toUpperCase()).join("")||"?",Xe=({trigger:e,user:t,className:r,onManageAccount:i,onSignout:c,links:y=[],side:g="bottom",align:E="end",sideOffset:w=8,modal:C=!1,triggerAsChild:V=!1,triggerWrapperClassName:R})=>{let S=t?.emails?.[0]?.value||t?.email||"",k=t?.displayName||t?.name||"",M=t?.photos?.[0]?.value||t?.avatar||"",p=m=>{if(m.onClick)return m.onClick();m.href&&(m.href.startsWith("http")?window.open(m.href,"_blank"):window.location.assign(m.href))},f=X.ExternalLink,b=X.Settings,T=X.LogOut;return(0,u.jsxs)(re,{modal:C,children:[V?(0,u.jsx)(H,{asChild:!0,children:e}):(0,u.jsx)(H,{className:n("inline-flex items-center justify-center bg-transparent p-0 border-0 outline-none focus-visible:outline-none",R),children:e}),(0,u.jsxs)(Q,{align:E,side:g,sideOffset:w,className:n("w-72 p-2 overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md",r),children:[(0,u.jsxs)("div",{className:"flex items-center gap-3 px-4 pt-4 pb-3",children:[(0,u.jsxs)(_,{className:"h-9 w-9 rounded-full",children:[(0,u.jsx)(W,{src:M,alt:k}),(0,u.jsx)(j,{className:"rounded-full",children:kt(k)})]}),(0,u.jsxs)("div",{className:"min-w-0",children:[(0,u.jsx)("div",{className:"text-sm font-semibold truncate",children:k}),(0,u.jsx)("div",{className:"text-xs text-muted-foreground truncate",children:S})]})]}),(0,u.jsx)(L,{}),(0,u.jsxs)(A,{className:"cursor-pointer py-2",onClick:()=>i?.(),children:[(0,u.jsx)(b,{className:"mr-2 h-4 w-4"}),(0,u.jsx)("span",{children:"Manage account"})]}),y.map((m,l)=>{let I=m.icon??f;return(0,u.jsxs)(A,{className:"cursor-pointer py-2",onClick:()=>p(m),children:[(0,u.jsx)(I,{className:"mr-2 h-4 w-4"}),(0,u.jsx)("span",{children:m.label})]},`${m.label}-${l}`)}),(0,u.jsx)(L,{}),(0,u.jsxs)(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:()=>c?.(),children:[(0,u.jsx)(T,{className:"mr-2 h-4 w-4 text-red-600 dark:text-red-300"}),(0,u.jsx)("span",{children:"Sign out"})]})]})]})};var Ze=require("lucide-react");var Je=require("class-variance-authority");var pe=require("react/jsx-runtime"),Mt=(0,Je.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 me({className:e,variant:t,...r}){return(0,pe.jsx)("div",{"data-slot":"alert",role:"alert",className:n(Mt({variant:t}),e),...r})}function Qe({className:e,...t}){return(0,pe.jsx)("div",{"data-slot":"alert-title",className:n("col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight",e),...t})}function ce({className:e,...t}){return(0,pe.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",e),...t})}var B=require("react/jsx-runtime"),et=e=>{let t=e.title??"Placeholder Alert",r=e.description??"This is a placeholder alert.";return(0,B.jsx)("div",{className:"grid w-full max-w-xl items-start gap-4",children:(0,B.jsxs)(me,{children:[(0,B.jsx)(K,{Icon:Ze.CheckCircle2Icon}),(0,B.jsx)(Qe,{children:t}),(0,B.jsx)(ce,{children:r})]})})};var G=require("react");var J=require("lucide-react"),d=require("react/jsx-runtime"),tt=({onValidate:e})=>{let[t,r]=(0,G.useState)(["","","","","",""]),[i,c]=(0,G.useState)(!1),[y,g]=(0,G.useState)(""),[E,w]=(0,G.useState)(!1),C=(0,G.useRef)([]),V=(p,f)=>{if(!/^\d*$/.test(f))return;let b=[...t];b[p]=f.slice(-1),r(b),g(""),w(!1),f&&p<5&&C.current[p+1]?.focus()},R=(p,f)=>{f.key==="Backspace"&&!t[p]&&p>0&&C.current[p-1]?.focus(),f.key==="v"&&(f.ctrlKey||f.metaKey)&&(f.preventDefault(),navigator.clipboard.readText().then(b=>{let T=b.replace(/\D/g,"").slice(0,6).split(""),m=[...t];T.forEach((I,ue)=>{ue<6&&(m[ue]=I)}),r(m);let l=Math.min(T.length,5);C.current[l]?.focus()}))},S=async()=>{let p=t.join("");if(p.length!==6){g("Please enter all 6 digits");return}c(!0),g("");try{await e(p),w(!0)}catch{g("Invalid TOTP code. Please try again.")}finally{c(!1)}},k=p=>{p.preventDefault(),S()},M=()=>{r(["","","","","",""]),g(""),w(!1),c(!1),C.current[0]?.focus()};return E?(0,d.jsx)("div",{className:"max-w-md mx-auto",children:(0,d.jsx)(Y,{className:"border-green-200 bg-green-50",children:(0,d.jsx)(q,{className:"pt-6",children:(0,d.jsxs)("div",{className:"text-center space-y-4",children:[(0,d.jsx)("div",{className:"mx-auto w-16 h-16 bg-green-100 rounded-full flex items-center justify-center",children:(0,d.jsx)(J.CheckCircle,{className:"w-8 h-8 text-green-600"})}),(0,d.jsxs)("div",{children:[(0,d.jsx)("h3",{className:"text-lg font-semibold text-green-900",children:"Verification Successful!"}),(0,d.jsx)("p",{className:"text-sm text-green-700 mt-1",children:"Your TOTP code has been validated."})]}),(0,d.jsx)(x,{onClick:M,variant:"outline",className:"bg-white",children:"Verify Another Code"})]})})})}):(0,d.jsx)("div",{className:"max-w-md mx-auto",children:(0,d.jsx)(Y,{children:(0,d.jsx)(q,{className:"pt-6",children:(0,d.jsxs)("div",{className:"text-center space-y-6",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("div",{className:"mx-auto w-12 h-12 bg-blue-100 rounded-full flex items-center justify-center mb-4",children:(0,d.jsx)(J.Shield,{className:"w-6 h-6 text-blue-600"})}),(0,d.jsx)("h3",{className:"text-lg font-semibold",children:"Enter Verification Code"}),(0,d.jsx)("p",{className:"text-sm text-muted-foreground mt-1",children:"Enter the 6-digit code from your authenticator app"})]}),(0,d.jsxs)("form",{onSubmit:k,className:"space-y-6",children:[(0,d.jsx)("div",{className:"flex justify-center gap-2",children:t.map((p,f)=>(0,d.jsx)(Y,{className:"w-12 h-14 border-2 focus-within:border-blue-500 transition-colors",children:(0,d.jsx)(q,{className:"p-0 h-full flex items-center justify-center",children:(0,d.jsx)("input",{ref:b=>{C.current[f]=b},type:"tel",inputMode:"numeric",maxLength:1,value:p,onChange:b=>V(f,b.target.value),onKeyDown:b=>R(f,b),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"}})})},f))}),y&&(0,d.jsxs)(me,{variant:"destructive",children:[(0,d.jsx)(J.AlertCircle,{className:"h-4 w-4"}),(0,d.jsx)(ce,{children:y})]}),(0,d.jsxs)("div",{className:"space-y-3",children:[(0,d.jsx)(x,{type:"submit",className:"w-full",disabled:i||t.some(p=>p===""),children:i?"Verifying...":"Verify Code"}),(0,d.jsx)(x,{type:"button",variant:"ghost",size:"sm",onClick:M,className:"w-full text-xs",children:"Clear Code"})]})]}),(0,d.jsx)("p",{className:"text-xs text-muted-foreground",children:"Codes refresh every 30 seconds"})]})})})})};
2
+ "use strict";var rt=Object.create;var ee=Object.defineProperty;var at=Object.getOwnPropertyDescriptor;var nt=Object.getOwnPropertyNames;var it=Object.getPrototypeOf,st=Object.prototype.hasOwnProperty;var dt=(e,t)=>{for(var r in t)ee(e,r,{get:t[r],enumerable:!0})},ye=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let m of nt(t))!st.call(e,m)&&m!==r&&ee(e,m,{get:()=>t[m],enumerable:!(i=at(t,m))||i.enumerable});return e};var F=(e,t,r)=>(r=e!=null?rt(it(e)):{},ye(t||!e||!e.__esModule?ee(r,"default",{value:e,enumerable:!0}):r,e)),lt=e=>ye(ee({},"__esModule",{value:!0}),e);var Dt={};dt(Dt,{Button:()=>h,ClientOnly:()=>ke,Navbar:()=>Le,PlaceholderAlert:()=>et,TOTPValidator:()=>tt,UserDropdown:()=>Xe,UserProfile:()=>qe});module.exports=lt(Dt);var Pe=F(require("react")),Ce=require("@radix-ui/react-slot"),Re=require("class-variance-authority");var we=require("clsx"),Ne=require("tailwind-merge");function n(...e){return(0,Ne.twMerge)((0,we.clsx)(e))}var Me=require("react/jsx-runtime"),ct=(0,Re.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"}}),h=Pe.forwardRef(({className:e,variant:t,size:r,asChild:i=!1,...m},w)=>(0,Me.jsx)(i?Ce.Slot:"button",{className:n(ct({variant:t,size:r,className:e})),ref:w,...m}));h.displayName="Button";var te=require("react"),oe=require("react/jsx-runtime"),ke=({children:e})=>{let[t,r]=(0,te.useState)(!1);return(0,te.useEffect)(()=>{r(!0)},[]),t?(0,oe.jsx)(oe.Fragment,{children:e}):null};var be=require("react"),Y=require("lucide-react");var _=F(require("@radix-ui/react-avatar"));var re=require("react/jsx-runtime");function W({className:e,...t}){return(0,re.jsx)(_.Root,{"data-slot":"avatar",className:n("relative flex size-8 shrink-0 overflow-hidden rounded-full",e),...t})}function j({className:e,...t}){return(0,re.jsx)(_.Image,{"data-slot":"avatar-image",className:n("aspect-square size-full",e),...t})}function U({className:e,...t}){return(0,re.jsx)(_.Fallback,{"data-slot":"avatar-fallback",className:n("bg-muted flex size-full items-center justify-center rounded-full",e),...t})}var P=F(require("react")),s=F(require("@radix-ui/react-dropdown-menu")),H=require("lucide-react");var v=require("react/jsx-runtime"),mt=H.Check,pt=H.Circle,ut=H.ChevronRight;function ae({...e}){return(0,v.jsx)(s.Root,{"data-slot":"dropdown-menu",...e})}var $=P.forwardRef(({...e},t)=>(0,v.jsx)(s.Trigger,{ref:t,"data-slot":"dropdown-menu-trigger",...e}));$.displayName=s.Trigger.displayName;var Z=P.forwardRef(({className:e,sideOffset:t=4,...r},i)=>(0,v.jsx)(s.Portal,{children:(0,v.jsx)(s.Content,{ref:i,"data-slot":"dropdown-menu-content",sideOffset:t,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",e),...r})}));Z.displayName=s.Content.displayName;var ve=P.forwardRef(({...e},t)=>(0,v.jsx)(s.Group,{ref:t,"data-slot":"dropdown-menu-group",...e}));ve.displayName=s.Group.displayName;var A=P.forwardRef(({className:e,inset:t,variant:r="default",...i},m)=>(0,v.jsx)(s.Item,{ref:m,"data-slot":"dropdown-menu-item","data-inset":t,"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",e),...i}));A.displayName=s.Item.displayName;var ft=P.forwardRef(({className:e,children:t,checked:r,...i},m)=>(0,v.jsxs)(s.CheckboxItem,{ref:m,"data-slot":"dropdown-menu-checkbox-item",className:n("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:[(0,v.jsx)("span",{className:"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",children:(0,v.jsx)(s.ItemIndicator,{children:(0,v.jsx)(mt,{className:"size-4"})})}),t]}));ft.displayName=s.CheckboxItem.displayName;var vt=P.forwardRef(({...e},t)=>(0,v.jsx)(s.RadioGroup,{ref:t,"data-slot":"dropdown-menu-radio-group",...e}));vt.displayName=s.RadioGroup.displayName;var gt=P.forwardRef(({className:e,children:t,...r},i)=>(0,v.jsxs)(s.RadioItem,{ref:i,"data-slot":"dropdown-menu-radio-item",className:n("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:[(0,v.jsx)("span",{className:"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",children:(0,v.jsx)(s.ItemIndicator,{children:(0,v.jsx)(pt,{className:"size-2 fill-current"})})}),t]}));gt.displayName=s.RadioItem.displayName;var ge=P.forwardRef(({className:e,inset:t,...r},i)=>(0,v.jsx)(s.Label,{ref:i,"data-slot":"dropdown-menu-label","data-inset":t,className:n("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",e),...r}));ge.displayName=s.Label.displayName;var z=P.forwardRef(({className:e,...t},r)=>(0,v.jsx)(s.Separator,{ref:r,"data-slot":"dropdown-menu-separator",className:n("bg-border -mx-1 my-1 h-px",e),...t}));z.displayName=s.Separator.displayName;var bt=P.forwardRef(({className:e,...t},r)=>(0,v.jsx)("span",{ref:r,"data-slot":"dropdown-menu-shortcut",className:n("text-muted-foreground ml-auto text-xs tracking-widest",e),...t}));bt.displayName="DropdownMenuShortcut";var xt=P.forwardRef(({className:e,inset:t,children:r,...i},m)=>(0,v.jsxs)(s.SubTrigger,{ref:m,"data-slot":"dropdown-menu-sub-trigger","data-inset":t,className:n("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,(0,v.jsx)(ut,{className:"ml-auto size-4"})]}));xt.displayName=s.SubTrigger.displayName;var ht=P.forwardRef(({className:e,...t},r)=>(0,v.jsx)(s.SubContent,{ref:r,"data-slot":"dropdown-menu-sub-content",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 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg",e),...t}));ht.displayName=s.SubContent.displayName;var y=F(require("@radix-ui/react-dialog")),De=require("lucide-react");var R=require("react/jsx-runtime"),yt=De.X;function Se({...e}){return(0,R.jsx)(y.Root,{"data-slot":"sheet",...e})}function Te({...e}){return(0,R.jsx)(y.Trigger,{"data-slot":"sheet-trigger",...e})}function wt({...e}){return(0,R.jsx)(y.Portal,{"data-slot":"sheet-portal",...e})}function Nt({className:e,...t}){return(0,R.jsx)(y.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",e),...t})}function Ie({className:e,children:t,side:r="right",...i}){return(0,R.jsxs)(wt,{children:[(0,R.jsx)(Nt,{}),(0,R.jsxs)(y.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",e),...i,children:[t,(0,R.jsxs)(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:[(0,R.jsx)(yt,{className:"size-4"}),(0,R.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})}var ie=require("react"),ne=require("react/jsx-runtime"),Pt={className:"mr-2 h-4 w-4","aria-hidden":"true"},K=({Icon:e})=>{let[t,r]=(0,ie.useState)(!1);return(0,ie.useEffect)(()=>{r(!0)},[]),(0,ne.jsx)("span",{className:"inline-flex items-center justify-center",children:t?(0,ne.jsx)(e,{...Pt}):(0,ne.jsx)("span",{className:"mr-2 h-4 w-4","aria-hidden":"true"})})};var de=require("react"),le=require("lucide-react");var se=require("react/jsx-runtime"),Ee="authdog-theme",Ct=()=>{if(typeof window>"u")return"light";let e=window.localStorage.getItem(Ee);return e==="light"||e==="dark"?e:window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"},Ae=e=>{document.documentElement.classList.toggle("dark",e==="dark")},Ve=()=>{let[e,t]=(0,de.useState)("light");return(0,de.useEffect)(()=>{let i=Ct();Ae(i),t(i)},[]),(0,se.jsx)(h,{variant:"ghost",size:"icon",className:"cursor-pointer","aria-label":e==="dark"?"Switch to light theme":"Switch to dark theme",onClick:()=>{let i=e==="dark"?"light":"dark";Ae(i);try{window.localStorage.setItem(Ee,i)}catch{}t(i)},children:e==="dark"?(0,se.jsx)(le.Sun,{className:"h-4 w-4"}):(0,se.jsx)(le.Moon,{className:"h-4 w-4"})})};var a=require("react/jsx-runtime");function Le({items:e=[],children:t,className:r,logoText:i="ACME Corp",logoSrc:m,altText:w,user:g={name:"John Doe",email:"john@example.com",image:"https://i.pravatar.cc/150?u=a042581f4e29026704d"},onNavigateHome:E=()=>console.log("Navigating to home"),onNavItemClick:N=l=>console.log(`Navigating to ${l}`),dropdownMenuItems:C=[{name:"Profile",uri:"/profile",icon:Y.User}],onDropdownMenuItemClick:V=l=>console.log(`Navigating to ${l}`),onProfileSelected:D,onLogout:L=()=>console.log("Logout clicked"),isLoading:M=!1,identityHost:S="https://stg-id.authdog.xyz",environmentId:p="58be35b0-708f-49f6-84f0-6695d307d997"}){let[l,b]=(0,be.useState)(!1),[I,x]=(0,be.useState)(!1),u=g!=null&&g.id!==null&&g.id!==void 0;return(0,a.jsx)("header",{className:n("w-full border-b bg-background",r),children:(0,a.jsxs)("div",{className:n("mx-auto flex h-16 w-full max-w-6xl items-center justify-between px-4 md:px-6"),children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 md:gap-4",children:[(0,a.jsxs)("button",{type:"button",onClick:E,className:n("group inline-flex items-center gap-2 md:gap-3 rounded-md px-1 py-1 text-left cursor-pointer","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:[m&&!I&&(0,a.jsx)("span",{className:"inline-flex h-8 w-8 items-center justify-center overflow-hidden rounded-md bg-muted/80 ring-1 ring-border",children:(0,a.jsx)("img",{src:m,alt:i,className:"h-7 w-7 object-contain",onError:()=>x(!0)})}),w??(0,a.jsx)("span",{className:"text-base font-semibold tracking-tight md:text-lg group-hover:text-primary",children:i})]}),t]}),(0,a.jsxs)("div",{className:"flex flex-1 items-center justify-end gap-6",children:[(0,a.jsx)("nav",{className:"hidden md:flex items-center gap-6",children:e?.map((c,T)=>(0,a.jsx)("span",{onClick:()=>{c.disabled||N(c.href)},className:n("text-sm font-medium transition-colors hover:text-primary cursor-pointer",c.disabled&&"cursor-not-allowed opacity-80"),children:c.title},T))}),(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsxs)(Se,{open:l,onOpenChange:b,children:[(0,a.jsx)(Te,{asChild:!0,children:(0,a.jsx)(h,{variant:"ghost",size:"icon",className:"md:hidden","aria-label":"Open Menu",children:(0,a.jsx)(K,{Icon:Y.Menu})})}),(0,a.jsx)(Ie,{side:"left",className:"pr-0",children:(0,a.jsx)("nav",{className:"grid gap-2 py-6",children:e?.map((c,T)=>(0,a.jsx)("a",{href:c.href,className:n("flex w-full items-center rounded-md px-3 py-2 text-sm font-medium hover:bg-accent cursor-pointer",c.disabled&&"cursor-not-allowed opacity-80"),onClick:()=>b(!1),children:c.title},T))})})]}),(0,a.jsx)(Ve,{}),u?(0,a.jsxs)(ae,{children:[(0,a.jsx)($,{asChild:!0,children:(0,a.jsx)(h,{variant:"ghost",className:"relative h-8 w-8 rounded-full cursor-pointer",disabled:M,children:(0,a.jsx)(W,{className:"h-8 w-8",children:M?(0,a.jsx)("div",{className:"h-8 w-8 animate-pulse bg-muted rounded-full"}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(j,{src:g.photos?.[0]?.value||"/placeholder.svg",alt:g.displayName}),(0,a.jsx)(U,{children:g.displayName?.charAt(0)})]})})})}),(0,a.jsx)(Z,{className:"w-56",align:"end",forceMount:!0,children:M?(0,a.jsxs)("div",{className:"p-4",children:[(0,a.jsx)("div",{className:"h-4 w-3/4 animate-pulse bg-muted rounded mb-2"}),(0,a.jsx)("div",{className:"h-3 w-1/2 animate-pulse bg-muted rounded"})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(ge,{className:"font-normal",children:(0,a.jsxs)("div",{className:"flex flex-col space-y-1",children:[(0,a.jsx)("p",{className:"text-sm font-medium leading-none",children:g.displayName}),(0,a.jsx)("p",{className:"text-xs leading-none text-muted-foreground",children:g.emails?.[0]?.value})]})}),C.length>0&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(z,{}),(0,a.jsx)(ve,{children:C.map((c,T)=>(0,a.jsxs)(A,{onClick:()=>{c.disabled||(c.uri==="/profile"&&D&&D(),V(c.uri))},disabled:c.disabled,className:"cursor-pointer",children:[c.icon&&(0,a.jsx)(K,{Icon:c.icon}),(0,a.jsx)("span",{children:c.name})]},T))}),(0,a.jsx)(z,{})]}),(0,a.jsxs)(A,{onClick:L,className:"cursor-pointer",children:[(0,a.jsx)(K,{Icon:Y.LogOut}),(0,a.jsx)("span",{children:"Log out"})]})]})})]}):(0,a.jsx)(h,{variant:"default","aria-label":"Sign in",onClick:()=>{if(!p)throw new Error("Environment ID is required");if(!S)throw new Error("Identity Host is required");let c=`${S}/signin/${p}`;window.open(c,"_blank")},children:"Sign in"})]})]})]})})}var k=require("react");var ze=require("@radix-ui/react-slot"),Be=require("class-variance-authority");var Ge=require("react/jsx-runtime"),Rt=(0,Be.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 ce({className:e,variant:t,asChild:r=!1,...i}){return(0,Ge.jsx)(r?ze.Slot:"span",{"data-slot":"badge",className:n(Rt({variant:t}),e),...i})}var B=require("react/jsx-runtime");function q({className:e,...t}){return(0,B.jsx)("div",{"data-slot":"card",className:n("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",e),...t})}function Oe({className:e,...t}){return(0,B.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",e),...t})}function Fe({className:e,...t}){return(0,B.jsx)("div",{"data-slot":"card-title",className:n("leading-none font-semibold",e),...t})}function _e({className:e,...t}){return(0,B.jsx)("div",{"data-slot":"card-description",className:n("text-muted-foreground text-sm",e),...t})}function X({className:e,...t}){return(0,B.jsx)("div",{"data-slot":"card-content",className:n("px-6",e),...t})}function We({className:e,...t}){return(0,B.jsx)("div",{"data-slot":"card-footer",className:n("flex items-center px-6 [.border-t]:pt-6",e),...t})}var Ue=require("react/jsx-runtime");function je({className:e,type:t,...r}){return(0,Ue.jsx)("input",{type:t,"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",e),...r})}var He=F(require("@radix-ui/react-label"));var Ke=require("react/jsx-runtime");function $e({className:e,...t}){return(0,Ke.jsx)(He.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",e),...t})}var Ye=require("lucide-react"),o=require("react/jsx-runtime"),qe=({loading:e,user:t,handleAuthenticated:r,onRequestEmailVerification:i,onVerifyEmail:m,onAddEmail:w})=>{let[g,E]=(0,k.useState)(!1),[N,C]=(0,k.useState)("profile"),[V,D]=(0,k.useState)(null),[L,M]=(0,k.useState)({}),[S,p]=(0,k.useState)(!1),[l,b]=(0,k.useState)("");(0,k.useEffect)(()=>{E(!0)},[]),(0,k.useEffect)(()=>{!e&&r&&r()},[e,t,r]);let I={className:"mr-2 h-4 w-4","aria-hidden":"true"},x=u=>g?(0,o.jsx)(u,{...I}):null;return!g||e?(0,o.jsx)("div",{children:"Loading..."}):t?(0,o.jsxs)("div",{className:"grid grid-cols-[14rem,1fr] w-full bg-transparent",children:[(0,o.jsxs)("div",{className:"h-full border-r border-border p-3 md:p-4 bg-transparent flex flex-col min-w-0",children:[(0,o.jsxs)("div",{className:"mb-3 md:mb-4",children:[(0,o.jsx)("h1",{className:"text-xl font-bold text-foreground",children:"Account"}),(0,o.jsx)("p",{className:"text-sm text-muted-foreground",children:"Manage your account info."})]}),(0,o.jsx)("nav",{className:"space-y-1 flex-1",children:(0,o.jsxs)("button",{onClick:()=>C("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:[x(Ye.User),"Profile"]})})]}),(0,o.jsxs)("div",{className:"h-full p-3 md:p-5 min-w-0 bg-transparent",children:[(0,o.jsx)("div",{className:"flex justify-between items-center mb-3 md:mb-4",children:(0,o.jsx)("h2",{className:"text-xl font-semibold text-foreground",children:N==="profile"?"Profile details":N==="security"?"Security settings":"Preferences"})}),N==="profile"?(0,o.jsxs)("div",{className:"space-y-5 md:space-y-6",children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("h3",{className:"text-sm font-medium mb-3 text-foreground",children:"Profile"}),(0,o.jsx)("div",{className:"flex items-center justify-between",children:(0,o.jsxs)("div",{className:"flex items-center",children:[(0,o.jsxs)(W,{className:"h-12 w-12 mr-4 border",children:[(0,o.jsx)(j,{src:t.photos?.[0]?.value,alt:"Profile picture"}),(0,o.jsx)(U,{children:t.displayName?.split(" ").map(u=>u[0]).join("")})]}),(0,o.jsx)("span",{className:"font-medium text-foreground",children:t.displayName})]})})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)("h3",{className:"text-sm font-medium mb-3 text-foreground",children:"Email addresses"}),(0,o.jsxs)("div",{className:"space-y-2.5",children:[t.emails.map((u,c)=>{let xe=(t?.verifications||[]).find(fe=>fe.email===u.value)?.verified===!0,he=L[u.value]||"";return(0,o.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,o.jsxs)("div",{className:"flex flex-col",children:[(0,o.jsx)("span",{className:"text-foreground",children:u.value}),(0,o.jsx)("div",{className:"mt-1",children:xe?(0,o.jsx)(ce,{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,o.jsx)(ce,{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,o.jsxs)("div",{className:"flex items-center gap-2",children:[c===0&&(0,o.jsx)(ce,{variant:"outline",className:"text-xs bg-muted text-foreground hover:bg-muted",children:"Primary"}),!xe&&(0,o.jsx)(o.Fragment,{children:V===u.value?(0,o.jsxs)("div",{className:"flex items-center gap-1",children:[(0,o.jsx)("input",{className:"h-7 w-24 text-sm rounded-md border border-border bg-background px-2 text-foreground",placeholder:"Code",value:he,onChange:fe=>M(ot=>({...ot,[u.value]:fe.target.value}))}),(0,o.jsx)("button",{className:"h-7 rounded-md border border-border px-2 text-xs",onClick:async()=>{m&&await m(u.value,he)},children:"Verify"}),(0,o.jsx)("button",{className:"h-7 rounded-md border border-border px-2 text-xs",onClick:()=>D(null),children:"Cancel"})]}):(0,o.jsx)(o.Fragment,{children:(0,o.jsx)("button",{className:"h-7 rounded-md border border-border px-2 text-xs",onClick:async()=>{i&&await i(u.value),D(u.value)},children:"Send code"})})})]})]},u.value)}),(0,o.jsx)("div",{className:"mt-2",children:S?(0,o.jsx)("div",{className:"max-w-md",children:(0,o.jsxs)(q,{children:[(0,o.jsxs)(Oe,{children:[(0,o.jsx)(Fe,{children:"Add email address"}),(0,o.jsx)(_e,{children:"You'll need to verify this email address before it can be added to your account."})]}),(0,o.jsx)(X,{children:(0,o.jsxs)("div",{className:"space-y-2",children:[(0,o.jsx)($e,{htmlFor:"new-email",children:"Email address"}),(0,o.jsx)(je,{id:"new-email",placeholder:"Enter your email address",value:l,onChange:u=>b(u.target.value),onKeyDown:async u=>{if(u.key==="Enter"){let c=String(l||"").trim().toLowerCase();if(!c)return;w&&await w(c),p(!1),b("")}}})]})}),(0,o.jsxs)(We,{className:"justify-end gap-2",children:[(0,o.jsx)(h,{variant:"ghost",onClick:()=>{p(!1),b("")},children:"Cancel"}),(0,o.jsx)(h,{onClick:async()=>{let u=String(l||"").trim().toLowerCase();u&&(w&&await w(u),p(!1),b(""))},children:"Add"})]})]})}):(0,o.jsx)(h,{variant:"outline",size:"sm",className:"text-xs",onClick:()=>p(!0),children:"Add email"})})]})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)("h3",{className:"text-sm font-medium mb-3 text-gray-900 dark:text-gray-100",children:"Connected accounts"}),(0,o.jsx)("div",{className:"space-y-2.5",children:(0,o.jsxs)("div",{className:"flex items-center justify-between",children:[(0,o.jsx)("div",{className:"flex items-center",children:(0,o.jsx)("div",{className:"mr-2",children:(0,o.jsx)("span",{className:"text-gray-900 dark:text-gray-100",children:t.provider})})}),(0,o.jsx)("span",{className:"text-sm text-gray-500 dark:text-gray-400",children:t?.emails?.[0]?.value})]},t.provider)})]})]}):N==="security"?(0,o.jsxs)("div",{className:"space-y-5 md:space-y-6",children:[(0,o.jsx)("div",{className:"border rounded-md overflow-hidden",children:(0,o.jsxs)("div",{className:"flex items-center justify-between px-4 py-3",children:[(0,o.jsx)("div",{className:"text-sm text-gray-700 dark:text-gray-300",children:"Password"}),(0,o.jsx)("button",{className:"text-sm text-indigo-600 hover:underline",children:"Set password"})]})}),(0,o.jsx)("div",{className:"border rounded-md overflow-hidden",children:(0,o.jsxs)("div",{className:"flex items-center justify-between px-4 py-3",children:[(0,o.jsx)("div",{className:"text-sm text-gray-700 dark:text-gray-300",children:"Passkeys"}),(0,o.jsx)("button",{className:"text-sm text-indigo-600 hover:underline",children:"+\xA0Add a passkey"})]})}),(0,o.jsx)("div",{className:"border rounded-md overflow-hidden",children:(0,o.jsxs)("div",{className:"flex items-center justify-between px-4 py-3",children:[(0,o.jsx)("div",{className:"text-sm text-gray-700 dark:text-gray-300",children:"Two-step verification"}),(0,o.jsx)("button",{className:"text-sm text-indigo-600 hover:underline",children:"+\xA0Add two-step verification"})]})}),(0,o.jsxs)("div",{className:"border rounded-md overflow-hidden",children:[(0,o.jsx)("div",{className:"px-4 py-3 border-b text-sm font-medium text-gray-900 dark:text-gray-100",children:"Active devices"}),(0,o.jsx)("div",{className:"p-4 space-y-3",children:(0,o.jsxs)("div",{className:"text-sm",children:[(0,o.jsxs)("div",{className:"flex items-center gap-2",children:[(0,o.jsx)("span",{className:"inline-block h-5 w-5 rounded-sm bg-gray-900 dark:bg-white"}),(0,o.jsx)("span",{className:"font-medium",children:"X11"}),(0,o.jsx)("span",{className:"text-xs rounded-md border px-2 py-0.5 text-gray-600 dark:text-gray-300",children:"This device"})]}),(0,o.jsx)("div",{className:"text-gray-600 dark:text-gray-400 mt-1",children:"Firefox 142.0"}),(0,o.jsx)("div",{className:"text-gray-600 dark:text-gray-400",children:"127.0.0.1 (Local), (Your City)"}),(0,o.jsx)("div",{className:"text-gray-600 dark:text-gray-400",children:"Today at 7:08 PM"})]})})]}),(0,o.jsx)("div",{className:"border rounded-md overflow-hidden",children:(0,o.jsxs)("div",{className:"flex items-center justify-between px-4 py-3",children:[(0,o.jsx)("div",{className:"text-sm text-gray-700 dark:text-gray-300",children:"Delete account"}),(0,o.jsx)("button",{className:"text-sm text-red-600 hover:underline",children:"Delete account"})]})})]}):(0,o.jsx)("div",{className:"space-y-5 md:space-y-6",children:(0,o.jsxs)("div",{children:[(0,o.jsx)("h3",{className:"text-sm font-medium mb-3 text-gray-900 dark:text-gray-100",children:"Preferences"}),(0,o.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,o.jsxs)("div",{className:"flex items-center justify-between",children:[(0,o.jsx)("span",{className:"text-gray-700 dark:text-gray-300",children:"Locale"}),(0,o.jsx)("span",{className:"text-gray-500 dark:text-gray-400",children:"Auto"})]}),(0,o.jsxs)("div",{className:"flex items-center justify-between",children:[(0,o.jsx)("span",{className:"text-gray-700 dark:text-gray-300",children:"Theme"}),(0,o.jsx)("span",{className:"text-gray-500 dark:text-gray-400",children:"System"})]})]})]})})]})]}):(0,o.jsx)("div",{children:"No user"})};var J=require("lucide-react"),f=require("react/jsx-runtime"),Mt=e=>e&&String(e).trim().split(/\s+/).slice(0,2).map(i=>i[0]?.toUpperCase()).join("")||"?",Xe=({trigger:e,user:t,className:r,onManageAccount:i,onSignout:m,links:w=[],side:g="bottom",align:E="end",sideOffset:N=8,modal:C=!1,triggerAsChild:V=!1,triggerWrapperClassName:D})=>{let L=t?.emails?.[0]?.value||t?.email||"",M=t?.displayName||t?.name||"",S=t?.photos?.[0]?.value||t?.avatar||"",p=x=>{if(x.onClick)return x.onClick();x.href&&(x.href.startsWith("http")?window.open(x.href,"_blank"):window.location.assign(x.href))},l=J.ExternalLink,b=J.Settings,I=J.LogOut;return(0,f.jsxs)(ae,{modal:C,children:[V?(0,f.jsx)($,{asChild:!0,children:e}):(0,f.jsx)($,{className:n("inline-flex items-center justify-center bg-transparent p-0 border-0 outline-none focus-visible:outline-none",D),children:e}),(0,f.jsxs)(Z,{align:E,side:g,sideOffset:N,className:n("w-72 p-2 overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md",r),children:[(0,f.jsxs)("div",{className:"flex items-center gap-3 px-4 pt-4 pb-3",children:[(0,f.jsxs)(W,{className:"h-9 w-9 rounded-full",children:[(0,f.jsx)(j,{src:S,alt:M}),(0,f.jsx)(U,{className:"rounded-full",children:Mt(M)})]}),(0,f.jsxs)("div",{className:"min-w-0",children:[(0,f.jsx)("div",{className:"text-sm font-semibold truncate",children:M}),(0,f.jsx)("div",{className:"text-xs text-muted-foreground truncate",children:L})]})]}),(0,f.jsx)(z,{}),(0,f.jsxs)(A,{className:"cursor-pointer py-2",onClick:()=>i?.(),children:[(0,f.jsx)(b,{className:"mr-2 h-4 w-4"}),(0,f.jsx)("span",{children:"Manage account"})]}),w.map((x,u)=>{let c=x.icon??l;return(0,f.jsxs)(A,{className:"cursor-pointer py-2",onClick:()=>p(x),children:[(0,f.jsx)(c,{className:"mr-2 h-4 w-4"}),(0,f.jsx)("span",{children:x.label})]},`${x.label}-${u}`)}),(0,f.jsx)(z,{}),(0,f.jsxs)(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:()=>m?.(),children:[(0,f.jsx)(I,{className:"mr-2 h-4 w-4 text-red-600 dark:text-red-300"}),(0,f.jsx)("span",{children:"Sign out"})]})]})]})};var Ze=require("lucide-react");var Je=require("class-variance-authority");var ue=require("react/jsx-runtime"),kt=(0,Je.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 me({className:e,variant:t,...r}){return(0,ue.jsx)("div",{"data-slot":"alert",role:"alert",className:n(kt({variant:t}),e),...r})}function Qe({className:e,...t}){return(0,ue.jsx)("div",{"data-slot":"alert-title",className:n("col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight",e),...t})}function pe({className:e,...t}){return(0,ue.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",e),...t})}var G=require("react/jsx-runtime"),et=e=>{let t=e.title??"Placeholder Alert",r=e.description??"This is a placeholder alert.";return(0,G.jsx)("div",{className:"grid w-full max-w-xl items-start gap-4",children:(0,G.jsxs)(me,{children:[(0,G.jsx)(K,{Icon:Ze.CheckCircle2Icon}),(0,G.jsx)(Qe,{children:t}),(0,G.jsx)(pe,{children:r})]})})};var O=require("react");var Q=require("lucide-react"),d=require("react/jsx-runtime"),tt=({onValidate:e})=>{let[t,r]=(0,O.useState)(["","","","","",""]),[i,m]=(0,O.useState)(!1),[w,g]=(0,O.useState)(""),[E,N]=(0,O.useState)(!1),C=(0,O.useRef)([]),V=(p,l)=>{if(!/^\d*$/.test(l))return;let b=[...t];b[p]=l.slice(-1),r(b),g(""),N(!1),l&&p<5&&C.current[p+1]?.focus()},D=(p,l)=>{l.key==="Backspace"&&!t[p]&&p>0&&C.current[p-1]?.focus(),l.key==="v"&&(l.ctrlKey||l.metaKey)&&(l.preventDefault(),navigator.clipboard.readText().then(b=>{let I=b.replace(/\D/g,"").slice(0,6).split(""),x=[...t];I.forEach((c,T)=>{T<6&&(x[T]=c)}),r(x);let u=Math.min(I.length,5);C.current[u]?.focus()}))},L=async()=>{let p=t.join("");if(p.length!==6){g("Please enter all 6 digits");return}m(!0),g("");try{await e(p),N(!0)}catch{g("Invalid TOTP code. Please try again.")}finally{m(!1)}},M=p=>{p.preventDefault(),L()},S=()=>{r(["","","","","",""]),g(""),N(!1),m(!1),C.current[0]?.focus()};return E?(0,d.jsx)("div",{className:"max-w-md mx-auto",children:(0,d.jsx)(q,{className:"border-green-200 bg-green-50",children:(0,d.jsx)(X,{className:"pt-6",children:(0,d.jsxs)("div",{className:"text-center space-y-4",children:[(0,d.jsx)("div",{className:"mx-auto w-16 h-16 bg-green-100 rounded-full flex items-center justify-center",children:(0,d.jsx)(Q.CheckCircle,{className:"w-8 h-8 text-green-600"})}),(0,d.jsxs)("div",{children:[(0,d.jsx)("h3",{className:"text-lg font-semibold text-green-900",children:"Verification Successful!"}),(0,d.jsx)("p",{className:"text-sm text-green-700 mt-1",children:"Your TOTP code has been validated."})]}),(0,d.jsx)(h,{onClick:S,variant:"outline",className:"bg-white",children:"Verify Another Code"})]})})})}):(0,d.jsx)("div",{className:"max-w-md mx-auto",children:(0,d.jsx)(q,{children:(0,d.jsx)(X,{className:"pt-6",children:(0,d.jsxs)("div",{className:"text-center space-y-6",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("div",{className:"mx-auto w-12 h-12 bg-blue-100 rounded-full flex items-center justify-center mb-4",children:(0,d.jsx)(Q.Shield,{className:"w-6 h-6 text-blue-600"})}),(0,d.jsx)("h3",{className:"text-lg font-semibold",children:"Enter Verification Code"}),(0,d.jsx)("p",{className:"text-sm text-muted-foreground mt-1",children:"Enter the 6-digit code from your authenticator app"})]}),(0,d.jsxs)("form",{onSubmit:M,className:"space-y-6",children:[(0,d.jsx)("div",{className:"flex justify-center gap-2",children:t.map((p,l)=>(0,d.jsx)(q,{className:"w-12 h-14 border-2 focus-within:border-blue-500 transition-colors",children:(0,d.jsx)(X,{className:"p-0 h-full flex items-center justify-center",children:(0,d.jsx)("input",{ref:b=>{C.current[l]=b},type:"tel",inputMode:"numeric",maxLength:1,value:p,onChange:b=>V(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:i,style:{height:"auto"}})})},l))}),w&&(0,d.jsxs)(me,{variant:"destructive",children:[(0,d.jsx)(Q.AlertCircle,{className:"h-4 w-4"}),(0,d.jsx)(pe,{children:w})]}),(0,d.jsxs)("div",{className:"space-y-3",children:[(0,d.jsx)(h,{type:"submit",className:"w-full",disabled:i||t.some(p=>p===""),children:i?"Verifying...":"Verify Code"}),(0,d.jsx)(h,{type:"button",variant:"ghost",size:"sm",onClick:S,className:"w-full text-xs",children:"Clear Code"})]})]}),(0,d.jsx)("p",{className:"text-xs text-muted-foreground",children:"Codes refresh every 30 seconds"})]})})})})};
3
3
  //# sourceMappingURL=index.js.map