@nexys/user-management-web 0.0.26
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 +91 -0
- package/src/components/audit/audit-log-table.tsx +226 -0
- package/src/components/auth/accept-invitation-card.tsx +100 -0
- package/src/components/auth/forgot-password-form.tsx +92 -0
- package/src/components/auth/reset-password-form.tsx +143 -0
- package/src/components/auth/sign-in-form.test.tsx +140 -0
- package/src/components/auth/sign-in-form.tsx +509 -0
- package/src/components/auth/sign-up-form.tsx +123 -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 +235 -0
- package/src/components/profile/change-password-form.tsx +158 -0
- package/src/components/profile/passkeys-card.tsx +180 -0
- package/src/components/profile/profile-card.tsx +33 -0
- package/src/components/profile/two-factor-card.tsx +226 -0
- package/src/components/projects/project-consents.tsx +572 -0
- package/src/components/projects/project-create-dialog.tsx +209 -0
- package/src/components/projects/project-detail-tabs.tsx +63 -0
- package/src/components/projects/project-email-templates.tsx +282 -0
- package/src/components/projects/project-notices.tsx +458 -0
- package/src/components/projects/project-settings.tsx +1133 -0
- package/src/components/projects/project-tenants.tsx +107 -0
- package/src/components/projects/projects-table.test.tsx +95 -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 +163 -0
- package/src/components/tenants/tenant-detail-tabs.tsx +51 -0
- package/src/components/tenants/tenant-members.tsx +578 -0
- package/src/components/tenants/tenant-roles.test.tsx +91 -0
- package/src/components/tenants/tenant-roles.tsx +414 -0
- package/src/components/tenants/tenant-settings.tsx +385 -0
- package/src/components/tenants/tenants-table.test.tsx +71 -0
- package/src/components/tenants/tenants-table.tsx +245 -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 +267 -0
- package/src/components/users/user-delete-dialog.tsx +88 -0
- package/src/components/users/user-detail.tsx +843 -0
- package/src/components/users/users-table.test.tsx +97 -0
- package/src/components/users/users-table.tsx +382 -0
- package/src/context/auth-context.tsx +124 -0
- package/src/context/theme-context.test.tsx +78 -0
- package/src/context/theme-context.tsx +110 -0
- package/src/hooks/use-call.ts +64 -0
- package/src/index.ts +159 -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,52 @@
|
|
|
1
|
+
import { cva, type VariantProps } from "class-variance-authority";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
|
|
4
|
+
import { cn } from "../../lib/utils.js";
|
|
5
|
+
|
|
6
|
+
const alertVariants = cva(
|
|
7
|
+
"relative w-full rounded-lg border px-4 py-3 text-sm grid grid-cols-[16px_1fr] gap-x-3 gap-y-1 [&>svg]:size-4 [&>svg]:translate-y-0.5",
|
|
8
|
+
{
|
|
9
|
+
variants: {
|
|
10
|
+
variant: {
|
|
11
|
+
default: "bg-background text-foreground border-border",
|
|
12
|
+
destructive:
|
|
13
|
+
"border-destructive/40 bg-destructive/10 text-destructive [&>svg]:text-destructive",
|
|
14
|
+
warning:
|
|
15
|
+
"border-warning/40 bg-warning/10 text-warning-foreground [&>svg]:text-warning",
|
|
16
|
+
success:
|
|
17
|
+
"border-success/40 bg-success/10 text-success-foreground [&>svg]:text-success",
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
defaultVariants: { variant: "default" },
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
export interface AlertProps
|
|
25
|
+
extends React.HTMLAttributes<HTMLDivElement>,
|
|
26
|
+
VariantProps<typeof alertVariants> {}
|
|
27
|
+
|
|
28
|
+
export const Alert = React.forwardRef<HTMLDivElement, AlertProps>(
|
|
29
|
+
({ className, variant, ...props }, ref) => (
|
|
30
|
+
<div
|
|
31
|
+
ref={ref}
|
|
32
|
+
role="alert"
|
|
33
|
+
className={cn(alertVariants({ variant }), className)}
|
|
34
|
+
{...props}
|
|
35
|
+
/>
|
|
36
|
+
)
|
|
37
|
+
);
|
|
38
|
+
Alert.displayName = "Alert";
|
|
39
|
+
|
|
40
|
+
export const AlertTitle = ({ className, ...props }: React.HTMLAttributes<HTMLHeadingElement>) => (
|
|
41
|
+
<h5
|
|
42
|
+
className={cn("col-start-2 font-medium leading-tight", className)}
|
|
43
|
+
{...props}
|
|
44
|
+
/>
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
export const AlertDescription = ({
|
|
48
|
+
className,
|
|
49
|
+
...props
|
|
50
|
+
}: React.HTMLAttributes<HTMLDivElement>) => (
|
|
51
|
+
<div className={cn("col-start-2 text-sm opacity-90", className)} {...props} />
|
|
52
|
+
);
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import * as AvatarPrimitive from "@radix-ui/react-avatar";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
|
|
4
|
+
import { cn } from "../../lib/utils.js";
|
|
5
|
+
|
|
6
|
+
export const Avatar = React.forwardRef<
|
|
7
|
+
React.ElementRef<typeof AvatarPrimitive.Root>,
|
|
8
|
+
React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Root>
|
|
9
|
+
>(({ className, ...props }, ref) => (
|
|
10
|
+
<AvatarPrimitive.Root
|
|
11
|
+
ref={ref}
|
|
12
|
+
className={cn(
|
|
13
|
+
"relative flex size-9 shrink-0 overflow-hidden rounded-full",
|
|
14
|
+
className
|
|
15
|
+
)}
|
|
16
|
+
{...props}
|
|
17
|
+
/>
|
|
18
|
+
));
|
|
19
|
+
Avatar.displayName = "Avatar";
|
|
20
|
+
|
|
21
|
+
export const AvatarImage = React.forwardRef<
|
|
22
|
+
React.ElementRef<typeof AvatarPrimitive.Image>,
|
|
23
|
+
React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Image>
|
|
24
|
+
>(({ className, ...props }, ref) => (
|
|
25
|
+
<AvatarPrimitive.Image
|
|
26
|
+
ref={ref}
|
|
27
|
+
className={cn("aspect-square h-full w-full", className)}
|
|
28
|
+
{...props}
|
|
29
|
+
/>
|
|
30
|
+
));
|
|
31
|
+
AvatarImage.displayName = "AvatarImage";
|
|
32
|
+
|
|
33
|
+
export const AvatarFallback = React.forwardRef<
|
|
34
|
+
React.ElementRef<typeof AvatarPrimitive.Fallback>,
|
|
35
|
+
React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Fallback>
|
|
36
|
+
>(({ className, ...props }, ref) => (
|
|
37
|
+
<AvatarPrimitive.Fallback
|
|
38
|
+
ref={ref}
|
|
39
|
+
className={cn(
|
|
40
|
+
"flex h-full w-full items-center justify-center rounded-full bg-muted text-xs font-medium uppercase text-muted-foreground",
|
|
41
|
+
className
|
|
42
|
+
)}
|
|
43
|
+
{...props}
|
|
44
|
+
/>
|
|
45
|
+
));
|
|
46
|
+
AvatarFallback.displayName = "AvatarFallback";
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { cva, type VariantProps } from "class-variance-authority";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
|
|
4
|
+
import { cn } from "../../lib/utils.js";
|
|
5
|
+
|
|
6
|
+
const badgeVariants = cva(
|
|
7
|
+
"inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-xs font-medium transition-colors focus:outline-none focus:ring-2 focus:ring-ring/40 focus:ring-offset-2",
|
|
8
|
+
{
|
|
9
|
+
variants: {
|
|
10
|
+
variant: {
|
|
11
|
+
default: "border-transparent bg-primary text-primary-foreground",
|
|
12
|
+
secondary: "border-transparent bg-secondary text-secondary-foreground",
|
|
13
|
+
destructive: "border-transparent bg-destructive text-destructive-foreground",
|
|
14
|
+
outline: "text-foreground",
|
|
15
|
+
success: "border-transparent bg-success text-success-foreground",
|
|
16
|
+
warning: "border-transparent bg-warning text-warning-foreground",
|
|
17
|
+
muted: "border-transparent bg-muted text-muted-foreground",
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
defaultVariants: { variant: "default" },
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
export interface BadgeProps
|
|
25
|
+
extends React.HTMLAttributes<HTMLSpanElement>,
|
|
26
|
+
VariantProps<typeof badgeVariants> {}
|
|
27
|
+
|
|
28
|
+
export const Badge = ({ className, variant, ...props }: BadgeProps) => (
|
|
29
|
+
<span className={cn(badgeVariants({ variant }), className)} {...props} />
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
export { badgeVariants };
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
2
|
+
import { cva, type VariantProps } from "class-variance-authority";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
|
|
5
|
+
import { cn } from "../../lib/utils.js";
|
|
6
|
+
|
|
7
|
+
const buttonVariants = cva(
|
|
8
|
+
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:ring-2 focus-visible:ring-ring/40 focus-visible:ring-offset-2 focus-visible:ring-offset-background",
|
|
9
|
+
{
|
|
10
|
+
variants: {
|
|
11
|
+
variant: {
|
|
12
|
+
default: "bg-primary text-primary-foreground shadow-sm hover:bg-primary/90",
|
|
13
|
+
destructive:
|
|
14
|
+
"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",
|
|
15
|
+
outline:
|
|
16
|
+
"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",
|
|
17
|
+
secondary:
|
|
18
|
+
"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",
|
|
19
|
+
ghost: "hover:bg-accent hover:text-accent-foreground",
|
|
20
|
+
link: "text-primary underline-offset-4 hover:underline",
|
|
21
|
+
},
|
|
22
|
+
size: {
|
|
23
|
+
default: "h-9 px-4 py-2 has-[>svg]:px-3",
|
|
24
|
+
sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
|
|
25
|
+
lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
|
|
26
|
+
icon: "size-9",
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
defaultVariants: { variant: "default", size: "default" },
|
|
30
|
+
}
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
export interface ButtonProps
|
|
34
|
+
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
|
|
35
|
+
VariantProps<typeof buttonVariants> {
|
|
36
|
+
asChild?: boolean;
|
|
37
|
+
loading?: boolean;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
|
41
|
+
({ className, variant, size, asChild, loading, disabled, children, ...props }, ref) => {
|
|
42
|
+
const Comp = asChild ? Slot : "button";
|
|
43
|
+
return (
|
|
44
|
+
<Comp
|
|
45
|
+
ref={ref}
|
|
46
|
+
className={cn(buttonVariants({ variant, size }), className)}
|
|
47
|
+
disabled={disabled || loading}
|
|
48
|
+
data-loading={loading || undefined}
|
|
49
|
+
{...props}
|
|
50
|
+
>
|
|
51
|
+
{loading ? (
|
|
52
|
+
<span
|
|
53
|
+
className="size-4 animate-spin rounded-full border-2 border-current border-r-transparent"
|
|
54
|
+
aria-hidden
|
|
55
|
+
/>
|
|
56
|
+
) : null}
|
|
57
|
+
{children}
|
|
58
|
+
</Comp>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
);
|
|
62
|
+
Button.displayName = "Button";
|
|
63
|
+
|
|
64
|
+
export { buttonVariants };
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
import { cn } from "../../lib/utils.js";
|
|
4
|
+
|
|
5
|
+
export const Card = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
|
|
6
|
+
({ className, ...props }, ref) => (
|
|
7
|
+
<div
|
|
8
|
+
ref={ref}
|
|
9
|
+
className={cn(
|
|
10
|
+
"rounded-xl border bg-card text-card-foreground shadow-sm",
|
|
11
|
+
className
|
|
12
|
+
)}
|
|
13
|
+
{...props}
|
|
14
|
+
/>
|
|
15
|
+
)
|
|
16
|
+
);
|
|
17
|
+
Card.displayName = "Card";
|
|
18
|
+
|
|
19
|
+
export const CardHeader = React.forwardRef<
|
|
20
|
+
HTMLDivElement,
|
|
21
|
+
React.HTMLAttributes<HTMLDivElement>
|
|
22
|
+
>(({ className, ...props }, ref) => (
|
|
23
|
+
<div ref={ref} className={cn("flex flex-col space-y-1.5 p-6", className)} {...props} />
|
|
24
|
+
));
|
|
25
|
+
CardHeader.displayName = "CardHeader";
|
|
26
|
+
|
|
27
|
+
export const CardTitle = React.forwardRef<
|
|
28
|
+
HTMLHeadingElement,
|
|
29
|
+
React.HTMLAttributes<HTMLHeadingElement>
|
|
30
|
+
>(({ className, ...props }, ref) => (
|
|
31
|
+
<h3
|
|
32
|
+
ref={ref}
|
|
33
|
+
className={cn("text-lg font-semibold leading-none tracking-tight", className)}
|
|
34
|
+
{...props}
|
|
35
|
+
/>
|
|
36
|
+
));
|
|
37
|
+
CardTitle.displayName = "CardTitle";
|
|
38
|
+
|
|
39
|
+
export const CardDescription = React.forwardRef<
|
|
40
|
+
HTMLParagraphElement,
|
|
41
|
+
React.HTMLAttributes<HTMLParagraphElement>
|
|
42
|
+
>(({ className, ...props }, ref) => (
|
|
43
|
+
<p ref={ref} className={cn("text-sm text-muted-foreground", className)} {...props} />
|
|
44
|
+
));
|
|
45
|
+
CardDescription.displayName = "CardDescription";
|
|
46
|
+
|
|
47
|
+
export const CardContent = React.forwardRef<
|
|
48
|
+
HTMLDivElement,
|
|
49
|
+
React.HTMLAttributes<HTMLDivElement>
|
|
50
|
+
>(({ className, ...props }, ref) => (
|
|
51
|
+
<div ref={ref} className={cn("p-6 pt-0", className)} {...props} />
|
|
52
|
+
));
|
|
53
|
+
CardContent.displayName = "CardContent";
|
|
54
|
+
|
|
55
|
+
export const CardFooter = React.forwardRef<
|
|
56
|
+
HTMLDivElement,
|
|
57
|
+
React.HTMLAttributes<HTMLDivElement>
|
|
58
|
+
>(({ className, ...props }, ref) => (
|
|
59
|
+
<div
|
|
60
|
+
ref={ref}
|
|
61
|
+
className={cn("flex items-center p-6 pt-0", className)}
|
|
62
|
+
{...props}
|
|
63
|
+
/>
|
|
64
|
+
));
|
|
65
|
+
CardFooter.displayName = "CardFooter";
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
2
|
+
import { X } from "lucide-react";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
|
|
5
|
+
import { cn } from "../../lib/utils.js";
|
|
6
|
+
|
|
7
|
+
export const Dialog = DialogPrimitive.Root;
|
|
8
|
+
export const DialogTrigger = DialogPrimitive.Trigger;
|
|
9
|
+
export const DialogPortal = DialogPrimitive.Portal;
|
|
10
|
+
export const DialogClose = DialogPrimitive.Close;
|
|
11
|
+
|
|
12
|
+
export const DialogOverlay = React.forwardRef<
|
|
13
|
+
React.ElementRef<typeof DialogPrimitive.Overlay>,
|
|
14
|
+
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>
|
|
15
|
+
>(({ className, ...props }, ref) => (
|
|
16
|
+
<DialogPrimitive.Overlay
|
|
17
|
+
ref={ref}
|
|
18
|
+
className={cn(
|
|
19
|
+
"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm",
|
|
20
|
+
"data-[state=open]:animate-in data-[state=closed]:animate-out",
|
|
21
|
+
"data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
|
22
|
+
className
|
|
23
|
+
)}
|
|
24
|
+
{...props}
|
|
25
|
+
/>
|
|
26
|
+
));
|
|
27
|
+
DialogOverlay.displayName = "DialogOverlay";
|
|
28
|
+
|
|
29
|
+
export const DialogContent = React.forwardRef<
|
|
30
|
+
React.ElementRef<typeof DialogPrimitive.Content>,
|
|
31
|
+
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>
|
|
32
|
+
>(({ className, children, ...props }, ref) => (
|
|
33
|
+
<DialogPortal>
|
|
34
|
+
<DialogOverlay />
|
|
35
|
+
<DialogPrimitive.Content
|
|
36
|
+
ref={ref}
|
|
37
|
+
className={cn(
|
|
38
|
+
"fixed left-1/2 top-1/2 z-50 grid w-full max-w-lg -translate-x-1/2 -translate-y-1/2 gap-4",
|
|
39
|
+
"border bg-background p-6 shadow-xl sm:rounded-xl",
|
|
40
|
+
"data-[state=open]:animate-in data-[state=closed]:animate-out",
|
|
41
|
+
"data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
|
42
|
+
"data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95",
|
|
43
|
+
className
|
|
44
|
+
)}
|
|
45
|
+
{...props}
|
|
46
|
+
>
|
|
47
|
+
{children}
|
|
48
|
+
<DialogPrimitive.Close className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none">
|
|
49
|
+
<X className="size-4" />
|
|
50
|
+
<span className="sr-only">Close</span>
|
|
51
|
+
</DialogPrimitive.Close>
|
|
52
|
+
</DialogPrimitive.Content>
|
|
53
|
+
</DialogPortal>
|
|
54
|
+
));
|
|
55
|
+
DialogContent.displayName = "DialogContent";
|
|
56
|
+
|
|
57
|
+
export const DialogHeader = ({
|
|
58
|
+
className,
|
|
59
|
+
...props
|
|
60
|
+
}: React.HTMLAttributes<HTMLDivElement>) => (
|
|
61
|
+
<div
|
|
62
|
+
className={cn("flex flex-col gap-1.5 text-left", className)}
|
|
63
|
+
{...props}
|
|
64
|
+
/>
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
export const DialogFooter = ({
|
|
68
|
+
className,
|
|
69
|
+
...props
|
|
70
|
+
}: React.HTMLAttributes<HTMLDivElement>) => (
|
|
71
|
+
<div
|
|
72
|
+
className={cn("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end", className)}
|
|
73
|
+
{...props}
|
|
74
|
+
/>
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
export const DialogTitle = React.forwardRef<
|
|
78
|
+
React.ElementRef<typeof DialogPrimitive.Title>,
|
|
79
|
+
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>
|
|
80
|
+
>(({ className, ...props }, ref) => (
|
|
81
|
+
<DialogPrimitive.Title
|
|
82
|
+
ref={ref}
|
|
83
|
+
className={cn("text-lg font-semibold leading-none tracking-tight", className)}
|
|
84
|
+
{...props}
|
|
85
|
+
/>
|
|
86
|
+
));
|
|
87
|
+
DialogTitle.displayName = "DialogTitle";
|
|
88
|
+
|
|
89
|
+
export const DialogDescription = React.forwardRef<
|
|
90
|
+
React.ElementRef<typeof DialogPrimitive.Description>,
|
|
91
|
+
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>
|
|
92
|
+
>(({ className, ...props }, ref) => (
|
|
93
|
+
<DialogPrimitive.Description
|
|
94
|
+
ref={ref}
|
|
95
|
+
className={cn("text-sm text-muted-foreground", className)}
|
|
96
|
+
{...props}
|
|
97
|
+
/>
|
|
98
|
+
));
|
|
99
|
+
DialogDescription.displayName = "DialogDescription";
|
|
@@ -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
|
+
);
|