@authdog/react-elements 0.0.31 → 0.0.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +35 -35
- package/CHANGELOG.md +12 -0
- package/dist/components/ui/dropdown-menu.js.map +1 -1
- package/dist/components/ui/dropdown-menu.mjs.map +1 -1
- package/dist/index.d.mts +34 -4
- package/dist/index.d.ts +34 -4
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +63 -0
- package/package.json +1 -1
- package/src/components/core/user-dropdown.tsx +99 -0
- package/src/components/core/user-profile.tsx +26 -21
- package/src/components/ui/dropdown-menu.tsx +1 -1
- package/src/index.ts +1 -0
- package/src/main.tsx +1 -1
- package/src/preview.tsx +1 -0
- package/src/stories/UserDropdown.stories.tsx +36 -0
|
@@ -53,15 +53,17 @@ export const UserProfile = ({
|
|
|
53
53
|
<div className="grid grid-cols-[14rem,1fr] w-full bg-transparent">
|
|
54
54
|
<div className="h-full border-r p-3 md:p-4 bg-transparent flex flex-col min-w-0">
|
|
55
55
|
<div className="mb-3 md:mb-4">
|
|
56
|
-
<h1 className="text-xl font-bold">Account</h1>
|
|
57
|
-
<p className="text-sm text-gray-500">Manage your account info.</p>
|
|
56
|
+
<h1 className="text-xl font-bold text-gray-900 dark:text-gray-100">Account</h1>
|
|
57
|
+
<p className="text-sm text-gray-500 dark:text-gray-400">Manage your account info.</p>
|
|
58
58
|
</div>
|
|
59
59
|
|
|
60
60
|
<nav className="space-y-1 flex-1">
|
|
61
61
|
<button
|
|
62
62
|
onClick={() => setActiveTab("profile")}
|
|
63
63
|
className={`flex items-center w-full px-3 py-2 text-sm rounded-md ${
|
|
64
|
-
activeTab === "profile"
|
|
64
|
+
activeTab === "profile"
|
|
65
|
+
? "bg-gray-100 text-gray-900 dark:bg-gray-800 dark:text-gray-100"
|
|
66
|
+
: "text-gray-700 hover:bg-gray-50 dark:text-gray-300 dark:hover:bg-gray-800"
|
|
65
67
|
}`}
|
|
66
68
|
>
|
|
67
69
|
{renderIcon(User)}
|
|
@@ -81,7 +83,7 @@ export const UserProfile = ({
|
|
|
81
83
|
|
|
82
84
|
<div className="h-full p-3 md:p-5 min-w-0 bg-transparent">
|
|
83
85
|
<div className="flex justify-between items-center mb-3 md:mb-4">
|
|
84
|
-
<h2 className="text-xl font-semibold">
|
|
86
|
+
<h2 className="text-xl font-semibold text-gray-900 dark:text-gray-100">
|
|
85
87
|
{activeTab === "profile" ? "Profile details" : "Security settings"}
|
|
86
88
|
</h2>
|
|
87
89
|
{/* <button className="text-gray-500 hover:text-gray-700">
|
|
@@ -93,14 +95,14 @@ export const UserProfile = ({
|
|
|
93
95
|
<div className="space-y-5 md:space-y-6">
|
|
94
96
|
{/* Profile Section */}
|
|
95
97
|
<div>
|
|
96
|
-
<h3 className="text-sm font-medium mb-3">Profile</h3>
|
|
98
|
+
<h3 className="text-sm font-medium mb-3 text-gray-900 dark:text-gray-100">Profile</h3>
|
|
97
99
|
<div className="flex items-center justify-between">
|
|
98
100
|
<div className="flex items-center">
|
|
99
101
|
<Avatar className="h-12 w-12 mr-4 border">
|
|
100
102
|
<AvatarImage src={user.photos?.[0]?.value} alt="Profile picture" />
|
|
101
103
|
<AvatarFallback>{user.displayName?.split(" ").map((n: string) => n[0]).join("")}</AvatarFallback>
|
|
102
104
|
</Avatar>
|
|
103
|
-
<span className="font-medium">{user.displayName}</span>
|
|
105
|
+
<span className="font-medium text-gray-900 dark:text-gray-100">{user.displayName}</span>
|
|
104
106
|
</div>
|
|
105
107
|
{/* <Button variant="outline" size="sm">
|
|
106
108
|
Edit profile
|
|
@@ -110,7 +112,7 @@ export const UserProfile = ({
|
|
|
110
112
|
|
|
111
113
|
{/* Email Addresses Section */}
|
|
112
114
|
<div>
|
|
113
|
-
<h3 className="text-sm font-medium mb-3">Email addresses</h3>
|
|
115
|
+
<h3 className="text-sm font-medium mb-3 text-gray-900 dark:text-gray-100">Email addresses</h3>
|
|
114
116
|
<div className="space-y-2.5">
|
|
115
117
|
|
|
116
118
|
{/* {JSON.stringify(user)} */}
|
|
@@ -128,9 +130,12 @@ export const UserProfile = ({
|
|
|
128
130
|
|
|
129
131
|
{user.emails.map((email: any, idx: number) => (
|
|
130
132
|
<div className="flex items-center justify-between" key={email.value}>
|
|
131
|
-
<span>{email.value}</span>
|
|
133
|
+
<span className="text-gray-900 dark:text-gray-100">{email.value}</span>
|
|
132
134
|
{idx === 0 && (
|
|
133
|
-
<Badge
|
|
135
|
+
<Badge
|
|
136
|
+
variant="outline"
|
|
137
|
+
className="text-xs bg-gray-100 text-gray-700 hover:bg-gray-100 dark:bg-gray-800 dark:text-gray-300 dark:hover:bg-gray-800"
|
|
138
|
+
>
|
|
134
139
|
Primary
|
|
135
140
|
</Badge>
|
|
136
141
|
)}
|
|
@@ -162,15 +167,15 @@ export const UserProfile = ({
|
|
|
162
167
|
|
|
163
168
|
{/* Connected Accounts Section */}
|
|
164
169
|
<div>
|
|
165
|
-
<h3 className="text-sm font-medium mb-3">Connected accounts</h3>
|
|
170
|
+
<h3 className="text-sm font-medium mb-3 text-gray-900 dark:text-gray-100">Connected accounts</h3>
|
|
166
171
|
<div className="space-y-2.5">
|
|
167
172
|
<div className="flex items-center justify-between" key={user.provider}>
|
|
168
173
|
<div className="flex items-center">
|
|
169
174
|
<div className="mr-2">
|
|
170
|
-
<span>{user.provider}</span>
|
|
175
|
+
<span className="text-gray-900 dark:text-gray-100">{user.provider}</span>
|
|
171
176
|
</div>
|
|
172
177
|
</div>
|
|
173
|
-
<span className="text-sm text-gray-500">{user?.emails?.[0]?.value}</span>
|
|
178
|
+
<span className="text-sm text-gray-500 dark:text-gray-400">{user?.emails?.[0]?.value}</span>
|
|
174
179
|
</div>
|
|
175
180
|
</div>
|
|
176
181
|
</div>
|
|
@@ -179,12 +184,12 @@ export const UserProfile = ({
|
|
|
179
184
|
<div className="space-y-5 md:space-y-6">
|
|
180
185
|
{/* Security Settings */}
|
|
181
186
|
<div key="two-factor">
|
|
182
|
-
<h3 className="text-sm font-medium mb-3">Two-factor authentication</h3>
|
|
187
|
+
<h3 className="text-sm font-medium mb-3 text-gray-900 dark:text-gray-100">Two-factor authentication</h3>
|
|
183
188
|
<div className="space-y-2.5">
|
|
184
189
|
<div className="flex items-center justify-between">
|
|
185
190
|
<div>
|
|
186
|
-
<p className="font-medium">Two-factor authentication</p>
|
|
187
|
-
<p className="text-sm text-gray-500">Add an extra layer of security to your account</p>
|
|
191
|
+
<p className="font-medium text-gray-900 dark:text-gray-100">Two-factor authentication</p>
|
|
192
|
+
<p className="text-sm text-gray-500 dark:text-gray-400">Add an extra layer of security to your account</p>
|
|
188
193
|
</div>
|
|
189
194
|
<Button variant="outline" size="sm">
|
|
190
195
|
Enable
|
|
@@ -194,12 +199,12 @@ export const UserProfile = ({
|
|
|
194
199
|
</div>
|
|
195
200
|
|
|
196
201
|
<div key="password">
|
|
197
|
-
<h3 className="text-sm font-medium mb-3">Password</h3>
|
|
202
|
+
<h3 className="text-sm font-medium mb-3 text-gray-900 dark:text-gray-100">Password</h3>
|
|
198
203
|
<div className="space-y-2.5">
|
|
199
204
|
<div className="flex items-center justify-between">
|
|
200
205
|
<div>
|
|
201
|
-
<p className="font-medium">Change password</p>
|
|
202
|
-
<p className="text-sm text-gray-500">Last changed 3 months ago</p>
|
|
206
|
+
<p className="font-medium text-gray-900 dark:text-gray-100">Change password</p>
|
|
207
|
+
<p className="text-sm text-gray-500 dark:text-gray-400">Last changed 3 months ago</p>
|
|
203
208
|
</div>
|
|
204
209
|
<Button variant="outline" size="sm">
|
|
205
210
|
Change
|
|
@@ -209,12 +214,12 @@ export const UserProfile = ({
|
|
|
209
214
|
</div>
|
|
210
215
|
|
|
211
216
|
<div key="sessions">
|
|
212
|
-
<h3 className="text-sm font-medium mb-3">Active sessions</h3>
|
|
217
|
+
<h3 className="text-sm font-medium mb-3 text-gray-900 dark:text-gray-100">Active sessions</h3>
|
|
213
218
|
<div className="space-y-2.5">
|
|
214
219
|
<div className="flex items-center justify-between">
|
|
215
220
|
<div>
|
|
216
|
-
<p className="font-medium">Current session</p>
|
|
217
|
-
<p className="text-sm text-gray-500">Chrome on Windows • Active now</p>
|
|
221
|
+
<p className="font-medium text-gray-900 dark:text-gray-100">Current session</p>
|
|
222
|
+
<p className="text-sm text-gray-500 dark:text-gray-400">Chrome on Windows • Active now</p>
|
|
218
223
|
</div>
|
|
219
224
|
<Button variant="outline" size="sm">
|
|
220
225
|
Sign out
|
|
@@ -5,7 +5,7 @@ import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu"
|
|
|
5
5
|
import { Check, ChevronRight, Circle } from "lucide-react"
|
|
6
6
|
import type { ComponentType } from "react"
|
|
7
7
|
|
|
8
|
-
import { cn } from "
|
|
8
|
+
import { cn } from "../../lib/utils"
|
|
9
9
|
|
|
10
10
|
const CheckIcon = Check as ComponentType<React.SVGProps<SVGSVGElement>>
|
|
11
11
|
const CircleIcon = Circle as ComponentType<React.SVGProps<SVGSVGElement>>
|
package/src/index.ts
CHANGED
|
@@ -2,5 +2,6 @@ export {Button} from "./components/ui/button";
|
|
|
2
2
|
export { ClientOnly } from "./components/core/client-only";
|
|
3
3
|
export {Navbar} from "./components/core/navbar";
|
|
4
4
|
export {UserProfile} from "./components/core/user-profile";
|
|
5
|
+
export {UserDropdown} from "./components/core/user-dropdown";
|
|
5
6
|
export {PlaceholderAlert} from "./components/core/placeholder-alert";
|
|
6
7
|
export {TOTPValidator} from "./components/flow/totp-validator";
|
package/src/main.tsx
CHANGED
package/src/preview.tsx
CHANGED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React from "react"
|
|
2
|
+
import { UserDropdown } from "../components/core/user-dropdown"
|
|
3
|
+
import { Avatar, AvatarFallback, AvatarImage } from "../components/ui/avatar"
|
|
4
|
+
|
|
5
|
+
const DemoTrigger = () => (
|
|
6
|
+
<span className="inline-flex items-center justify-center h-10 w-10 rounded-full border bg-white shadow">
|
|
7
|
+
<Avatar className="h-8 w-8 rounded-full">
|
|
8
|
+
<AvatarImage src="https://i.pravatar.cc/100" />
|
|
9
|
+
<AvatarFallback>JD</AvatarFallback>
|
|
10
|
+
</Avatar>
|
|
11
|
+
</span>
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
const demoUser = {
|
|
15
|
+
displayName: "Jane Doe",
|
|
16
|
+
emails: [{ value: "jane.doe@example.com" }],
|
|
17
|
+
photos: [{ value: "https://i.pravatar.cc/100" }],
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export default { title: "Core/UserDropdown" }
|
|
21
|
+
|
|
22
|
+
export const Basic = () => (
|
|
23
|
+
<div className="p-10">
|
|
24
|
+
<UserDropdown
|
|
25
|
+
trigger={<DemoTrigger />}
|
|
26
|
+
user={demoUser}
|
|
27
|
+
onManageAccount={() => alert("Manage account")}
|
|
28
|
+
onSignout={() => alert("Sign out")}
|
|
29
|
+
links={[{ label: "My Organizations", href: "/organizations" }]}
|
|
30
|
+
side="bottom"
|
|
31
|
+
align="start"
|
|
32
|
+
/>
|
|
33
|
+
</div>
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
|