@re-venue/ui-core-react 0.1.3 → 0.2.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/dist/index.d.ts +409 -0
- package/dist/ui-core-react.css +1 -1
- package/dist/ui-core-react.js +10046 -216
- package/dist/ui-core-react.umd.cjs +47 -1
- package/package.json +26 -1
- package/src/components/AppShell.tsx +3 -0
- package/src/components/common/ConfirmationModal.tsx +65 -0
- package/src/components/common/Container.tsx +15 -0
- package/src/components/common/DangerZoneSection.tsx +62 -0
- package/src/components/common/DetailPanel.tsx +115 -0
- package/src/components/common/DetailSheet.tsx +98 -0
- package/src/components/common/EditableTitle.tsx +119 -0
- package/src/components/common/EmptyState.tsx +36 -0
- package/src/components/common/FormModal.tsx +64 -0
- package/src/components/common/NavigationListItem.tsx +24 -0
- package/src/components/common/PanelEmptyState.tsx +17 -0
- package/src/components/ui/alert-dialog.tsx +104 -0
- package/src/components/ui/avatar.tsx +38 -0
- package/src/components/ui/badge.tsx +31 -0
- package/src/components/ui/button.tsx +47 -0
- package/src/components/ui/card.tsx +43 -0
- package/src/components/ui/checkbox.tsx +26 -0
- package/src/components/ui/dialog.tsx +95 -0
- package/src/components/ui/input.tsx +22 -0
- package/src/components/ui/label.tsx +17 -0
- package/src/components/ui/multi-select.tsx +109 -0
- package/src/components/ui/popover.tsx +29 -0
- package/src/components/ui/progress.tsx +23 -0
- package/src/components/ui/scroll-area.tsx +38 -0
- package/src/components/ui/select.tsx +143 -0
- package/src/components/ui/separator.tsx +20 -0
- package/src/components/ui/sheet.tsx +107 -0
- package/src/components/ui/skeleton.tsx +7 -0
- package/src/components/ui/sonner.tsx +27 -0
- package/src/components/ui/switch.tsx +27 -0
- package/src/components/ui/table.tsx +72 -0
- package/src/components/ui/toast.tsx +111 -0
- package/src/components/ui/toaster.tsx +24 -0
- package/src/components/ui/tooltip.tsx +28 -0
- package/src/components/ui/use-toast.ts +3 -0
- package/src/hooks/use-toast.ts +186 -0
- package/src/hooks/useDetailPanel.ts +21 -0
- package/src/hooks/useDetailSheetControls.ts +16 -0
- package/src/index.ts +48 -0
- package/src/lib/utils.ts +6 -0
- package/src/styles/utilities.css +1 -0
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog";
|
|
3
|
+
|
|
4
|
+
import { cn } from "../../lib/utils";
|
|
5
|
+
import { buttonVariants } from "./button";
|
|
6
|
+
|
|
7
|
+
const AlertDialog = AlertDialogPrimitive.Root;
|
|
8
|
+
|
|
9
|
+
const AlertDialogTrigger = AlertDialogPrimitive.Trigger;
|
|
10
|
+
|
|
11
|
+
const AlertDialogPortal = AlertDialogPrimitive.Portal;
|
|
12
|
+
|
|
13
|
+
const AlertDialogOverlay = React.forwardRef<
|
|
14
|
+
React.ElementRef<typeof AlertDialogPrimitive.Overlay>,
|
|
15
|
+
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Overlay>
|
|
16
|
+
>(({ className, ...props }, ref) => (
|
|
17
|
+
<AlertDialogPrimitive.Overlay
|
|
18
|
+
className={cn(
|
|
19
|
+
"fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
|
20
|
+
className,
|
|
21
|
+
)}
|
|
22
|
+
{...props}
|
|
23
|
+
ref={ref}
|
|
24
|
+
/>
|
|
25
|
+
));
|
|
26
|
+
AlertDialogOverlay.displayName = AlertDialogPrimitive.Overlay.displayName;
|
|
27
|
+
|
|
28
|
+
const AlertDialogContent = React.forwardRef<
|
|
29
|
+
React.ElementRef<typeof AlertDialogPrimitive.Content>,
|
|
30
|
+
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Content>
|
|
31
|
+
>(({ className, ...props }, ref) => (
|
|
32
|
+
<AlertDialogPortal>
|
|
33
|
+
<AlertDialogOverlay />
|
|
34
|
+
<AlertDialogPrimitive.Content
|
|
35
|
+
ref={ref}
|
|
36
|
+
className={cn(
|
|
37
|
+
"fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 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-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
|
|
38
|
+
className,
|
|
39
|
+
)}
|
|
40
|
+
{...props}
|
|
41
|
+
/>
|
|
42
|
+
</AlertDialogPortal>
|
|
43
|
+
));
|
|
44
|
+
AlertDialogContent.displayName = AlertDialogPrimitive.Content.displayName;
|
|
45
|
+
|
|
46
|
+
const AlertDialogHeader = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
|
|
47
|
+
<div className={cn("flex flex-col space-y-2 text-center sm:text-left", className)} {...props} />
|
|
48
|
+
);
|
|
49
|
+
AlertDialogHeader.displayName = "AlertDialogHeader";
|
|
50
|
+
|
|
51
|
+
const AlertDialogFooter = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
|
|
52
|
+
<div className={cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className)} {...props} />
|
|
53
|
+
);
|
|
54
|
+
AlertDialogFooter.displayName = "AlertDialogFooter";
|
|
55
|
+
|
|
56
|
+
const AlertDialogTitle = React.forwardRef<
|
|
57
|
+
React.ElementRef<typeof AlertDialogPrimitive.Title>,
|
|
58
|
+
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Title>
|
|
59
|
+
>(({ className, ...props }, ref) => (
|
|
60
|
+
<AlertDialogPrimitive.Title ref={ref} className={cn("text-lg font-semibold", className)} {...props} />
|
|
61
|
+
));
|
|
62
|
+
AlertDialogTitle.displayName = AlertDialogPrimitive.Title.displayName;
|
|
63
|
+
|
|
64
|
+
const AlertDialogDescription = React.forwardRef<
|
|
65
|
+
React.ElementRef<typeof AlertDialogPrimitive.Description>,
|
|
66
|
+
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Description>
|
|
67
|
+
>(({ className, ...props }, ref) => (
|
|
68
|
+
<AlertDialogPrimitive.Description ref={ref} className={cn("text-sm text-muted-foreground", className)} {...props} />
|
|
69
|
+
));
|
|
70
|
+
AlertDialogDescription.displayName = AlertDialogPrimitive.Description.displayName;
|
|
71
|
+
|
|
72
|
+
const AlertDialogAction = React.forwardRef<
|
|
73
|
+
React.ElementRef<typeof AlertDialogPrimitive.Action>,
|
|
74
|
+
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Action>
|
|
75
|
+
>(({ className, ...props }, ref) => (
|
|
76
|
+
<AlertDialogPrimitive.Action ref={ref} className={cn(buttonVariants(), className)} {...props} />
|
|
77
|
+
));
|
|
78
|
+
AlertDialogAction.displayName = AlertDialogPrimitive.Action.displayName;
|
|
79
|
+
|
|
80
|
+
const AlertDialogCancel = React.forwardRef<
|
|
81
|
+
React.ElementRef<typeof AlertDialogPrimitive.Cancel>,
|
|
82
|
+
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Cancel>
|
|
83
|
+
>(({ className, ...props }, ref) => (
|
|
84
|
+
<AlertDialogPrimitive.Cancel
|
|
85
|
+
ref={ref}
|
|
86
|
+
className={cn(buttonVariants({ variant: "outline" }), "mt-2 sm:mt-0", className)}
|
|
87
|
+
{...props}
|
|
88
|
+
/>
|
|
89
|
+
));
|
|
90
|
+
AlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName;
|
|
91
|
+
|
|
92
|
+
export {
|
|
93
|
+
AlertDialog,
|
|
94
|
+
AlertDialogPortal,
|
|
95
|
+
AlertDialogOverlay,
|
|
96
|
+
AlertDialogTrigger,
|
|
97
|
+
AlertDialogContent,
|
|
98
|
+
AlertDialogHeader,
|
|
99
|
+
AlertDialogFooter,
|
|
100
|
+
AlertDialogTitle,
|
|
101
|
+
AlertDialogDescription,
|
|
102
|
+
AlertDialogAction,
|
|
103
|
+
AlertDialogCancel,
|
|
104
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as AvatarPrimitive from "@radix-ui/react-avatar";
|
|
3
|
+
|
|
4
|
+
import { cn } from "../../lib/utils";
|
|
5
|
+
|
|
6
|
+
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("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full", className)}
|
|
13
|
+
{...props}
|
|
14
|
+
/>
|
|
15
|
+
));
|
|
16
|
+
Avatar.displayName = AvatarPrimitive.Root.displayName;
|
|
17
|
+
|
|
18
|
+
const AvatarImage = React.forwardRef<
|
|
19
|
+
React.ElementRef<typeof AvatarPrimitive.Image>,
|
|
20
|
+
React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Image>
|
|
21
|
+
>(({ className, ...props }, ref) => (
|
|
22
|
+
<AvatarPrimitive.Image ref={ref} className={cn("aspect-square h-full w-full", className)} {...props} />
|
|
23
|
+
));
|
|
24
|
+
AvatarImage.displayName = AvatarPrimitive.Image.displayName;
|
|
25
|
+
|
|
26
|
+
const AvatarFallback = React.forwardRef<
|
|
27
|
+
React.ElementRef<typeof AvatarPrimitive.Fallback>,
|
|
28
|
+
React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Fallback>
|
|
29
|
+
>(({ className, ...props }, ref) => (
|
|
30
|
+
<AvatarPrimitive.Fallback
|
|
31
|
+
ref={ref}
|
|
32
|
+
className={cn("flex h-full w-full items-center justify-center rounded-full bg-muted", className)}
|
|
33
|
+
{...props}
|
|
34
|
+
/>
|
|
35
|
+
));
|
|
36
|
+
AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName;
|
|
37
|
+
|
|
38
|
+
export { Avatar, AvatarImage, AvatarFallback };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { cva, type VariantProps } from "class-variance-authority";
|
|
3
|
+
|
|
4
|
+
import { cn } from "../../lib/utils";
|
|
5
|
+
|
|
6
|
+
const badgeVariants = cva(
|
|
7
|
+
"inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
|
|
8
|
+
{
|
|
9
|
+
variants: {
|
|
10
|
+
variant: {
|
|
11
|
+
default: "border-transparent bg-primary text-primary-foreground hover:bg-primary/80",
|
|
12
|
+
secondary: "border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
13
|
+
destructive: "border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",
|
|
14
|
+
outline: "text-foreground",
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
defaultVariants: {
|
|
18
|
+
variant: "default",
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
export interface BadgeProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof badgeVariants> {}
|
|
24
|
+
|
|
25
|
+
const Badge = React.forwardRef<HTMLDivElement, BadgeProps>(
|
|
26
|
+
({ className, variant, ...props }, ref) => {
|
|
27
|
+
return <div ref={ref} className={cn(badgeVariants({ variant }), className)} {...props} />;
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
export { Badge, badgeVariants };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
3
|
+
import { cva, type VariantProps } from "class-variance-authority";
|
|
4
|
+
|
|
5
|
+
import { cn } from "../../lib/utils";
|
|
6
|
+
|
|
7
|
+
const buttonVariants = cva(
|
|
8
|
+
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-all duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 active:scale-95",
|
|
9
|
+
{
|
|
10
|
+
variants: {
|
|
11
|
+
variant: {
|
|
12
|
+
default: "bg-primary text-primary-foreground hover:bg-primary/90 hover:shadow-md hover:-translate-y-0.5",
|
|
13
|
+
destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90 hover:shadow-md",
|
|
14
|
+
outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground hover:border-primary/50",
|
|
15
|
+
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80 hover:shadow-sm",
|
|
16
|
+
ghost: "hover:bg-accent hover:text-accent-foreground",
|
|
17
|
+
link: "text-primary underline-offset-4 hover:underline",
|
|
18
|
+
},
|
|
19
|
+
size: {
|
|
20
|
+
default: "h-10 px-4 py-2",
|
|
21
|
+
sm: "h-9 rounded-md px-3",
|
|
22
|
+
lg: "h-11 rounded-md px-8",
|
|
23
|
+
icon: "h-10 w-10",
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
defaultVariants: {
|
|
27
|
+
variant: "default",
|
|
28
|
+
size: "default",
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
export interface ButtonProps
|
|
34
|
+
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
|
|
35
|
+
VariantProps<typeof buttonVariants> {
|
|
36
|
+
asChild?: boolean;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
|
40
|
+
({ className, variant, size, asChild = false, ...props }, ref) => {
|
|
41
|
+
const Comp = asChild ? Slot : "button";
|
|
42
|
+
return <Comp className={cn(buttonVariants({ variant, size, className }))} ref={ref} {...props} />;
|
|
43
|
+
},
|
|
44
|
+
);
|
|
45
|
+
Button.displayName = "Button";
|
|
46
|
+
|
|
47
|
+
export { Button, buttonVariants };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
import { cn } from "../../lib/utils";
|
|
4
|
+
|
|
5
|
+
const Card = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(({ className, ...props }, ref) => (
|
|
6
|
+
<div ref={ref} className={cn("rounded-lg border bg-card text-card-foreground shadow-sm transition-all duration-200", className)} {...props} />
|
|
7
|
+
));
|
|
8
|
+
Card.displayName = "Card";
|
|
9
|
+
|
|
10
|
+
const CardHeader = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
|
|
11
|
+
({ className, ...props }, ref) => (
|
|
12
|
+
<div ref={ref} className={cn("flex flex-col space-y-1.5 p-6", className)} {...props} />
|
|
13
|
+
),
|
|
14
|
+
);
|
|
15
|
+
CardHeader.displayName = "CardHeader";
|
|
16
|
+
|
|
17
|
+
const CardTitle = React.forwardRef<HTMLParagraphElement, React.HTMLAttributes<HTMLHeadingElement>>(
|
|
18
|
+
({ className, ...props }, ref) => (
|
|
19
|
+
<h3 ref={ref} className={cn("text-2xl font-semibold leading-none tracking-tight", className)} {...props} />
|
|
20
|
+
),
|
|
21
|
+
);
|
|
22
|
+
CardTitle.displayName = "CardTitle";
|
|
23
|
+
|
|
24
|
+
const CardDescription = React.forwardRef<HTMLParagraphElement, React.HTMLAttributes<HTMLParagraphElement>>(
|
|
25
|
+
({ className, ...props }, ref) => (
|
|
26
|
+
<p ref={ref} className={cn("text-sm text-muted-foreground", className)} {...props} />
|
|
27
|
+
),
|
|
28
|
+
);
|
|
29
|
+
CardDescription.displayName = "CardDescription";
|
|
30
|
+
|
|
31
|
+
const CardContent = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
|
|
32
|
+
({ className, ...props }, ref) => <div ref={ref} className={cn("p-6 pt-0", className)} {...props} />,
|
|
33
|
+
);
|
|
34
|
+
CardContent.displayName = "CardContent";
|
|
35
|
+
|
|
36
|
+
const CardFooter = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
|
|
37
|
+
({ className, ...props }, ref) => (
|
|
38
|
+
<div ref={ref} className={cn("flex items-center p-6 pt-0", className)} {...props} />
|
|
39
|
+
),
|
|
40
|
+
);
|
|
41
|
+
CardFooter.displayName = "CardFooter";
|
|
42
|
+
|
|
43
|
+
export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
|
|
3
|
+
import { Check } from "lucide-react";
|
|
4
|
+
|
|
5
|
+
import { cn } from "../../lib/utils";
|
|
6
|
+
|
|
7
|
+
const Checkbox = React.forwardRef<
|
|
8
|
+
React.ElementRef<typeof CheckboxPrimitive.Root>,
|
|
9
|
+
React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>
|
|
10
|
+
>(({ className, ...props }, ref) => (
|
|
11
|
+
<CheckboxPrimitive.Root
|
|
12
|
+
ref={ref}
|
|
13
|
+
className={cn(
|
|
14
|
+
"peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
|
|
15
|
+
className,
|
|
16
|
+
)}
|
|
17
|
+
{...props}
|
|
18
|
+
>
|
|
19
|
+
<CheckboxPrimitive.Indicator className={cn("flex items-center justify-center text-current")}>
|
|
20
|
+
<Check className="h-4 w-4" />
|
|
21
|
+
</CheckboxPrimitive.Indicator>
|
|
22
|
+
</CheckboxPrimitive.Root>
|
|
23
|
+
));
|
|
24
|
+
Checkbox.displayName = CheckboxPrimitive.Root.displayName;
|
|
25
|
+
|
|
26
|
+
export { Checkbox };
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
3
|
+
import { X } from "lucide-react";
|
|
4
|
+
|
|
5
|
+
import { cn } from "../../lib/utils";
|
|
6
|
+
|
|
7
|
+
const Dialog = DialogPrimitive.Root;
|
|
8
|
+
|
|
9
|
+
const DialogTrigger = DialogPrimitive.Trigger;
|
|
10
|
+
|
|
11
|
+
const DialogPortal = DialogPrimitive.Portal;
|
|
12
|
+
|
|
13
|
+
const DialogClose = DialogPrimitive.Close;
|
|
14
|
+
|
|
15
|
+
const DialogOverlay = React.forwardRef<
|
|
16
|
+
React.ElementRef<typeof DialogPrimitive.Overlay>,
|
|
17
|
+
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>
|
|
18
|
+
>(({ className, ...props }, ref) => (
|
|
19
|
+
<DialogPrimitive.Overlay
|
|
20
|
+
ref={ref}
|
|
21
|
+
className={cn(
|
|
22
|
+
"fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
|
23
|
+
className,
|
|
24
|
+
)}
|
|
25
|
+
{...props}
|
|
26
|
+
/>
|
|
27
|
+
));
|
|
28
|
+
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
|
|
29
|
+
|
|
30
|
+
const DialogContent = React.forwardRef<
|
|
31
|
+
React.ElementRef<typeof DialogPrimitive.Content>,
|
|
32
|
+
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>
|
|
33
|
+
>(({ className, children, ...props }, ref) => (
|
|
34
|
+
<DialogPortal>
|
|
35
|
+
<DialogOverlay />
|
|
36
|
+
<DialogPrimitive.Content
|
|
37
|
+
ref={ref}
|
|
38
|
+
className={cn(
|
|
39
|
+
"fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 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-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
|
|
40
|
+
className,
|
|
41
|
+
)}
|
|
42
|
+
{...props}
|
|
43
|
+
>
|
|
44
|
+
{children}
|
|
45
|
+
<DialogPrimitive.Close className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity data-[state=open]:bg-accent data-[state=open]:text-muted-foreground hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none">
|
|
46
|
+
<X className="h-4 w-4" />
|
|
47
|
+
<span className="sr-only">Close</span>
|
|
48
|
+
</DialogPrimitive.Close>
|
|
49
|
+
</DialogPrimitive.Content>
|
|
50
|
+
</DialogPortal>
|
|
51
|
+
));
|
|
52
|
+
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
53
|
+
|
|
54
|
+
const DialogHeader = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
|
|
55
|
+
<div className={cn("flex flex-col space-y-1.5 text-center sm:text-left", className)} {...props} />
|
|
56
|
+
);
|
|
57
|
+
DialogHeader.displayName = "DialogHeader";
|
|
58
|
+
|
|
59
|
+
const DialogFooter = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
|
|
60
|
+
<div className={cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className)} {...props} />
|
|
61
|
+
);
|
|
62
|
+
DialogFooter.displayName = "DialogFooter";
|
|
63
|
+
|
|
64
|
+
const DialogTitle = React.forwardRef<
|
|
65
|
+
React.ElementRef<typeof DialogPrimitive.Title>,
|
|
66
|
+
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>
|
|
67
|
+
>(({ className, ...props }, ref) => (
|
|
68
|
+
<DialogPrimitive.Title
|
|
69
|
+
ref={ref}
|
|
70
|
+
className={cn("text-lg font-semibold leading-none tracking-tight", className)}
|
|
71
|
+
{...props}
|
|
72
|
+
/>
|
|
73
|
+
));
|
|
74
|
+
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
75
|
+
|
|
76
|
+
const DialogDescription = React.forwardRef<
|
|
77
|
+
React.ElementRef<typeof DialogPrimitive.Description>,
|
|
78
|
+
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>
|
|
79
|
+
>(({ className, ...props }, ref) => (
|
|
80
|
+
<DialogPrimitive.Description ref={ref} className={cn("text-sm text-muted-foreground", className)} {...props} />
|
|
81
|
+
));
|
|
82
|
+
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
83
|
+
|
|
84
|
+
export {
|
|
85
|
+
Dialog,
|
|
86
|
+
DialogPortal,
|
|
87
|
+
DialogOverlay,
|
|
88
|
+
DialogClose,
|
|
89
|
+
DialogTrigger,
|
|
90
|
+
DialogContent,
|
|
91
|
+
DialogHeader,
|
|
92
|
+
DialogFooter,
|
|
93
|
+
DialogTitle,
|
|
94
|
+
DialogDescription,
|
|
95
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
import { cn } from "../../lib/utils";
|
|
4
|
+
|
|
5
|
+
const Input = React.forwardRef<HTMLInputElement, React.ComponentProps<"input">>(
|
|
6
|
+
({ className, type, ...props }, ref) => {
|
|
7
|
+
return (
|
|
8
|
+
<input
|
|
9
|
+
type={type}
|
|
10
|
+
className={cn(
|
|
11
|
+
"flex h-10 w-full rounded-md border border-input bg-white px-3 py-2 text-base ring-offset-background transition-all duration-200 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:border-primary disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
|
12
|
+
className,
|
|
13
|
+
)}
|
|
14
|
+
ref={ref}
|
|
15
|
+
{...props}
|
|
16
|
+
/>
|
|
17
|
+
);
|
|
18
|
+
},
|
|
19
|
+
);
|
|
20
|
+
Input.displayName = "Input";
|
|
21
|
+
|
|
22
|
+
export { Input };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as LabelPrimitive from "@radix-ui/react-label";
|
|
3
|
+
import { cva, type VariantProps } from "class-variance-authority";
|
|
4
|
+
|
|
5
|
+
import { cn } from "../../lib/utils";
|
|
6
|
+
|
|
7
|
+
const labelVariants = cva("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70");
|
|
8
|
+
|
|
9
|
+
const Label = React.forwardRef<
|
|
10
|
+
React.ElementRef<typeof LabelPrimitive.Root>,
|
|
11
|
+
React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root> & VariantProps<typeof labelVariants>
|
|
12
|
+
>(({ className, ...props }, ref) => (
|
|
13
|
+
<LabelPrimitive.Root ref={ref} className={cn(labelVariants(), className)} {...props} />
|
|
14
|
+
));
|
|
15
|
+
Label.displayName = LabelPrimitive.Root.displayName;
|
|
16
|
+
|
|
17
|
+
export { Label };
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { useState } from "react";
|
|
2
|
+
import { ChevronDown, X } from "lucide-react";
|
|
3
|
+
|
|
4
|
+
import { Popover, PopoverContent, PopoverTrigger } from "./popover";
|
|
5
|
+
import { Checkbox } from "./checkbox";
|
|
6
|
+
import { Badge } from "./badge";
|
|
7
|
+
import { cn } from "../../lib/utils";
|
|
8
|
+
|
|
9
|
+
interface MultiSelectOption {
|
|
10
|
+
value: string;
|
|
11
|
+
label: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
interface MultiSelectProps {
|
|
15
|
+
options: MultiSelectOption[];
|
|
16
|
+
value: string[];
|
|
17
|
+
onValueChange: (value: string[]) => void;
|
|
18
|
+
placeholder?: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function MultiSelect({
|
|
22
|
+
options,
|
|
23
|
+
value,
|
|
24
|
+
onValueChange,
|
|
25
|
+
placeholder = "Select options",
|
|
26
|
+
}: MultiSelectProps) {
|
|
27
|
+
const [open, setOpen] = useState(false);
|
|
28
|
+
|
|
29
|
+
const selectedLabels = options.filter((opt) => value.includes(opt.value));
|
|
30
|
+
|
|
31
|
+
const toggleOption = (optionValue: string) => {
|
|
32
|
+
if (value.includes(optionValue)) {
|
|
33
|
+
onValueChange(value.filter((v) => v !== optionValue));
|
|
34
|
+
} else {
|
|
35
|
+
onValueChange([...value, optionValue]);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const removeOption = (optionValue: string, e: React.MouseEvent) => {
|
|
40
|
+
e.stopPropagation();
|
|
41
|
+
onValueChange(value.filter((v) => v !== optionValue));
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<Popover open={open} onOpenChange={setOpen}>
|
|
46
|
+
<PopoverTrigger asChild>
|
|
47
|
+
<button
|
|
48
|
+
type="button"
|
|
49
|
+
className={cn(
|
|
50
|
+
"flex min-h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background transition-all duration-200 hover:border-primary/50 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:border-primary disabled:cursor-not-allowed disabled:opacity-50",
|
|
51
|
+
!selectedLabels.length && "text-muted-foreground",
|
|
52
|
+
)}
|
|
53
|
+
>
|
|
54
|
+
<div className="flex flex-wrap gap-1 flex-1">
|
|
55
|
+
{selectedLabels.length > 0 ? (
|
|
56
|
+
selectedLabels.map((opt) => (
|
|
57
|
+
<Badge
|
|
58
|
+
key={opt.value}
|
|
59
|
+
variant="secondary"
|
|
60
|
+
className="gap-1 pr-1"
|
|
61
|
+
>
|
|
62
|
+
{opt.label}
|
|
63
|
+
<span
|
|
64
|
+
role="button"
|
|
65
|
+
tabIndex={0}
|
|
66
|
+
className="rounded-full hover:bg-muted-foreground/20 p-0.5"
|
|
67
|
+
onClick={(e) => removeOption(opt.value, e)}
|
|
68
|
+
onKeyDown={(e) => {
|
|
69
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
70
|
+
removeOption(opt.value, e as unknown as React.MouseEvent);
|
|
71
|
+
}
|
|
72
|
+
}}
|
|
73
|
+
>
|
|
74
|
+
<X className="h-3 w-3" />
|
|
75
|
+
</span>
|
|
76
|
+
</Badge>
|
|
77
|
+
))
|
|
78
|
+
) : (
|
|
79
|
+
<span>{placeholder}</span>
|
|
80
|
+
)}
|
|
81
|
+
</div>
|
|
82
|
+
<ChevronDown className="h-4 w-4 shrink-0 opacity-50 ml-2" />
|
|
83
|
+
</button>
|
|
84
|
+
</PopoverTrigger>
|
|
85
|
+
<PopoverContent className="max-h-60 overflow-y-auto p-1">
|
|
86
|
+
{options.length === 0 ? (
|
|
87
|
+
<div className="py-4 text-center text-sm text-muted-foreground">
|
|
88
|
+
No options available
|
|
89
|
+
</div>
|
|
90
|
+
) : (
|
|
91
|
+
options.map((option) => {
|
|
92
|
+
const isSelected = value.includes(option.value);
|
|
93
|
+
return (
|
|
94
|
+
<button
|
|
95
|
+
key={option.value}
|
|
96
|
+
type="button"
|
|
97
|
+
className="flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-all duration-150 hover:bg-accent/50 focus:bg-accent focus:text-accent-foreground"
|
|
98
|
+
onClick={() => toggleOption(option.value)}
|
|
99
|
+
>
|
|
100
|
+
<Checkbox checked={isSelected} tabIndex={-1} />
|
|
101
|
+
{option.label}
|
|
102
|
+
</button>
|
|
103
|
+
);
|
|
104
|
+
})
|
|
105
|
+
)}
|
|
106
|
+
</PopoverContent>
|
|
107
|
+
</Popover>
|
|
108
|
+
);
|
|
109
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as PopoverPrimitive from "@radix-ui/react-popover";
|
|
3
|
+
|
|
4
|
+
import { cn } from "../../lib/utils";
|
|
5
|
+
|
|
6
|
+
const Popover = PopoverPrimitive.Root;
|
|
7
|
+
|
|
8
|
+
const PopoverTrigger = PopoverPrimitive.Trigger;
|
|
9
|
+
|
|
10
|
+
const PopoverContent = React.forwardRef<
|
|
11
|
+
React.ElementRef<typeof PopoverPrimitive.Content>,
|
|
12
|
+
React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>
|
|
13
|
+
>(({ className, align = "start", sideOffset = 4, ...props }, ref) => (
|
|
14
|
+
<PopoverPrimitive.Portal>
|
|
15
|
+
<PopoverPrimitive.Content
|
|
16
|
+
ref={ref}
|
|
17
|
+
align={align}
|
|
18
|
+
sideOffset={sideOffset}
|
|
19
|
+
className={cn(
|
|
20
|
+
"z-50 w-[var(--radix-popover-trigger-width)] rounded-md border bg-popover p-1 text-popover-foreground shadow-md outline-none 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",
|
|
21
|
+
className,
|
|
22
|
+
)}
|
|
23
|
+
{...props}
|
|
24
|
+
/>
|
|
25
|
+
</PopoverPrimitive.Portal>
|
|
26
|
+
));
|
|
27
|
+
PopoverContent.displayName = PopoverPrimitive.Content.displayName;
|
|
28
|
+
|
|
29
|
+
export { Popover, PopoverTrigger, PopoverContent };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as ProgressPrimitive from "@radix-ui/react-progress";
|
|
3
|
+
|
|
4
|
+
import { cn } from "../../lib/utils";
|
|
5
|
+
|
|
6
|
+
const Progress = React.forwardRef<
|
|
7
|
+
React.ElementRef<typeof ProgressPrimitive.Root>,
|
|
8
|
+
React.ComponentPropsWithoutRef<typeof ProgressPrimitive.Root>
|
|
9
|
+
>(({ className, value, ...props }, ref) => (
|
|
10
|
+
<ProgressPrimitive.Root
|
|
11
|
+
ref={ref}
|
|
12
|
+
className={cn("relative h-4 w-full overflow-hidden rounded-full bg-secondary", className)}
|
|
13
|
+
{...props}
|
|
14
|
+
>
|
|
15
|
+
<ProgressPrimitive.Indicator
|
|
16
|
+
className="h-full w-full flex-1 bg-primary transition-all"
|
|
17
|
+
style={{ transform: `translateX(-${100 - (value || 0)}%)` }}
|
|
18
|
+
/>
|
|
19
|
+
</ProgressPrimitive.Root>
|
|
20
|
+
));
|
|
21
|
+
Progress.displayName = ProgressPrimitive.Root.displayName;
|
|
22
|
+
|
|
23
|
+
export { Progress };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area";
|
|
3
|
+
|
|
4
|
+
import { cn } from "../../lib/utils";
|
|
5
|
+
|
|
6
|
+
const ScrollArea = React.forwardRef<
|
|
7
|
+
React.ElementRef<typeof ScrollAreaPrimitive.Root>,
|
|
8
|
+
React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.Root>
|
|
9
|
+
>(({ className, children, ...props }, ref) => (
|
|
10
|
+
<ScrollAreaPrimitive.Root ref={ref} className={cn("relative overflow-hidden", className)} {...props}>
|
|
11
|
+
<ScrollAreaPrimitive.Viewport className="h-full w-full rounded-[inherit]">{children}</ScrollAreaPrimitive.Viewport>
|
|
12
|
+
<ScrollBar />
|
|
13
|
+
<ScrollAreaPrimitive.Corner />
|
|
14
|
+
</ScrollAreaPrimitive.Root>
|
|
15
|
+
));
|
|
16
|
+
ScrollArea.displayName = ScrollAreaPrimitive.Root.displayName;
|
|
17
|
+
|
|
18
|
+
const ScrollBar = React.forwardRef<
|
|
19
|
+
React.ElementRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>,
|
|
20
|
+
React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>
|
|
21
|
+
>(({ className, orientation = "vertical", ...props }, ref) => (
|
|
22
|
+
<ScrollAreaPrimitive.ScrollAreaScrollbar
|
|
23
|
+
ref={ref}
|
|
24
|
+
orientation={orientation}
|
|
25
|
+
className={cn(
|
|
26
|
+
"flex touch-none select-none transition-colors",
|
|
27
|
+
orientation === "vertical" && "h-full w-2.5 border-l border-l-transparent p-[1px]",
|
|
28
|
+
orientation === "horizontal" && "h-2.5 flex-col border-t border-t-transparent p-[1px]",
|
|
29
|
+
className,
|
|
30
|
+
)}
|
|
31
|
+
{...props}
|
|
32
|
+
>
|
|
33
|
+
<ScrollAreaPrimitive.ScrollAreaThumb className="relative flex-1 rounded-full bg-border" />
|
|
34
|
+
</ScrollAreaPrimitive.ScrollAreaScrollbar>
|
|
35
|
+
));
|
|
36
|
+
ScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName;
|
|
37
|
+
|
|
38
|
+
export { ScrollArea, ScrollBar };
|