@authdog/react-elements 0.0.49 → 0.2.0
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/dist/components/ui/alert.d.mts +12 -0
- package/dist/components/ui/alert.d.ts +12 -0
- package/dist/components/ui/avatar.d.mts +8 -0
- package/dist/components/ui/avatar.d.ts +8 -0
- package/dist/components/ui/badge.d.mts +12 -0
- package/dist/components/ui/badge.d.ts +12 -0
- package/dist/components/ui/button.d.mts +14 -0
- package/dist/components/ui/button.d.ts +14 -0
- package/dist/components/ui/button.js.map +1 -1
- package/dist/components/ui/button.mjs.map +1 -1
- package/dist/components/ui/card.d.mts +11 -0
- package/dist/components/ui/card.d.ts +11 -0
- package/dist/components/ui/dropdown-menu.d.mts +27 -0
- package/dist/components/ui/dropdown-menu.d.ts +27 -0
- package/dist/components/ui/input.d.mts +5 -0
- package/dist/components/ui/input.d.ts +5 -0
- package/dist/components/ui/label.d.mts +6 -0
- package/dist/components/ui/label.d.ts +6 -0
- package/dist/components/ui/separator.d.mts +6 -0
- package/dist/components/ui/separator.d.ts +6 -0
- package/dist/components/ui/sheet.d.mts +15 -0
- package/dist/components/ui/sheet.d.ts +15 -0
- package/dist/components/ui/theme-toggle.d.mts +5 -0
- package/dist/components/ui/theme-toggle.d.ts +5 -0
- package/dist/components/ui/theme-toggle.js.map +1 -1
- package/dist/components/ui/theme-toggle.mjs.map +1 -1
- package/dist/index.d.mts +12 -21
- package/dist/index.d.ts +12 -21
- 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.d.mts +5 -0
- package/dist/lib/utils.d.ts +5 -0
- package/dist/styles.css +1 -4
- package/package.json +40 -25
- package/.eslintrc.js +0 -9
- package/.storybook/main.ts +0 -21
- package/.storybook/preview.ts +0 -17
- package/.storybook/vitest.setup.ts +0 -7
- package/.turbo/turbo-build.log +0 -77
- package/CHANGELOG.md +0 -286
- package/components.json +0 -20
- package/postcss.config.mjs +0 -11
- package/src/components/core/client-only.tsx +0 -15
- package/src/components/core/navbar.tsx +0 -307
- package/src/components/core/placeholder-alert.tsx +0 -23
- package/src/components/core/user-dropdown.tsx +0 -160
- package/src/components/core/user-profile.tsx +0 -521
- package/src/components/flow/login.tsx +0 -167
- package/src/components/flow/totp-validator.tsx +0 -252
- package/src/components/icons.tsx +0 -30
- package/src/components/ui/alert.tsx +0 -66
- package/src/components/ui/avatar.tsx +0 -53
- package/src/components/ui/badge.tsx +0 -46
- package/src/components/ui/button.tsx +0 -56
- package/src/components/ui/card.tsx +0 -92
- package/src/components/ui/dropdown-menu.tsx +0 -265
- package/src/components/ui/input.tsx +0 -21
- package/src/components/ui/label.tsx +0 -24
- package/src/components/ui/separator.tsx +0 -28
- package/src/components/ui/sheet.tsx +0 -142
- package/src/components/ui/theme-toggle.tsx +0 -56
- package/src/global.css +0 -81
- package/src/index.ts +0 -8
- package/src/lib/utils.ts +0 -6
- package/src/stories/core/Navbar.stories.tsx +0 -51
- package/src/stories/core/PlaceholderAlert.stories.tsx +0 -23
- package/src/stories/core/UserDropdown.stories.tsx +0 -56
- package/src/stories/core/UserProfile.stories.tsx +0 -47
- package/src/stories/flow/LoginForm.stories.tsx +0 -20
- package/src/stories/flow/TotpValidator.stories.tsx +0 -23
- package/src/stories/showcase/Landing.stories.tsx +0 -376
- package/src/stories/ui/Button.stories.tsx +0 -45
- package/src/types.ts +0 -0
- package/tailwind.config.ts +0 -82
- package/tsconfig.json +0 -11
- package/tsup.config.ts +0 -31
- package/vitest.config.ts +0 -39
- package/vitest.shims.d.ts +0 -1
- package/wrangler.prod.toml +0 -4
|
@@ -1,265 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import * as React from "react";
|
|
4
|
-
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
|
|
5
|
-
import { Check, ChevronRight, Circle } from "lucide-react";
|
|
6
|
-
import type { ComponentType } from "react";
|
|
7
|
-
|
|
8
|
-
import { cn } from "../../lib/utils";
|
|
9
|
-
|
|
10
|
-
const CheckIcon = Check as ComponentType<React.SVGProps<SVGSVGElement>>;
|
|
11
|
-
const CircleIcon = Circle as ComponentType<React.SVGProps<SVGSVGElement>>;
|
|
12
|
-
const ChevronRightIcon = ChevronRight as ComponentType<
|
|
13
|
-
React.SVGProps<SVGSVGElement>
|
|
14
|
-
>;
|
|
15
|
-
|
|
16
|
-
function DropdownMenu({
|
|
17
|
-
...props
|
|
18
|
-
}: React.ComponentProps<typeof DropdownMenuPrimitive.Root>) {
|
|
19
|
-
return <DropdownMenuPrimitive.Root data-slot="dropdown-menu" {...props} />;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
function DropdownMenuPortal({
|
|
23
|
-
...props
|
|
24
|
-
}: React.ComponentProps<typeof DropdownMenuPrimitive.Portal>) {
|
|
25
|
-
return (
|
|
26
|
-
<DropdownMenuPrimitive.Portal data-slot="dropdown-menu-portal" {...props} />
|
|
27
|
-
);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const DropdownMenuTrigger = React.forwardRef<
|
|
31
|
-
React.ElementRef<typeof DropdownMenuPrimitive.Trigger>,
|
|
32
|
-
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Trigger>
|
|
33
|
-
>(({ ...props }, ref) => (
|
|
34
|
-
<DropdownMenuPrimitive.Trigger
|
|
35
|
-
ref={ref}
|
|
36
|
-
data-slot="dropdown-menu-trigger"
|
|
37
|
-
{...props}
|
|
38
|
-
/>
|
|
39
|
-
));
|
|
40
|
-
DropdownMenuTrigger.displayName = DropdownMenuPrimitive.Trigger.displayName;
|
|
41
|
-
|
|
42
|
-
const DropdownMenuContent = React.forwardRef<
|
|
43
|
-
React.ElementRef<typeof DropdownMenuPrimitive.Content>,
|
|
44
|
-
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content>
|
|
45
|
-
>(({ className, sideOffset = 4, ...props }, ref) => (
|
|
46
|
-
<DropdownMenuPrimitive.Portal>
|
|
47
|
-
<DropdownMenuPrimitive.Content
|
|
48
|
-
ref={ref}
|
|
49
|
-
data-slot="dropdown-menu-content"
|
|
50
|
-
sideOffset={sideOffset}
|
|
51
|
-
className={cn(
|
|
52
|
-
"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",
|
|
53
|
-
className,
|
|
54
|
-
)}
|
|
55
|
-
{...props}
|
|
56
|
-
/>
|
|
57
|
-
</DropdownMenuPrimitive.Portal>
|
|
58
|
-
));
|
|
59
|
-
DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
|
|
60
|
-
|
|
61
|
-
const DropdownMenuGroup = React.forwardRef<
|
|
62
|
-
React.ElementRef<typeof DropdownMenuPrimitive.Group>,
|
|
63
|
-
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Group>
|
|
64
|
-
>(({ ...props }, ref) => (
|
|
65
|
-
<DropdownMenuPrimitive.Group
|
|
66
|
-
ref={ref}
|
|
67
|
-
data-slot="dropdown-menu-group"
|
|
68
|
-
{...props}
|
|
69
|
-
/>
|
|
70
|
-
));
|
|
71
|
-
DropdownMenuGroup.displayName = DropdownMenuPrimitive.Group.displayName;
|
|
72
|
-
|
|
73
|
-
const DropdownMenuItem = React.forwardRef<
|
|
74
|
-
React.ElementRef<typeof DropdownMenuPrimitive.Item>,
|
|
75
|
-
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> & {
|
|
76
|
-
inset?: boolean;
|
|
77
|
-
variant?: "default" | "destructive";
|
|
78
|
-
}
|
|
79
|
-
>(({ className, inset, variant = "default", ...props }, ref) => (
|
|
80
|
-
<DropdownMenuPrimitive.Item
|
|
81
|
-
ref={ref}
|
|
82
|
-
data-slot="dropdown-menu-item"
|
|
83
|
-
data-inset={inset}
|
|
84
|
-
data-variant={variant}
|
|
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 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
|
-
className,
|
|
88
|
-
)}
|
|
89
|
-
{...props}
|
|
90
|
-
/>
|
|
91
|
-
));
|
|
92
|
-
DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;
|
|
93
|
-
|
|
94
|
-
const DropdownMenuCheckboxItem = React.forwardRef<
|
|
95
|
-
React.ElementRef<typeof DropdownMenuPrimitive.CheckboxItem>,
|
|
96
|
-
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem>
|
|
97
|
-
>(({ className, children, checked, ...props }, ref) => (
|
|
98
|
-
<DropdownMenuPrimitive.CheckboxItem
|
|
99
|
-
ref={ref}
|
|
100
|
-
data-slot="dropdown-menu-checkbox-item"
|
|
101
|
-
className={cn(
|
|
102
|
-
"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",
|
|
103
|
-
className,
|
|
104
|
-
)}
|
|
105
|
-
checked={checked}
|
|
106
|
-
{...props}
|
|
107
|
-
>
|
|
108
|
-
<span className="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center">
|
|
109
|
-
<DropdownMenuPrimitive.ItemIndicator>
|
|
110
|
-
<CheckIcon className="size-4" />
|
|
111
|
-
</DropdownMenuPrimitive.ItemIndicator>
|
|
112
|
-
</span>
|
|
113
|
-
{children}
|
|
114
|
-
</DropdownMenuPrimitive.CheckboxItem>
|
|
115
|
-
));
|
|
116
|
-
DropdownMenuCheckboxItem.displayName =
|
|
117
|
-
DropdownMenuPrimitive.CheckboxItem.displayName;
|
|
118
|
-
|
|
119
|
-
const DropdownMenuRadioGroup = React.forwardRef<
|
|
120
|
-
React.ElementRef<typeof DropdownMenuPrimitive.RadioGroup>,
|
|
121
|
-
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioGroup>
|
|
122
|
-
>(({ ...props }, ref) => (
|
|
123
|
-
<DropdownMenuPrimitive.RadioGroup
|
|
124
|
-
ref={ref}
|
|
125
|
-
data-slot="dropdown-menu-radio-group"
|
|
126
|
-
{...props}
|
|
127
|
-
/>
|
|
128
|
-
));
|
|
129
|
-
DropdownMenuRadioGroup.displayName =
|
|
130
|
-
DropdownMenuPrimitive.RadioGroup.displayName;
|
|
131
|
-
|
|
132
|
-
const DropdownMenuRadioItem = React.forwardRef<
|
|
133
|
-
React.ElementRef<typeof DropdownMenuPrimitive.RadioItem>,
|
|
134
|
-
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioItem>
|
|
135
|
-
>(({ className, children, ...props }, ref) => (
|
|
136
|
-
<DropdownMenuPrimitive.RadioItem
|
|
137
|
-
ref={ref}
|
|
138
|
-
data-slot="dropdown-menu-radio-item"
|
|
139
|
-
className={cn(
|
|
140
|
-
"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",
|
|
141
|
-
className,
|
|
142
|
-
)}
|
|
143
|
-
{...props}
|
|
144
|
-
>
|
|
145
|
-
<span className="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center">
|
|
146
|
-
<DropdownMenuPrimitive.ItemIndicator>
|
|
147
|
-
<CircleIcon className="size-2 fill-current" />
|
|
148
|
-
</DropdownMenuPrimitive.ItemIndicator>
|
|
149
|
-
</span>
|
|
150
|
-
{children}
|
|
151
|
-
</DropdownMenuPrimitive.RadioItem>
|
|
152
|
-
));
|
|
153
|
-
DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;
|
|
154
|
-
|
|
155
|
-
const DropdownMenuLabel = React.forwardRef<
|
|
156
|
-
React.ElementRef<typeof DropdownMenuPrimitive.Label>,
|
|
157
|
-
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label> & {
|
|
158
|
-
inset?: boolean;
|
|
159
|
-
}
|
|
160
|
-
>(({ className, inset, ...props }, ref) => (
|
|
161
|
-
<DropdownMenuPrimitive.Label
|
|
162
|
-
ref={ref}
|
|
163
|
-
data-slot="dropdown-menu-label"
|
|
164
|
-
data-inset={inset}
|
|
165
|
-
className={cn(
|
|
166
|
-
"px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",
|
|
167
|
-
className,
|
|
168
|
-
)}
|
|
169
|
-
{...props}
|
|
170
|
-
/>
|
|
171
|
-
));
|
|
172
|
-
DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;
|
|
173
|
-
|
|
174
|
-
const DropdownMenuSeparator = React.forwardRef<
|
|
175
|
-
React.ElementRef<typeof DropdownMenuPrimitive.Separator>,
|
|
176
|
-
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Separator>
|
|
177
|
-
>(({ className, ...props }, ref) => (
|
|
178
|
-
<DropdownMenuPrimitive.Separator
|
|
179
|
-
ref={ref}
|
|
180
|
-
data-slot="dropdown-menu-separator"
|
|
181
|
-
className={cn("bg-border -mx-1 my-1 h-px", className)}
|
|
182
|
-
{...props}
|
|
183
|
-
/>
|
|
184
|
-
));
|
|
185
|
-
DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;
|
|
186
|
-
|
|
187
|
-
const DropdownMenuShortcut = React.forwardRef<
|
|
188
|
-
HTMLSpanElement,
|
|
189
|
-
React.ComponentPropsWithoutRef<"span">
|
|
190
|
-
>(({ className, ...props }, ref) => (
|
|
191
|
-
<span
|
|
192
|
-
ref={ref}
|
|
193
|
-
data-slot="dropdown-menu-shortcut"
|
|
194
|
-
className={cn(
|
|
195
|
-
"text-muted-foreground ml-auto text-xs tracking-widest",
|
|
196
|
-
className,
|
|
197
|
-
)}
|
|
198
|
-
{...props}
|
|
199
|
-
/>
|
|
200
|
-
));
|
|
201
|
-
DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
|
|
202
|
-
|
|
203
|
-
function DropdownMenuSub({
|
|
204
|
-
...props
|
|
205
|
-
}: React.ComponentProps<typeof DropdownMenuPrimitive.Sub>) {
|
|
206
|
-
return <DropdownMenuPrimitive.Sub data-slot="dropdown-menu-sub" {...props} />;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
const DropdownMenuSubTrigger = React.forwardRef<
|
|
210
|
-
React.ElementRef<typeof DropdownMenuPrimitive.SubTrigger>,
|
|
211
|
-
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubTrigger> & {
|
|
212
|
-
inset?: boolean;
|
|
213
|
-
}
|
|
214
|
-
>(({ className, inset, children, ...props }, ref) => (
|
|
215
|
-
<DropdownMenuPrimitive.SubTrigger
|
|
216
|
-
ref={ref}
|
|
217
|
-
data-slot="dropdown-menu-sub-trigger"
|
|
218
|
-
data-inset={inset}
|
|
219
|
-
className={cn(
|
|
220
|
-
"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",
|
|
221
|
-
className,
|
|
222
|
-
)}
|
|
223
|
-
{...props}
|
|
224
|
-
>
|
|
225
|
-
{children}
|
|
226
|
-
<ChevronRightIcon className="ml-auto size-4" />
|
|
227
|
-
</DropdownMenuPrimitive.SubTrigger>
|
|
228
|
-
));
|
|
229
|
-
DropdownMenuSubTrigger.displayName =
|
|
230
|
-
DropdownMenuPrimitive.SubTrigger.displayName;
|
|
231
|
-
|
|
232
|
-
const DropdownMenuSubContent = React.forwardRef<
|
|
233
|
-
React.ElementRef<typeof DropdownMenuPrimitive.SubContent>,
|
|
234
|
-
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubContent>
|
|
235
|
-
>(({ className, ...props }, ref) => (
|
|
236
|
-
<DropdownMenuPrimitive.SubContent
|
|
237
|
-
ref={ref}
|
|
238
|
-
data-slot="dropdown-menu-sub-content"
|
|
239
|
-
className={cn(
|
|
240
|
-
"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",
|
|
241
|
-
className,
|
|
242
|
-
)}
|
|
243
|
-
{...props}
|
|
244
|
-
/>
|
|
245
|
-
));
|
|
246
|
-
DropdownMenuSubContent.displayName =
|
|
247
|
-
DropdownMenuPrimitive.SubContent.displayName;
|
|
248
|
-
|
|
249
|
-
export {
|
|
250
|
-
DropdownMenu,
|
|
251
|
-
DropdownMenuPortal,
|
|
252
|
-
DropdownMenuTrigger,
|
|
253
|
-
DropdownMenuContent,
|
|
254
|
-
DropdownMenuGroup,
|
|
255
|
-
DropdownMenuLabel,
|
|
256
|
-
DropdownMenuItem,
|
|
257
|
-
DropdownMenuCheckboxItem,
|
|
258
|
-
DropdownMenuRadioGroup,
|
|
259
|
-
DropdownMenuRadioItem,
|
|
260
|
-
DropdownMenuSeparator,
|
|
261
|
-
DropdownMenuShortcut,
|
|
262
|
-
DropdownMenuSub,
|
|
263
|
-
DropdownMenuSubTrigger,
|
|
264
|
-
DropdownMenuSubContent,
|
|
265
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
|
|
3
|
-
import { cn } from "../../lib/utils";
|
|
4
|
-
|
|
5
|
-
function Input({ className, type, ...props }: React.ComponentProps<"input">) {
|
|
6
|
-
return (
|
|
7
|
-
<input
|
|
8
|
-
type={type}
|
|
9
|
-
data-slot="input"
|
|
10
|
-
className={cn(
|
|
11
|
-
"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",
|
|
12
|
-
"focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
|
|
13
|
-
"aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
|
14
|
-
className,
|
|
15
|
-
)}
|
|
16
|
-
{...props}
|
|
17
|
-
/>
|
|
18
|
-
);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export { Input };
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import * as React from "react";
|
|
4
|
-
import * as LabelPrimitive from "@radix-ui/react-label";
|
|
5
|
-
|
|
6
|
-
import { cn } from "../../lib/utils";
|
|
7
|
-
|
|
8
|
-
function Label({
|
|
9
|
-
className,
|
|
10
|
-
...props
|
|
11
|
-
}: React.ComponentProps<typeof LabelPrimitive.Root>) {
|
|
12
|
-
return (
|
|
13
|
-
<LabelPrimitive.Root
|
|
14
|
-
data-slot="label"
|
|
15
|
-
className={cn(
|
|
16
|
-
"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",
|
|
17
|
-
className,
|
|
18
|
-
)}
|
|
19
|
-
{...props}
|
|
20
|
-
/>
|
|
21
|
-
);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export { Label };
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import * as React from "react";
|
|
4
|
-
import * as SeparatorPrimitive from "@radix-ui/react-separator";
|
|
5
|
-
|
|
6
|
-
import { cn } from "../../lib/utils";
|
|
7
|
-
|
|
8
|
-
function Separator({
|
|
9
|
-
className,
|
|
10
|
-
orientation = "horizontal",
|
|
11
|
-
decorative = true,
|
|
12
|
-
...props
|
|
13
|
-
}: React.ComponentProps<typeof SeparatorPrimitive.Root>) {
|
|
14
|
-
return (
|
|
15
|
-
<SeparatorPrimitive.Root
|
|
16
|
-
data-slot="separator-root"
|
|
17
|
-
decorative={decorative}
|
|
18
|
-
orientation={orientation}
|
|
19
|
-
className={cn(
|
|
20
|
-
"bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",
|
|
21
|
-
className,
|
|
22
|
-
)}
|
|
23
|
-
{...props}
|
|
24
|
-
/>
|
|
25
|
-
);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export { Separator };
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import * as React from "react";
|
|
4
|
-
import * as SheetPrimitive from "@radix-ui/react-dialog";
|
|
5
|
-
import { X } from "lucide-react";
|
|
6
|
-
import type { ComponentType } from "react";
|
|
7
|
-
|
|
8
|
-
import { cn } from "../../lib/utils";
|
|
9
|
-
|
|
10
|
-
const XIcon = X as ComponentType<React.SVGProps<SVGSVGElement>>;
|
|
11
|
-
|
|
12
|
-
function Sheet({ ...props }: React.ComponentProps<typeof SheetPrimitive.Root>) {
|
|
13
|
-
return <SheetPrimitive.Root data-slot="sheet" {...props} />;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
function SheetTrigger({
|
|
17
|
-
...props
|
|
18
|
-
}: React.ComponentProps<typeof SheetPrimitive.Trigger>) {
|
|
19
|
-
return <SheetPrimitive.Trigger data-slot="sheet-trigger" {...props} />;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
function SheetClose({
|
|
23
|
-
...props
|
|
24
|
-
}: React.ComponentProps<typeof SheetPrimitive.Close>) {
|
|
25
|
-
return <SheetPrimitive.Close data-slot="sheet-close" {...props} />;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function SheetPortal({
|
|
29
|
-
...props
|
|
30
|
-
}: React.ComponentProps<typeof SheetPrimitive.Portal>) {
|
|
31
|
-
return <SheetPrimitive.Portal data-slot="sheet-portal" {...props} />;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
function SheetOverlay({
|
|
35
|
-
className,
|
|
36
|
-
...props
|
|
37
|
-
}: React.ComponentProps<typeof SheetPrimitive.Overlay>) {
|
|
38
|
-
return (
|
|
39
|
-
<SheetPrimitive.Overlay
|
|
40
|
-
data-slot="sheet-overlay"
|
|
41
|
-
className={cn(
|
|
42
|
-
"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",
|
|
43
|
-
className,
|
|
44
|
-
)}
|
|
45
|
-
{...props}
|
|
46
|
-
/>
|
|
47
|
-
);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
function SheetContent({
|
|
51
|
-
className,
|
|
52
|
-
children,
|
|
53
|
-
side = "right",
|
|
54
|
-
...props
|
|
55
|
-
}: React.ComponentProps<typeof SheetPrimitive.Content> & {
|
|
56
|
-
side?: "top" | "right" | "bottom" | "left";
|
|
57
|
-
}) {
|
|
58
|
-
return (
|
|
59
|
-
<SheetPortal>
|
|
60
|
-
<SheetOverlay />
|
|
61
|
-
<SheetPrimitive.Content
|
|
62
|
-
data-slot="sheet-content"
|
|
63
|
-
className={cn(
|
|
64
|
-
"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",
|
|
65
|
-
side === "right" &&
|
|
66
|
-
"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",
|
|
67
|
-
side === "left" &&
|
|
68
|
-
"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",
|
|
69
|
-
side === "top" &&
|
|
70
|
-
"data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b",
|
|
71
|
-
side === "bottom" &&
|
|
72
|
-
"data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t",
|
|
73
|
-
className,
|
|
74
|
-
)}
|
|
75
|
-
{...props}
|
|
76
|
-
>
|
|
77
|
-
{children}
|
|
78
|
-
<SheetPrimitive.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">
|
|
79
|
-
<XIcon className="size-4" />
|
|
80
|
-
<span className="sr-only">Close</span>
|
|
81
|
-
</SheetPrimitive.Close>
|
|
82
|
-
</SheetPrimitive.Content>
|
|
83
|
-
</SheetPortal>
|
|
84
|
-
);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
function SheetHeader({ className, ...props }: React.ComponentProps<"div">) {
|
|
88
|
-
return (
|
|
89
|
-
<div
|
|
90
|
-
data-slot="sheet-header"
|
|
91
|
-
className={cn("flex flex-col gap-1.5 p-4", className)}
|
|
92
|
-
{...props}
|
|
93
|
-
/>
|
|
94
|
-
);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
function SheetFooter({ className, ...props }: React.ComponentProps<"div">) {
|
|
98
|
-
return (
|
|
99
|
-
<div
|
|
100
|
-
data-slot="sheet-footer"
|
|
101
|
-
className={cn("mt-auto flex flex-col gap-2 p-4", className)}
|
|
102
|
-
{...props}
|
|
103
|
-
/>
|
|
104
|
-
);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
function SheetTitle({
|
|
108
|
-
className,
|
|
109
|
-
...props
|
|
110
|
-
}: React.ComponentProps<typeof SheetPrimitive.Title>) {
|
|
111
|
-
return (
|
|
112
|
-
<SheetPrimitive.Title
|
|
113
|
-
data-slot="sheet-title"
|
|
114
|
-
className={cn("text-foreground font-semibold", className)}
|
|
115
|
-
{...props}
|
|
116
|
-
/>
|
|
117
|
-
);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
function SheetDescription({
|
|
121
|
-
className,
|
|
122
|
-
...props
|
|
123
|
-
}: React.ComponentProps<typeof SheetPrimitive.Description>) {
|
|
124
|
-
return (
|
|
125
|
-
<SheetPrimitive.Description
|
|
126
|
-
data-slot="sheet-description"
|
|
127
|
-
className={cn("text-muted-foreground text-sm", className)}
|
|
128
|
-
{...props}
|
|
129
|
-
/>
|
|
130
|
-
);
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
export {
|
|
134
|
-
Sheet,
|
|
135
|
-
SheetTrigger,
|
|
136
|
-
SheetClose,
|
|
137
|
-
SheetContent,
|
|
138
|
-
SheetHeader,
|
|
139
|
-
SheetFooter,
|
|
140
|
-
SheetTitle,
|
|
141
|
-
SheetDescription,
|
|
142
|
-
};
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { useEffect, useState } from "react";
|
|
4
|
-
import { Sun, Moon } from "lucide-react";
|
|
5
|
-
|
|
6
|
-
import { Button } from "./button";
|
|
7
|
-
|
|
8
|
-
const STORAGE_KEY = "authdog-theme";
|
|
9
|
-
|
|
10
|
-
type ThemeMode = "light" | "dark";
|
|
11
|
-
|
|
12
|
-
const getPreferredTheme = (): ThemeMode => {
|
|
13
|
-
if (typeof window === "undefined") return "light";
|
|
14
|
-
const stored = window.localStorage.getItem(STORAGE_KEY);
|
|
15
|
-
if (stored === "light" || stored === "dark") {
|
|
16
|
-
return stored;
|
|
17
|
-
}
|
|
18
|
-
return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
const applyTheme = (mode: ThemeMode) => {
|
|
22
|
-
document.documentElement.classList.toggle("dark", mode === "dark");
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export const ThemeToggle = () => {
|
|
26
|
-
const [mode, setMode] = useState<ThemeMode>("light");
|
|
27
|
-
|
|
28
|
-
useEffect(() => {
|
|
29
|
-
const initial = getPreferredTheme();
|
|
30
|
-
applyTheme(initial);
|
|
31
|
-
setMode(initial);
|
|
32
|
-
}, []);
|
|
33
|
-
|
|
34
|
-
const toggle = () => {
|
|
35
|
-
const nextMode: ThemeMode = mode === "dark" ? "light" : "dark";
|
|
36
|
-
applyTheme(nextMode);
|
|
37
|
-
try {
|
|
38
|
-
window.localStorage.setItem(STORAGE_KEY, nextMode);
|
|
39
|
-
} catch {
|
|
40
|
-
// ignore
|
|
41
|
-
}
|
|
42
|
-
setMode(nextMode);
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
return (
|
|
46
|
-
<Button
|
|
47
|
-
variant="ghost"
|
|
48
|
-
size="icon"
|
|
49
|
-
className="cursor-pointer"
|
|
50
|
-
aria-label={mode === "dark" ? "Switch to light theme" : "Switch to dark theme"}
|
|
51
|
-
onClick={toggle}
|
|
52
|
-
>
|
|
53
|
-
{mode === "dark" ? <Sun className="h-4 w-4" /> : <Moon className="h-4 w-4" />}
|
|
54
|
-
</Button>
|
|
55
|
-
);
|
|
56
|
-
};
|
package/src/global.css
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
@tailwind base;
|
|
2
|
-
@tailwind components;
|
|
3
|
-
@tailwind utilities;
|
|
4
|
-
|
|
5
|
-
@layer base {
|
|
6
|
-
:root {
|
|
7
|
-
--background: 0 0% 100%;
|
|
8
|
-
--foreground: 222.2 47.4% 11.2%;
|
|
9
|
-
|
|
10
|
-
--muted: 210 40% 96.1%;
|
|
11
|
-
--muted-foreground: 215.4 16.3% 46.9%;
|
|
12
|
-
|
|
13
|
-
--popover: 0 0% 100%;
|
|
14
|
-
--popover-foreground: 222.2 47.4% 11.2%;
|
|
15
|
-
|
|
16
|
-
--card: 0 0% 100%;
|
|
17
|
-
--card-foreground: 222.2 47.4% 11.2%;
|
|
18
|
-
|
|
19
|
-
--border: 214.3 31.8% 91.4%;
|
|
20
|
-
--input: 214.3 31.8% 91.4%;
|
|
21
|
-
|
|
22
|
-
--primary: 222.2 47.4% 11.2%;
|
|
23
|
-
--primary-foreground: 210 40% 98%;
|
|
24
|
-
|
|
25
|
-
--secondary: 210 40% 96.1%;
|
|
26
|
-
--secondary-foreground: 222.2 47.4% 11.2%;
|
|
27
|
-
|
|
28
|
-
--accent: 210 40% 96.1%;
|
|
29
|
-
--accent-foreground: 222.2 47.4% 11.2%;
|
|
30
|
-
|
|
31
|
-
--destructive: 0 100% 50%;
|
|
32
|
-
--destructive-foreground: 210 40% 98%;
|
|
33
|
-
|
|
34
|
-
--ring: 215 20.2% 65.1%;
|
|
35
|
-
|
|
36
|
-
--radius: 0.5rem;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
.dark {
|
|
40
|
-
--background: 224 71% 4%;
|
|
41
|
-
--foreground: 213 31% 91%;
|
|
42
|
-
|
|
43
|
-
--muted: 223 47% 11%;
|
|
44
|
-
--muted-foreground: 215.4 16.3% 56.9%;
|
|
45
|
-
|
|
46
|
-
--popover: 224 71% 4%;
|
|
47
|
-
--popover-foreground: 215 20.2% 65.1%;
|
|
48
|
-
|
|
49
|
-
--card: 224 71% 4%;
|
|
50
|
-
--card-foreground: 213 31% 91%;
|
|
51
|
-
|
|
52
|
-
--border: 216 34% 17%;
|
|
53
|
-
--input: 216 34% 17%;
|
|
54
|
-
|
|
55
|
-
--primary: 210 40% 98%;
|
|
56
|
-
--primary-foreground: 222.2 47.4% 1.2%;
|
|
57
|
-
|
|
58
|
-
--secondary: 222.2 47.4% 11.2%;
|
|
59
|
-
--secondary-foreground: 210 40% 98%;
|
|
60
|
-
|
|
61
|
-
--accent: 216 34% 17%;
|
|
62
|
-
--accent-foreground: 210 40% 98%;
|
|
63
|
-
|
|
64
|
-
--destructive: 0 63% 31%;
|
|
65
|
-
--destructive-foreground: 210 40% 98%;
|
|
66
|
-
|
|
67
|
-
--ring: 216 34% 17%;
|
|
68
|
-
|
|
69
|
-
--radius: 0.5rem;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
@layer base {
|
|
74
|
-
* {
|
|
75
|
-
@apply border-border;
|
|
76
|
-
}
|
|
77
|
-
body {
|
|
78
|
-
@apply bg-background text-foreground;
|
|
79
|
-
font-feature-settings: "rlig" 1, "calt" 1;
|
|
80
|
-
}
|
|
81
|
-
}
|
package/src/index.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export { Button } from "./components/ui/button";
|
|
2
|
-
export { ClientOnly } from "./components/core/client-only";
|
|
3
|
-
export { Navbar } from "./components/core/navbar";
|
|
4
|
-
export type { NavItem, DropdownMenuItem } from "./components/core/navbar";
|
|
5
|
-
export { UserProfile } from "./components/core/user-profile";
|
|
6
|
-
export { UserDropdown } from "./components/core/user-dropdown";
|
|
7
|
-
export { PlaceholderAlert } from "./components/core/placeholder-alert";
|
|
8
|
-
export { TOTPValidator } from "./components/flow/totp-validator";
|
package/src/lib/utils.ts
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import type { Meta, StoryObj } from "@storybook/react";
|
|
4
|
-
|
|
5
|
-
import { Navbar } from "../../components/core/navbar";
|
|
6
|
-
import React from "react";
|
|
7
|
-
|
|
8
|
-
const demoItems = [
|
|
9
|
-
{ title: "Home", href: "/" },
|
|
10
|
-
{ title: "Features", href: "/features" },
|
|
11
|
-
{ title: "Pricing", href: "/pricing" },
|
|
12
|
-
// { title: "Contact", href: "/contact" },
|
|
13
|
-
];
|
|
14
|
-
|
|
15
|
-
const demoUser = {
|
|
16
|
-
id: "user_123",
|
|
17
|
-
displayName: "Avery Stone",
|
|
18
|
-
emails: [{ value: "avery.stone@example.com" }],
|
|
19
|
-
photos: [{ value: "https://i.pravatar.cc/120?img=56" }],
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
const meta = {
|
|
23
|
-
title: "Core/Navbar",
|
|
24
|
-
component: Navbar,
|
|
25
|
-
tags: ["autodocs"],
|
|
26
|
-
parameters: {
|
|
27
|
-
layout: "fullscreen",
|
|
28
|
-
},
|
|
29
|
-
args: {
|
|
30
|
-
logoText: "Authdog",
|
|
31
|
-
items: demoItems,
|
|
32
|
-
},
|
|
33
|
-
} satisfies Meta<typeof Navbar>;
|
|
34
|
-
|
|
35
|
-
export default meta;
|
|
36
|
-
|
|
37
|
-
type Story = StoryObj<typeof Navbar>;
|
|
38
|
-
|
|
39
|
-
export const Guest: Story = {};
|
|
40
|
-
|
|
41
|
-
export const Authenticated: Story = {
|
|
42
|
-
args: {
|
|
43
|
-
user: demoUser,
|
|
44
|
-
},
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
export const WithLogo: Story = {
|
|
48
|
-
args: {
|
|
49
|
-
logoSrc: "https://dummyimage.com/64x64/111827/ffffff&text=AD",
|
|
50
|
-
},
|
|
51
|
-
};
|