@nexys/user-management-web 0.3.1
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/README.md +61 -0
- package/components.json +21 -0
- package/package.json +66 -0
- package/src/components/audit/audit-log-table.test.tsx +98 -0
- package/src/components/audit/audit-log-table.tsx +227 -0
- package/src/components/auth/accept-invitation-card.tsx +104 -0
- package/src/components/auth/forgot-password-form.tsx +93 -0
- package/src/components/auth/reset-password-form.tsx +144 -0
- package/src/components/auth/sign-in-form.test.tsx +164 -0
- package/src/components/auth/sign-in-form.tsx +504 -0
- package/src/components/auth/sign-up-form.tsx +124 -0
- package/src/components/layout/app-shell.tsx +189 -0
- package/src/components/layout/auth-shell.tsx +28 -0
- package/src/components/layout/theme-toggle.tsx +55 -0
- package/src/components/layout/user-menu.tsx +84 -0
- package/src/components/primitives/empty-state.tsx +40 -0
- package/src/components/primitives/page-header.tsx +27 -0
- package/src/components/primitives/spinner.tsx +28 -0
- package/src/components/profile/api-tokens-card.tsx +238 -0
- package/src/components/profile/change-password-form.tsx +159 -0
- package/src/components/profile/passkeys-card.tsx +186 -0
- package/src/components/profile/profile-card.tsx +107 -0
- package/src/components/profile/refresh-tokens-list.tsx +176 -0
- package/src/components/profile/two-factor-card.tsx +230 -0
- package/src/components/projects/project-consents.tsx +577 -0
- package/src/components/projects/project-create-dialog.tsx +193 -0
- package/src/components/projects/project-detail-tabs.tsx +64 -0
- package/src/components/projects/project-email-templates.tsx +285 -0
- package/src/components/projects/project-notices.tsx +461 -0
- package/src/components/projects/project-settings.tsx +1059 -0
- package/src/components/projects/project-tenants.tsx +108 -0
- package/src/components/projects/projects-table.test.tsx +109 -0
- package/src/components/projects/projects-table.tsx +240 -0
- package/src/components/roles/role-badge.tsx +91 -0
- package/src/components/roles/role-select.tsx +76 -0
- package/src/components/tenants/tenant-create-dialog.tsx +164 -0
- package/src/components/tenants/tenant-detail-tabs.tsx +51 -0
- package/src/components/tenants/tenant-members.tsx +587 -0
- package/src/components/tenants/tenant-roles.test.tsx +107 -0
- package/src/components/tenants/tenant-roles.tsx +418 -0
- package/src/components/tenants/tenant-settings.tsx +392 -0
- package/src/components/tenants/tenants-table.test.tsx +81 -0
- package/src/components/tenants/tenants-table.tsx +247 -0
- package/src/components/ui/alert.tsx +52 -0
- package/src/components/ui/avatar.tsx +46 -0
- package/src/components/ui/badge.tsx +32 -0
- package/src/components/ui/button.tsx +64 -0
- package/src/components/ui/card.tsx +65 -0
- package/src/components/ui/dialog.tsx +99 -0
- package/src/components/ui/dropdown-menu.tsx +97 -0
- package/src/components/ui/field.tsx +44 -0
- package/src/components/ui/input.tsx +23 -0
- package/src/components/ui/label.tsx +19 -0
- package/src/components/ui/select.tsx +87 -0
- package/src/components/ui/separator.tsx +22 -0
- package/src/components/ui/skeleton.tsx +13 -0
- package/src/components/ui/switch.tsx +29 -0
- package/src/components/ui/table.tsx +87 -0
- package/src/components/ui/tabs.tsx +51 -0
- package/src/components/ui/textarea.tsx +22 -0
- package/src/components/ui/tooltip.tsx +27 -0
- package/src/components/users/user-create-dialog.tsx +229 -0
- package/src/components/users/user-delete-dialog.tsx +88 -0
- package/src/components/users/user-detail.tsx +818 -0
- package/src/components/users/users-table.test.tsx +107 -0
- package/src/components/users/users-table.tsx +386 -0
- package/src/context/auth-context.tsx +127 -0
- package/src/context/theme-context.test.tsx +78 -0
- package/src/context/theme-context.tsx +110 -0
- package/src/hooks/use-call.ts +60 -0
- package/src/index.ts +160 -0
- package/src/lib/error-message.ts +16 -0
- package/src/lib/utils.test.ts +61 -0
- package/src/lib/utils.ts +79 -0
- package/src/lib/webauthn.ts +36 -0
- package/src/styles.css +107 -0
- package/src/test-setup.ts +5 -0
- package/tailwind.preset.cjs +15 -0
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
|
|
2
|
+
import { Check } from "lucide-react";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
|
|
5
|
+
import { cn } from "../../lib/utils.js";
|
|
6
|
+
|
|
7
|
+
export const DropdownMenu = DropdownMenuPrimitive.Root;
|
|
8
|
+
export const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
|
|
9
|
+
export const DropdownMenuGroup = DropdownMenuPrimitive.Group;
|
|
10
|
+
export const DropdownMenuPortal = DropdownMenuPrimitive.Portal;
|
|
11
|
+
|
|
12
|
+
export const DropdownMenuContent = React.forwardRef<
|
|
13
|
+
React.ElementRef<typeof DropdownMenuPrimitive.Content>,
|
|
14
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content>
|
|
15
|
+
>(({ className, sideOffset = 4, ...props }, ref) => (
|
|
16
|
+
<DropdownMenuPrimitive.Portal>
|
|
17
|
+
<DropdownMenuPrimitive.Content
|
|
18
|
+
ref={ref}
|
|
19
|
+
sideOffset={sideOffset}
|
|
20
|
+
className={cn(
|
|
21
|
+
"z-50 min-w-[10rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md",
|
|
22
|
+
"data-[state=open]:animate-in data-[state=closed]:animate-out",
|
|
23
|
+
className
|
|
24
|
+
)}
|
|
25
|
+
{...props}
|
|
26
|
+
/>
|
|
27
|
+
</DropdownMenuPrimitive.Portal>
|
|
28
|
+
));
|
|
29
|
+
DropdownMenuContent.displayName = "DropdownMenuContent";
|
|
30
|
+
|
|
31
|
+
export const DropdownMenuItem = React.forwardRef<
|
|
32
|
+
React.ElementRef<typeof DropdownMenuPrimitive.Item>,
|
|
33
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> & {
|
|
34
|
+
inset?: boolean;
|
|
35
|
+
}
|
|
36
|
+
>(({ className, inset, ...props }, ref) => (
|
|
37
|
+
<DropdownMenuPrimitive.Item
|
|
38
|
+
ref={ref}
|
|
39
|
+
className={cn(
|
|
40
|
+
"relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors",
|
|
41
|
+
"focus:bg-accent focus:text-accent-foreground",
|
|
42
|
+
"data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
43
|
+
inset && "pl-8",
|
|
44
|
+
className
|
|
45
|
+
)}
|
|
46
|
+
{...props}
|
|
47
|
+
/>
|
|
48
|
+
));
|
|
49
|
+
DropdownMenuItem.displayName = "DropdownMenuItem";
|
|
50
|
+
|
|
51
|
+
export const DropdownMenuLabel = React.forwardRef<
|
|
52
|
+
React.ElementRef<typeof DropdownMenuPrimitive.Label>,
|
|
53
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label>
|
|
54
|
+
>(({ className, ...props }, ref) => (
|
|
55
|
+
<DropdownMenuPrimitive.Label
|
|
56
|
+
ref={ref}
|
|
57
|
+
className={cn("px-2 py-1.5 text-xs font-medium text-muted-foreground", className)}
|
|
58
|
+
{...props}
|
|
59
|
+
/>
|
|
60
|
+
));
|
|
61
|
+
DropdownMenuLabel.displayName = "DropdownMenuLabel";
|
|
62
|
+
|
|
63
|
+
export const DropdownMenuSeparator = React.forwardRef<
|
|
64
|
+
React.ElementRef<typeof DropdownMenuPrimitive.Separator>,
|
|
65
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Separator>
|
|
66
|
+
>(({ className, ...props }, ref) => (
|
|
67
|
+
<DropdownMenuPrimitive.Separator
|
|
68
|
+
ref={ref}
|
|
69
|
+
className={cn("-mx-1 my-1 h-px bg-border", className)}
|
|
70
|
+
{...props}
|
|
71
|
+
/>
|
|
72
|
+
));
|
|
73
|
+
DropdownMenuSeparator.displayName = "DropdownMenuSeparator";
|
|
74
|
+
|
|
75
|
+
export const DropdownMenuCheckboxItem = React.forwardRef<
|
|
76
|
+
React.ElementRef<typeof DropdownMenuPrimitive.CheckboxItem>,
|
|
77
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem>
|
|
78
|
+
>(({ className, children, checked, ...props }, ref) => (
|
|
79
|
+
<DropdownMenuPrimitive.CheckboxItem
|
|
80
|
+
ref={ref}
|
|
81
|
+
checked={checked}
|
|
82
|
+
className={cn(
|
|
83
|
+
"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors",
|
|
84
|
+
"focus:bg-accent focus:text-accent-foreground",
|
|
85
|
+
className
|
|
86
|
+
)}
|
|
87
|
+
{...props}
|
|
88
|
+
>
|
|
89
|
+
<span className="absolute left-2 flex size-3.5 items-center justify-center">
|
|
90
|
+
<DropdownMenuPrimitive.ItemIndicator>
|
|
91
|
+
<Check className="size-4" />
|
|
92
|
+
</DropdownMenuPrimitive.ItemIndicator>
|
|
93
|
+
</span>
|
|
94
|
+
{children}
|
|
95
|
+
</DropdownMenuPrimitive.CheckboxItem>
|
|
96
|
+
));
|
|
97
|
+
DropdownMenuCheckboxItem.displayName = "DropdownMenuCheckboxItem";
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
import { cn } from "../../lib/utils.js";
|
|
4
|
+
import { Label } from "./label.js";
|
|
5
|
+
|
|
6
|
+
export interface FieldProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
7
|
+
label?: React.ReactNode;
|
|
8
|
+
description?: React.ReactNode;
|
|
9
|
+
error?: React.ReactNode;
|
|
10
|
+
htmlFor?: string;
|
|
11
|
+
required?: boolean;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const Field = ({
|
|
15
|
+
label,
|
|
16
|
+
description,
|
|
17
|
+
error,
|
|
18
|
+
htmlFor,
|
|
19
|
+
required,
|
|
20
|
+
className,
|
|
21
|
+
children,
|
|
22
|
+
...props
|
|
23
|
+
}: FieldProps) => (
|
|
24
|
+
<div className={cn("grid gap-2", className)} {...props}>
|
|
25
|
+
{label !== undefined && (
|
|
26
|
+
<Label htmlFor={htmlFor} className="flex items-center gap-1">
|
|
27
|
+
{label}
|
|
28
|
+
{required ? (
|
|
29
|
+
<span className="text-destructive" aria-hidden>
|
|
30
|
+
*
|
|
31
|
+
</span>
|
|
32
|
+
) : null}
|
|
33
|
+
</Label>
|
|
34
|
+
)}
|
|
35
|
+
{children}
|
|
36
|
+
{error ? (
|
|
37
|
+
<p className="text-xs text-destructive" role="alert">
|
|
38
|
+
{error}
|
|
39
|
+
</p>
|
|
40
|
+
) : description ? (
|
|
41
|
+
<p className="text-xs text-muted-foreground">{description}</p>
|
|
42
|
+
) : null}
|
|
43
|
+
</div>
|
|
44
|
+
);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
import { cn } from "../../lib/utils.js";
|
|
4
|
+
|
|
5
|
+
export const Input = React.forwardRef<HTMLInputElement, React.ComponentProps<"input">>(
|
|
6
|
+
({ className, type, ...props }, ref) => (
|
|
7
|
+
<input
|
|
8
|
+
ref={ref}
|
|
9
|
+
type={type}
|
|
10
|
+
className={cn(
|
|
11
|
+
"flex h-9 w-full rounded-md border border-input bg-background px-3 py-1 text-sm shadow-sm transition-colors",
|
|
12
|
+
"file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground",
|
|
13
|
+
"placeholder:text-muted-foreground",
|
|
14
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40 focus-visible:ring-offset-2 focus-visible:ring-offset-background",
|
|
15
|
+
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
16
|
+
"aria-invalid:border-destructive aria-invalid:ring-destructive/20",
|
|
17
|
+
className
|
|
18
|
+
)}
|
|
19
|
+
{...props}
|
|
20
|
+
/>
|
|
21
|
+
)
|
|
22
|
+
);
|
|
23
|
+
Input.displayName = "Input";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as LabelPrimitive from "@radix-ui/react-label";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
|
|
4
|
+
import { cn } from "../../lib/utils.js";
|
|
5
|
+
|
|
6
|
+
export const Label = React.forwardRef<
|
|
7
|
+
React.ElementRef<typeof LabelPrimitive.Root>,
|
|
8
|
+
React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root>
|
|
9
|
+
>(({ className, ...props }, ref) => (
|
|
10
|
+
<LabelPrimitive.Root
|
|
11
|
+
ref={ref}
|
|
12
|
+
className={cn(
|
|
13
|
+
"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
|
|
14
|
+
className
|
|
15
|
+
)}
|
|
16
|
+
{...props}
|
|
17
|
+
/>
|
|
18
|
+
));
|
|
19
|
+
Label.displayName = "Label";
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import * as SelectPrimitive from "@radix-ui/react-select";
|
|
2
|
+
import { Check, ChevronDown } from "lucide-react";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
|
|
5
|
+
import { cn } from "../../lib/utils.js";
|
|
6
|
+
|
|
7
|
+
export const Select = SelectPrimitive.Root;
|
|
8
|
+
export const SelectGroup = SelectPrimitive.Group;
|
|
9
|
+
export const SelectValue = SelectPrimitive.Value;
|
|
10
|
+
|
|
11
|
+
export const SelectTrigger = React.forwardRef<
|
|
12
|
+
React.ElementRef<typeof SelectPrimitive.Trigger>,
|
|
13
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger>
|
|
14
|
+
>(({ className, children, ...props }, ref) => (
|
|
15
|
+
<SelectPrimitive.Trigger
|
|
16
|
+
ref={ref}
|
|
17
|
+
className={cn(
|
|
18
|
+
"flex h-9 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-1 text-sm shadow-sm",
|
|
19
|
+
"focus:outline-none focus:ring-2 focus:ring-ring/40 focus:ring-offset-2 focus:ring-offset-background",
|
|
20
|
+
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
21
|
+
"[&>span]:line-clamp-1",
|
|
22
|
+
className
|
|
23
|
+
)}
|
|
24
|
+
{...props}
|
|
25
|
+
>
|
|
26
|
+
{children}
|
|
27
|
+
<SelectPrimitive.Icon asChild>
|
|
28
|
+
<ChevronDown className="size-4 opacity-60" />
|
|
29
|
+
</SelectPrimitive.Icon>
|
|
30
|
+
</SelectPrimitive.Trigger>
|
|
31
|
+
));
|
|
32
|
+
SelectTrigger.displayName = "SelectTrigger";
|
|
33
|
+
|
|
34
|
+
export const SelectContent = React.forwardRef<
|
|
35
|
+
React.ElementRef<typeof SelectPrimitive.Content>,
|
|
36
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content>
|
|
37
|
+
>(({ className, children, position = "popper", ...props }, ref) => (
|
|
38
|
+
<SelectPrimitive.Portal>
|
|
39
|
+
<SelectPrimitive.Content
|
|
40
|
+
ref={ref}
|
|
41
|
+
position={position}
|
|
42
|
+
className={cn(
|
|
43
|
+
"relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md",
|
|
44
|
+
"data-[state=open]:animate-in data-[state=closed]:animate-out",
|
|
45
|
+
position === "popper" &&
|
|
46
|
+
"data-[side=bottom]:translate-y-1 data-[side=top]:-translate-y-1",
|
|
47
|
+
className
|
|
48
|
+
)}
|
|
49
|
+
{...props}
|
|
50
|
+
>
|
|
51
|
+
<SelectPrimitive.Viewport
|
|
52
|
+
className={cn(
|
|
53
|
+
"p-1",
|
|
54
|
+
position === "popper" &&
|
|
55
|
+
"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"
|
|
56
|
+
)}
|
|
57
|
+
>
|
|
58
|
+
{children}
|
|
59
|
+
</SelectPrimitive.Viewport>
|
|
60
|
+
</SelectPrimitive.Content>
|
|
61
|
+
</SelectPrimitive.Portal>
|
|
62
|
+
));
|
|
63
|
+
SelectContent.displayName = "SelectContent";
|
|
64
|
+
|
|
65
|
+
export const SelectItem = React.forwardRef<
|
|
66
|
+
React.ElementRef<typeof SelectPrimitive.Item>,
|
|
67
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item>
|
|
68
|
+
>(({ className, children, ...props }, ref) => (
|
|
69
|
+
<SelectPrimitive.Item
|
|
70
|
+
ref={ref}
|
|
71
|
+
className={cn(
|
|
72
|
+
"relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none",
|
|
73
|
+
"focus:bg-accent focus:text-accent-foreground",
|
|
74
|
+
"data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
75
|
+
className
|
|
76
|
+
)}
|
|
77
|
+
{...props}
|
|
78
|
+
>
|
|
79
|
+
<span className="absolute right-2 flex size-3.5 items-center justify-center">
|
|
80
|
+
<SelectPrimitive.ItemIndicator>
|
|
81
|
+
<Check className="size-4" />
|
|
82
|
+
</SelectPrimitive.ItemIndicator>
|
|
83
|
+
</span>
|
|
84
|
+
<SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
|
|
85
|
+
</SelectPrimitive.Item>
|
|
86
|
+
));
|
|
87
|
+
SelectItem.displayName = "SelectItem";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as SeparatorPrimitive from "@radix-ui/react-separator";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
|
|
4
|
+
import { cn } from "../../lib/utils.js";
|
|
5
|
+
|
|
6
|
+
export const Separator = React.forwardRef<
|
|
7
|
+
React.ElementRef<typeof SeparatorPrimitive.Root>,
|
|
8
|
+
React.ComponentPropsWithoutRef<typeof SeparatorPrimitive.Root>
|
|
9
|
+
>(({ className, orientation = "horizontal", decorative = true, ...props }, ref) => (
|
|
10
|
+
<SeparatorPrimitive.Root
|
|
11
|
+
ref={ref}
|
|
12
|
+
decorative={decorative}
|
|
13
|
+
orientation={orientation}
|
|
14
|
+
className={cn(
|
|
15
|
+
"shrink-0 bg-border",
|
|
16
|
+
orientation === "horizontal" ? "h-px w-full" : "h-full w-px",
|
|
17
|
+
className
|
|
18
|
+
)}
|
|
19
|
+
{...props}
|
|
20
|
+
/>
|
|
21
|
+
));
|
|
22
|
+
Separator.displayName = "Separator";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
import { cn } from "../../lib/utils.js";
|
|
4
|
+
|
|
5
|
+
export const Skeleton = ({
|
|
6
|
+
className,
|
|
7
|
+
...props
|
|
8
|
+
}: React.HTMLAttributes<HTMLDivElement>) => (
|
|
9
|
+
<div
|
|
10
|
+
className={cn("animate-pulse rounded-md bg-muted", className)}
|
|
11
|
+
{...props}
|
|
12
|
+
/>
|
|
13
|
+
);
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as SwitchPrimitive from "@radix-ui/react-switch";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
|
|
4
|
+
import { cn } from "../../lib/utils.js";
|
|
5
|
+
|
|
6
|
+
export const Switch = React.forwardRef<
|
|
7
|
+
React.ElementRef<typeof SwitchPrimitive.Root>,
|
|
8
|
+
React.ComponentPropsWithoutRef<typeof SwitchPrimitive.Root>
|
|
9
|
+
>(({ className, ...props }, ref) => (
|
|
10
|
+
<SwitchPrimitive.Root
|
|
11
|
+
ref={ref}
|
|
12
|
+
className={cn(
|
|
13
|
+
"peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border border-transparent",
|
|
14
|
+
"transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40 focus-visible:ring-offset-2",
|
|
15
|
+
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
16
|
+
"data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",
|
|
17
|
+
className
|
|
18
|
+
)}
|
|
19
|
+
{...props}
|
|
20
|
+
>
|
|
21
|
+
<SwitchPrimitive.Thumb
|
|
22
|
+
className={cn(
|
|
23
|
+
"pointer-events-none block size-4 rounded-full bg-background shadow ring-0 transition-transform",
|
|
24
|
+
"data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0.5"
|
|
25
|
+
)}
|
|
26
|
+
/>
|
|
27
|
+
</SwitchPrimitive.Root>
|
|
28
|
+
));
|
|
29
|
+
Switch.displayName = "Switch";
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
import { cn } from "../../lib/utils.js";
|
|
4
|
+
|
|
5
|
+
export const Table = React.forwardRef<
|
|
6
|
+
HTMLTableElement,
|
|
7
|
+
React.HTMLAttributes<HTMLTableElement>
|
|
8
|
+
>(({ className, ...props }, ref) => (
|
|
9
|
+
<div className="relative w-full overflow-auto">
|
|
10
|
+
<table
|
|
11
|
+
ref={ref}
|
|
12
|
+
className={cn("w-full caption-bottom text-sm", className)}
|
|
13
|
+
{...props}
|
|
14
|
+
/>
|
|
15
|
+
</div>
|
|
16
|
+
));
|
|
17
|
+
Table.displayName = "Table";
|
|
18
|
+
|
|
19
|
+
export const TableHeader = React.forwardRef<
|
|
20
|
+
HTMLTableSectionElement,
|
|
21
|
+
React.HTMLAttributes<HTMLTableSectionElement>
|
|
22
|
+
>(({ className, ...props }, ref) => (
|
|
23
|
+
<thead ref={ref} className={cn("[&_tr]:border-b", className)} {...props} />
|
|
24
|
+
));
|
|
25
|
+
TableHeader.displayName = "TableHeader";
|
|
26
|
+
|
|
27
|
+
export const TableBody = React.forwardRef<
|
|
28
|
+
HTMLTableSectionElement,
|
|
29
|
+
React.HTMLAttributes<HTMLTableSectionElement>
|
|
30
|
+
>(({ className, ...props }, ref) => (
|
|
31
|
+
<tbody
|
|
32
|
+
ref={ref}
|
|
33
|
+
className={cn("[&_tr:last-child]:border-0", className)}
|
|
34
|
+
{...props}
|
|
35
|
+
/>
|
|
36
|
+
));
|
|
37
|
+
TableBody.displayName = "TableBody";
|
|
38
|
+
|
|
39
|
+
export const TableRow = React.forwardRef<
|
|
40
|
+
HTMLTableRowElement,
|
|
41
|
+
React.HTMLAttributes<HTMLTableRowElement>
|
|
42
|
+
>(({ className, ...props }, ref) => (
|
|
43
|
+
<tr
|
|
44
|
+
ref={ref}
|
|
45
|
+
className={cn(
|
|
46
|
+
"border-b transition-colors hover:bg-muted/40 data-[state=selected]:bg-muted",
|
|
47
|
+
className
|
|
48
|
+
)}
|
|
49
|
+
{...props}
|
|
50
|
+
/>
|
|
51
|
+
));
|
|
52
|
+
TableRow.displayName = "TableRow";
|
|
53
|
+
|
|
54
|
+
export const TableHead = React.forwardRef<
|
|
55
|
+
HTMLTableCellElement,
|
|
56
|
+
React.ThHTMLAttributes<HTMLTableCellElement>
|
|
57
|
+
>(({ className, ...props }, ref) => (
|
|
58
|
+
<th
|
|
59
|
+
ref={ref}
|
|
60
|
+
className={cn(
|
|
61
|
+
"h-10 px-3 text-left align-middle text-xs font-medium uppercase tracking-wide text-muted-foreground",
|
|
62
|
+
className
|
|
63
|
+
)}
|
|
64
|
+
{...props}
|
|
65
|
+
/>
|
|
66
|
+
));
|
|
67
|
+
TableHead.displayName = "TableHead";
|
|
68
|
+
|
|
69
|
+
export const TableCell = React.forwardRef<
|
|
70
|
+
HTMLTableCellElement,
|
|
71
|
+
React.TdHTMLAttributes<HTMLTableCellElement>
|
|
72
|
+
>(({ className, ...props }, ref) => (
|
|
73
|
+
<td
|
|
74
|
+
ref={ref}
|
|
75
|
+
className={cn("px-3 py-3 align-middle", className)}
|
|
76
|
+
{...props}
|
|
77
|
+
/>
|
|
78
|
+
));
|
|
79
|
+
TableCell.displayName = "TableCell";
|
|
80
|
+
|
|
81
|
+
export const TableEmpty = ({ children }: { children: React.ReactNode }) => (
|
|
82
|
+
<tr>
|
|
83
|
+
<td colSpan={999} className="py-12 text-center text-sm text-muted-foreground">
|
|
84
|
+
{children}
|
|
85
|
+
</td>
|
|
86
|
+
</tr>
|
|
87
|
+
);
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import * as TabsPrimitive from "@radix-ui/react-tabs";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
|
|
4
|
+
import { cn } from "../../lib/utils.js";
|
|
5
|
+
|
|
6
|
+
export const Tabs = TabsPrimitive.Root;
|
|
7
|
+
|
|
8
|
+
export const TabsList = React.forwardRef<
|
|
9
|
+
React.ElementRef<typeof TabsPrimitive.List>,
|
|
10
|
+
React.ComponentPropsWithoutRef<typeof TabsPrimitive.List>
|
|
11
|
+
>(({ className, ...props }, ref) => (
|
|
12
|
+
<TabsPrimitive.List
|
|
13
|
+
ref={ref}
|
|
14
|
+
className={cn(
|
|
15
|
+
"inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",
|
|
16
|
+
className
|
|
17
|
+
)}
|
|
18
|
+
{...props}
|
|
19
|
+
/>
|
|
20
|
+
));
|
|
21
|
+
TabsList.displayName = "TabsList";
|
|
22
|
+
|
|
23
|
+
export const TabsTrigger = React.forwardRef<
|
|
24
|
+
React.ElementRef<typeof TabsPrimitive.Trigger>,
|
|
25
|
+
React.ComponentPropsWithoutRef<typeof TabsPrimitive.Trigger>
|
|
26
|
+
>(({ className, ...props }, ref) => (
|
|
27
|
+
<TabsPrimitive.Trigger
|
|
28
|
+
ref={ref}
|
|
29
|
+
className={cn(
|
|
30
|
+
"inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium",
|
|
31
|
+
"transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40",
|
|
32
|
+
"disabled:pointer-events-none disabled:opacity-50",
|
|
33
|
+
"data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",
|
|
34
|
+
className
|
|
35
|
+
)}
|
|
36
|
+
{...props}
|
|
37
|
+
/>
|
|
38
|
+
));
|
|
39
|
+
TabsTrigger.displayName = "TabsTrigger";
|
|
40
|
+
|
|
41
|
+
export const TabsContent = React.forwardRef<
|
|
42
|
+
React.ElementRef<typeof TabsPrimitive.Content>,
|
|
43
|
+
React.ComponentPropsWithoutRef<typeof TabsPrimitive.Content>
|
|
44
|
+
>(({ className, ...props }, ref) => (
|
|
45
|
+
<TabsPrimitive.Content
|
|
46
|
+
ref={ref}
|
|
47
|
+
className={cn("mt-4 focus-visible:outline-none", className)}
|
|
48
|
+
{...props}
|
|
49
|
+
/>
|
|
50
|
+
));
|
|
51
|
+
TabsContent.displayName = "TabsContent";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
import { cn } from "../../lib/utils.js";
|
|
4
|
+
|
|
5
|
+
export const Textarea = React.forwardRef<
|
|
6
|
+
HTMLTextAreaElement,
|
|
7
|
+
React.ComponentProps<"textarea">
|
|
8
|
+
>(({ className, ...props }, ref) => (
|
|
9
|
+
<textarea
|
|
10
|
+
ref={ref}
|
|
11
|
+
className={cn(
|
|
12
|
+
"flex min-h-24 w-full rounded-md border border-input bg-background px-3 py-2 text-sm shadow-sm transition-colors",
|
|
13
|
+
"placeholder:text-muted-foreground",
|
|
14
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40 focus-visible:ring-offset-2 focus-visible:ring-offset-background",
|
|
15
|
+
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
16
|
+
"aria-invalid:border-destructive aria-invalid:ring-destructive/20",
|
|
17
|
+
className
|
|
18
|
+
)}
|
|
19
|
+
{...props}
|
|
20
|
+
/>
|
|
21
|
+
));
|
|
22
|
+
Textarea.displayName = "Textarea";
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
|
|
4
|
+
import { cn } from "../../lib/utils.js";
|
|
5
|
+
|
|
6
|
+
export const TooltipProvider = TooltipPrimitive.Provider;
|
|
7
|
+
export const Tooltip = TooltipPrimitive.Root;
|
|
8
|
+
export const TooltipTrigger = TooltipPrimitive.Trigger;
|
|
9
|
+
|
|
10
|
+
export const TooltipContent = React.forwardRef<
|
|
11
|
+
React.ElementRef<typeof TooltipPrimitive.Content>,
|
|
12
|
+
React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>
|
|
13
|
+
>(({ className, sideOffset = 4, ...props }, ref) => (
|
|
14
|
+
<TooltipPrimitive.Portal>
|
|
15
|
+
<TooltipPrimitive.Content
|
|
16
|
+
ref={ref}
|
|
17
|
+
sideOffset={sideOffset}
|
|
18
|
+
className={cn(
|
|
19
|
+
"z-50 overflow-hidden rounded-md bg-primary px-2.5 py-1.5 text-xs text-primary-foreground shadow",
|
|
20
|
+
"data-[state=delayed-open]:animate-in data-[state=closed]:animate-out",
|
|
21
|
+
className
|
|
22
|
+
)}
|
|
23
|
+
{...props}
|
|
24
|
+
/>
|
|
25
|
+
</TooltipPrimitive.Portal>
|
|
26
|
+
));
|
|
27
|
+
TooltipContent.displayName = "TooltipContent";
|