@authdog/react-elements 0.0.48 → 0.0.50
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 +17 -17
- package/CHANGELOG.md +12 -0
- package/dist/components/ui/alert.js.map +1 -1
- package/dist/components/ui/alert.mjs.map +1 -1
- package/dist/components/ui/avatar.js.map +1 -1
- package/dist/components/ui/avatar.mjs.map +1 -1
- package/dist/components/ui/badge.js.map +1 -1
- package/dist/components/ui/badge.mjs.map +1 -1
- package/dist/components/ui/button.js.map +1 -1
- package/dist/components/ui/button.mjs.map +1 -1
- package/dist/components/ui/card.js.map +1 -1
- package/dist/components/ui/card.mjs.map +1 -1
- package/dist/components/ui/dropdown-menu.js +1 -1
- package/dist/components/ui/dropdown-menu.js.map +1 -1
- package/dist/components/ui/dropdown-menu.mjs +1 -1
- package/dist/components/ui/dropdown-menu.mjs.map +1 -1
- package/dist/components/ui/input.js.map +1 -1
- package/dist/components/ui/input.mjs.map +1 -1
- package/dist/components/ui/label.js.map +1 -1
- package/dist/components/ui/label.mjs.map +1 -1
- package/dist/components/ui/separator.js.map +1 -1
- package/dist/components/ui/separator.mjs.map +1 -1
- package/dist/components/ui/sheet.js.map +1 -1
- package/dist/components/ui/sheet.mjs.map +1 -1
- package/dist/components/ui/theme-toggle.js.map +1 -1
- package/dist/components/ui/theme-toggle.mjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/lib/utils.js.map +1 -1
- package/dist/lib/utils.mjs.map +1 -1
- package/dist/styles.css +9 -0
- package/package.json +1 -1
- package/src/components/core/navbar.tsx +8 -2
- package/src/components/icons.tsx +9 -4
- package/src/components/ui/dropdown-menu.tsx +1 -1
- package/src/lib/utils.ts +1 -1
- package/src/stories/core/Navbar.stories.tsx +42 -0
package/package.json
CHANGED
|
@@ -178,7 +178,7 @@ export function Navbar({
|
|
|
178
178
|
className="md:hidden"
|
|
179
179
|
aria-label="Open Menu"
|
|
180
180
|
>
|
|
181
|
-
<IconWrapper Icon={Menu} />
|
|
181
|
+
<IconWrapper Icon={Menu} withMargin={false} />
|
|
182
182
|
</Button>
|
|
183
183
|
</SheetTrigger>
|
|
184
184
|
<SheetContent side="left" className="pr-0">
|
|
@@ -200,7 +200,12 @@ export function Navbar({
|
|
|
200
200
|
</SheetContent>
|
|
201
201
|
</Sheet>
|
|
202
202
|
<ThemeToggle />
|
|
203
|
-
{
|
|
203
|
+
{isLoading ? (
|
|
204
|
+
<div
|
|
205
|
+
className="h-8 w-8 animate-pulse rounded-full bg-muted"
|
|
206
|
+
aria-label="Loading user"
|
|
207
|
+
/>
|
|
208
|
+
) : isAuthenticated ? (
|
|
204
209
|
<DropdownMenu>
|
|
205
210
|
<DropdownMenuTrigger asChild>
|
|
206
211
|
<Button
|
|
@@ -281,6 +286,7 @@ export function Navbar({
|
|
|
281
286
|
) : (
|
|
282
287
|
<Button
|
|
283
288
|
variant="default"
|
|
289
|
+
className="cursor-pointer"
|
|
284
290
|
aria-label="Sign in"
|
|
285
291
|
onClick={() => {
|
|
286
292
|
if (!environmentId) {
|
package/src/components/icons.tsx
CHANGED
|
@@ -2,23 +2,28 @@ import { LucideProps } from "lucide-react";
|
|
|
2
2
|
import { useEffect, useState } from "react";
|
|
3
3
|
|
|
4
4
|
const iconProps: LucideProps = {
|
|
5
|
-
className: "mr-2 h-4 w-4",
|
|
5
|
+
className: "mr-2 h-4 w-4 text-current",
|
|
6
6
|
"aria-hidden": "true",
|
|
7
7
|
};
|
|
8
8
|
|
|
9
|
-
export const IconWrapper = ({ Icon }: { Icon: any }) => {
|
|
9
|
+
export const IconWrapper = ({ Icon, withMargin = true }: { Icon: any; withMargin?: boolean }) => {
|
|
10
10
|
const [isMounted, setIsMounted] = useState(false);
|
|
11
11
|
|
|
12
12
|
useEffect(() => {
|
|
13
13
|
setIsMounted(true);
|
|
14
14
|
}, []);
|
|
15
15
|
|
|
16
|
+
const iconClassWithMargin: LucideProps = withMargin ? iconProps : {
|
|
17
|
+
className: "h-4 w-4 text-current",
|
|
18
|
+
"aria-hidden": "true",
|
|
19
|
+
};
|
|
20
|
+
|
|
16
21
|
return (
|
|
17
22
|
<span className="inline-flex items-center justify-center">
|
|
18
23
|
{!isMounted ? (
|
|
19
|
-
<span className="mr-2 h-4 w-4" aria-hidden="true" />
|
|
24
|
+
<span className={withMargin ? "mr-2 h-4 w-4" : "h-4 w-4"} aria-hidden="true" />
|
|
20
25
|
) : (
|
|
21
|
-
<Icon {...
|
|
26
|
+
<Icon {...iconClassWithMargin} />
|
|
22
27
|
)}
|
|
23
28
|
</span>
|
|
24
29
|
);
|
|
@@ -83,7 +83,7 @@ const DropdownMenuItem = React.forwardRef<
|
|
|
83
83
|
data-inset={inset}
|
|
84
84
|
data-variant={variant}
|
|
85
85
|
className={cn(
|
|
86
|
-
"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",
|
|
86
|
+
"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 focus:[&_svg:not([class*='text-'])]:text-accent-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",
|
|
87
87
|
className,
|
|
88
88
|
)}
|
|
89
89
|
{...props}
|
package/src/lib/utils.ts
CHANGED
|
@@ -44,6 +44,48 @@ export const Authenticated: Story = {
|
|
|
44
44
|
},
|
|
45
45
|
};
|
|
46
46
|
|
|
47
|
+
export const LoadingThenAuthenticated: Story = {
|
|
48
|
+
render: (args) => {
|
|
49
|
+
const [loading, setLoading] = React.useState(true);
|
|
50
|
+
const [user, setUser] = React.useState<any | undefined>(undefined);
|
|
51
|
+
|
|
52
|
+
React.useEffect(() => {
|
|
53
|
+
const timer = setTimeout(() => {
|
|
54
|
+
setUser(demoUser);
|
|
55
|
+
setLoading(false);
|
|
56
|
+
}, 1500);
|
|
57
|
+
|
|
58
|
+
return () => clearTimeout(timer);
|
|
59
|
+
}, []);
|
|
60
|
+
|
|
61
|
+
return <Navbar {...args} isLoading={loading} user={user} />;
|
|
62
|
+
},
|
|
63
|
+
args: {
|
|
64
|
+
user: undefined,
|
|
65
|
+
isLoading: true,
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export const LoadingThenGuest: Story = {
|
|
70
|
+
render: (args) => {
|
|
71
|
+
const [loading, setLoading] = React.useState(true);
|
|
72
|
+
|
|
73
|
+
React.useEffect(() => {
|
|
74
|
+
const timer = setTimeout(() => {
|
|
75
|
+
setLoading(false);
|
|
76
|
+
}, 1500);
|
|
77
|
+
|
|
78
|
+
return () => clearTimeout(timer);
|
|
79
|
+
}, []);
|
|
80
|
+
|
|
81
|
+
return <Navbar {...args} isLoading={loading} />;
|
|
82
|
+
},
|
|
83
|
+
args: {
|
|
84
|
+
user: undefined,
|
|
85
|
+
isLoading: true,
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
|
|
47
89
|
export const WithLogo: Story = {
|
|
48
90
|
args: {
|
|
49
91
|
logoSrc: "https://dummyimage.com/64x64/111827/ffffff&text=AD",
|