@c-rex/ui 0.1.19 → 0.1.21
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 +19 -19
- package/package.json +207 -205
- package/src/alert.tsx +58 -58
- package/src/avatar.tsx +47 -47
- package/src/badge.tsx +46 -46
- package/src/breadcrumb.tsx +113 -113
- package/src/button.tsx +69 -69
- package/src/card.tsx +92 -92
- package/src/checkbox.tsx +30 -30
- package/src/collapsible.tsx +31 -31
- package/src/command.tsx +151 -151
- package/src/context-menu.tsx +250 -250
- package/src/dialog.tsx +122 -122
- package/src/drawer.tsx +133 -133
- package/src/dropdown-hover-item.tsx +27 -27
- package/src/dropdown-menu.tsx +273 -273
- package/src/hooks/index.tsx +27 -27
- package/src/input-group.tsx +189 -189
- package/src/input.tsx +42 -42
- package/src/label.tsx +22 -22
- package/src/navigation-menu.tsx +169 -168
- package/src/pagination.tsx +124 -124
- package/src/popover.tsx +31 -31
- package/src/radio-group.tsx +43 -43
- package/src/select.tsx +157 -157
- package/src/separator.tsx +29 -29
- package/src/sheet.tsx +140 -140
- package/src/sidebar.tsx +833 -835
- package/src/skeleton.tsx +15 -15
- package/src/sonner.tsx +10 -10
- package/src/switch.tsx +29 -29
- package/src/table.tsx +120 -120
- package/src/tabs.tsx +64 -64
- package/src/textarea.tsx +18 -18
- package/src/toggle-group.tsx +71 -71
- package/src/toggle.tsx +47 -47
- package/src/tooltip.tsx +30 -30
package/src/dialog.tsx
CHANGED
|
@@ -1,122 +1,122 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import * as React from "react";
|
|
4
|
-
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
5
|
-
import { X } from "lucide-react";
|
|
6
|
-
|
|
7
|
-
import { cn } from "@c-rex/utils";
|
|
8
|
-
|
|
9
|
-
const Dialog = DialogPrimitive.Root;
|
|
10
|
-
|
|
11
|
-
const DialogTrigger = DialogPrimitive.Trigger;
|
|
12
|
-
|
|
13
|
-
const DialogPortal = DialogPrimitive.Portal;
|
|
14
|
-
|
|
15
|
-
const DialogClose = DialogPrimitive.Close;
|
|
16
|
-
|
|
17
|
-
const DialogOverlay = React.forwardRef<
|
|
18
|
-
React.ElementRef<typeof DialogPrimitive.Overlay>,
|
|
19
|
-
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>
|
|
20
|
-
>(({ className, ...props }, ref) => (
|
|
21
|
-
<DialogPrimitive.Overlay
|
|
22
|
-
ref={ref}
|
|
23
|
-
className={cn(
|
|
24
|
-
"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",
|
|
25
|
-
className,
|
|
26
|
-
)}
|
|
27
|
-
{...props}
|
|
28
|
-
/>
|
|
29
|
-
));
|
|
30
|
-
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
|
|
31
|
-
|
|
32
|
-
const DialogContent = React.forwardRef<
|
|
33
|
-
React.ElementRef<typeof DialogPrimitive.Content>,
|
|
34
|
-
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>
|
|
35
|
-
>(({ className, children, ...props }, ref) => (
|
|
36
|
-
<DialogPortal>
|
|
37
|
-
<DialogOverlay />
|
|
38
|
-
<DialogPrimitive.Content
|
|
39
|
-
ref={ref}
|
|
40
|
-
className={cn(
|
|
41
|
-
"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",
|
|
42
|
-
className,
|
|
43
|
-
)}
|
|
44
|
-
{...props}
|
|
45
|
-
>
|
|
46
|
-
{children}
|
|
47
|
-
<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 data-[state=open]:bg-accent data-[state=open]:text-muted-foreground">
|
|
48
|
-
<X className="h-4 w-4" />
|
|
49
|
-
<span className="sr-only">Close</span>
|
|
50
|
-
</DialogPrimitive.Close>
|
|
51
|
-
</DialogPrimitive.Content>
|
|
52
|
-
</DialogPortal>
|
|
53
|
-
));
|
|
54
|
-
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
55
|
-
|
|
56
|
-
const DialogHeader = ({
|
|
57
|
-
className,
|
|
58
|
-
...props
|
|
59
|
-
}: React.HTMLAttributes<HTMLDivElement>) => (
|
|
60
|
-
<div
|
|
61
|
-
className={cn(
|
|
62
|
-
"flex flex-col space-y-1.5 text-center sm:text-left",
|
|
63
|
-
className,
|
|
64
|
-
)}
|
|
65
|
-
{...props}
|
|
66
|
-
/>
|
|
67
|
-
);
|
|
68
|
-
DialogHeader.displayName = "DialogHeader";
|
|
69
|
-
|
|
70
|
-
const DialogFooter = ({
|
|
71
|
-
className,
|
|
72
|
-
...props
|
|
73
|
-
}: React.HTMLAttributes<HTMLDivElement>) => (
|
|
74
|
-
<div
|
|
75
|
-
className={cn(
|
|
76
|
-
"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
|
|
77
|
-
className,
|
|
78
|
-
)}
|
|
79
|
-
{...props}
|
|
80
|
-
/>
|
|
81
|
-
);
|
|
82
|
-
DialogFooter.displayName = "DialogFooter";
|
|
83
|
-
|
|
84
|
-
const DialogTitle = React.forwardRef<
|
|
85
|
-
React.ElementRef<typeof DialogPrimitive.Title>,
|
|
86
|
-
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>
|
|
87
|
-
>(({ className, ...props }, ref) => (
|
|
88
|
-
<DialogPrimitive.Title
|
|
89
|
-
ref={ref}
|
|
90
|
-
className={cn(
|
|
91
|
-
"text-lg font-semibold leading-none tracking-tight",
|
|
92
|
-
className,
|
|
93
|
-
)}
|
|
94
|
-
{...props}
|
|
95
|
-
/>
|
|
96
|
-
));
|
|
97
|
-
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
98
|
-
|
|
99
|
-
const DialogDescription = React.forwardRef<
|
|
100
|
-
React.ElementRef<typeof DialogPrimitive.Description>,
|
|
101
|
-
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>
|
|
102
|
-
>(({ className, ...props }, ref) => (
|
|
103
|
-
<DialogPrimitive.Description
|
|
104
|
-
ref={ref}
|
|
105
|
-
className={cn("text-sm text-muted-foreground", className)}
|
|
106
|
-
{...props}
|
|
107
|
-
/>
|
|
108
|
-
));
|
|
109
|
-
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
110
|
-
|
|
111
|
-
export {
|
|
112
|
-
Dialog,
|
|
113
|
-
DialogPortal,
|
|
114
|
-
DialogOverlay,
|
|
115
|
-
DialogTrigger,
|
|
116
|
-
DialogClose,
|
|
117
|
-
DialogContent,
|
|
118
|
-
DialogHeader,
|
|
119
|
-
DialogFooter,
|
|
120
|
-
DialogTitle,
|
|
121
|
-
DialogDescription,
|
|
122
|
-
};
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
5
|
+
import { X } from "lucide-react";
|
|
6
|
+
|
|
7
|
+
import { cn } from "@c-rex/utils";
|
|
8
|
+
|
|
9
|
+
const Dialog = DialogPrimitive.Root;
|
|
10
|
+
|
|
11
|
+
const DialogTrigger = DialogPrimitive.Trigger;
|
|
12
|
+
|
|
13
|
+
const DialogPortal = DialogPrimitive.Portal;
|
|
14
|
+
|
|
15
|
+
const DialogClose = DialogPrimitive.Close;
|
|
16
|
+
|
|
17
|
+
const DialogOverlay = React.forwardRef<
|
|
18
|
+
React.ElementRef<typeof DialogPrimitive.Overlay>,
|
|
19
|
+
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>
|
|
20
|
+
>(({ className, ...props }, ref) => (
|
|
21
|
+
<DialogPrimitive.Overlay
|
|
22
|
+
ref={ref}
|
|
23
|
+
className={cn(
|
|
24
|
+
"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",
|
|
25
|
+
className,
|
|
26
|
+
)}
|
|
27
|
+
{...props}
|
|
28
|
+
/>
|
|
29
|
+
));
|
|
30
|
+
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
|
|
31
|
+
|
|
32
|
+
const DialogContent = React.forwardRef<
|
|
33
|
+
React.ElementRef<typeof DialogPrimitive.Content>,
|
|
34
|
+
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>
|
|
35
|
+
>(({ className, children, ...props }, ref) => (
|
|
36
|
+
<DialogPortal>
|
|
37
|
+
<DialogOverlay />
|
|
38
|
+
<DialogPrimitive.Content
|
|
39
|
+
ref={ref}
|
|
40
|
+
className={cn(
|
|
41
|
+
"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",
|
|
42
|
+
className,
|
|
43
|
+
)}
|
|
44
|
+
{...props}
|
|
45
|
+
>
|
|
46
|
+
{children}
|
|
47
|
+
<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 data-[state=open]:bg-accent data-[state=open]:text-muted-foreground">
|
|
48
|
+
<X className="h-4 w-4" />
|
|
49
|
+
<span className="sr-only">Close</span>
|
|
50
|
+
</DialogPrimitive.Close>
|
|
51
|
+
</DialogPrimitive.Content>
|
|
52
|
+
</DialogPortal>
|
|
53
|
+
));
|
|
54
|
+
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
55
|
+
|
|
56
|
+
const DialogHeader = ({
|
|
57
|
+
className,
|
|
58
|
+
...props
|
|
59
|
+
}: React.HTMLAttributes<HTMLDivElement>) => (
|
|
60
|
+
<div
|
|
61
|
+
className={cn(
|
|
62
|
+
"flex flex-col space-y-1.5 text-center sm:text-left",
|
|
63
|
+
className,
|
|
64
|
+
)}
|
|
65
|
+
{...props}
|
|
66
|
+
/>
|
|
67
|
+
);
|
|
68
|
+
DialogHeader.displayName = "DialogHeader";
|
|
69
|
+
|
|
70
|
+
const DialogFooter = ({
|
|
71
|
+
className,
|
|
72
|
+
...props
|
|
73
|
+
}: React.HTMLAttributes<HTMLDivElement>) => (
|
|
74
|
+
<div
|
|
75
|
+
className={cn(
|
|
76
|
+
"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
|
|
77
|
+
className,
|
|
78
|
+
)}
|
|
79
|
+
{...props}
|
|
80
|
+
/>
|
|
81
|
+
);
|
|
82
|
+
DialogFooter.displayName = "DialogFooter";
|
|
83
|
+
|
|
84
|
+
const DialogTitle = React.forwardRef<
|
|
85
|
+
React.ElementRef<typeof DialogPrimitive.Title>,
|
|
86
|
+
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>
|
|
87
|
+
>(({ className, ...props }, ref) => (
|
|
88
|
+
<DialogPrimitive.Title
|
|
89
|
+
ref={ref}
|
|
90
|
+
className={cn(
|
|
91
|
+
"text-lg font-semibold leading-none tracking-tight",
|
|
92
|
+
className,
|
|
93
|
+
)}
|
|
94
|
+
{...props}
|
|
95
|
+
/>
|
|
96
|
+
));
|
|
97
|
+
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
98
|
+
|
|
99
|
+
const DialogDescription = React.forwardRef<
|
|
100
|
+
React.ElementRef<typeof DialogPrimitive.Description>,
|
|
101
|
+
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>
|
|
102
|
+
>(({ className, ...props }, ref) => (
|
|
103
|
+
<DialogPrimitive.Description
|
|
104
|
+
ref={ref}
|
|
105
|
+
className={cn("text-sm text-muted-foreground", className)}
|
|
106
|
+
{...props}
|
|
107
|
+
/>
|
|
108
|
+
));
|
|
109
|
+
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
110
|
+
|
|
111
|
+
export {
|
|
112
|
+
Dialog,
|
|
113
|
+
DialogPortal,
|
|
114
|
+
DialogOverlay,
|
|
115
|
+
DialogTrigger,
|
|
116
|
+
DialogClose,
|
|
117
|
+
DialogContent,
|
|
118
|
+
DialogHeader,
|
|
119
|
+
DialogFooter,
|
|
120
|
+
DialogTitle,
|
|
121
|
+
DialogDescription,
|
|
122
|
+
};
|
package/src/drawer.tsx
CHANGED
|
@@ -1,133 +1,133 @@
|
|
|
1
|
-
import * as React from "react"
|
|
2
|
-
import { Drawer as DrawerPrimitive } from "vaul"
|
|
3
|
-
|
|
4
|
-
import { cn } from "@c-rex/utils"
|
|
5
|
-
|
|
6
|
-
function Drawer({
|
|
7
|
-
...props
|
|
8
|
-
}: React.ComponentProps<typeof DrawerPrimitive.Root>) {
|
|
9
|
-
return <DrawerPrimitive.Root data-slot="drawer" {...props} />
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
function DrawerTrigger({
|
|
13
|
-
...props
|
|
14
|
-
}: React.ComponentProps<typeof DrawerPrimitive.Trigger>) {
|
|
15
|
-
return <DrawerPrimitive.Trigger data-slot="drawer-trigger" {...props} />
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
function DrawerPortal({
|
|
19
|
-
...props
|
|
20
|
-
}: React.ComponentProps<typeof DrawerPrimitive.Portal>) {
|
|
21
|
-
return <DrawerPrimitive.Portal data-slot="drawer-portal" {...props} />
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
function DrawerClose({
|
|
25
|
-
...props
|
|
26
|
-
}: React.ComponentProps<typeof DrawerPrimitive.Close>) {
|
|
27
|
-
return <DrawerPrimitive.Close data-slot="drawer-close" {...props} />
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function DrawerOverlay({
|
|
31
|
-
className,
|
|
32
|
-
...props
|
|
33
|
-
}: React.ComponentProps<typeof DrawerPrimitive.Overlay>) {
|
|
34
|
-
return (
|
|
35
|
-
<DrawerPrimitive.Overlay
|
|
36
|
-
data-slot="drawer-overlay"
|
|
37
|
-
className={cn(
|
|
38
|
-
"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",
|
|
39
|
-
className
|
|
40
|
-
)}
|
|
41
|
-
{...props}
|
|
42
|
-
/>
|
|
43
|
-
)
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
function DrawerContent({
|
|
47
|
-
className,
|
|
48
|
-
children,
|
|
49
|
-
...props
|
|
50
|
-
}: React.ComponentProps<typeof DrawerPrimitive.Content>) {
|
|
51
|
-
return (
|
|
52
|
-
<DrawerPortal data-slot="drawer-portal">
|
|
53
|
-
<DrawerOverlay />
|
|
54
|
-
<DrawerPrimitive.Content
|
|
55
|
-
data-slot="drawer-content"
|
|
56
|
-
className={cn(
|
|
57
|
-
"group/drawer-content bg-background fixed z-50 flex h-auto flex-col",
|
|
58
|
-
"data-[vaul-drawer-direction=top]:inset-x-0 data-[vaul-drawer-direction=top]:top-0 data-[vaul-drawer-direction=top]:mb-24 data-[vaul-drawer-direction=top]:max-h-[80vh] data-[vaul-drawer-direction=top]:rounded-b-lg data-[vaul-drawer-direction=top]:border-b",
|
|
59
|
-
"data-[vaul-drawer-direction=bottom]:inset-x-0 data-[vaul-drawer-direction=bottom]:bottom-0 data-[vaul-drawer-direction=bottom]:mt-24 data-[vaul-drawer-direction=bottom]:max-h-[80vh] data-[vaul-drawer-direction=bottom]:rounded-t-lg data-[vaul-drawer-direction=bottom]:border-t",
|
|
60
|
-
"data-[vaul-drawer-direction=right]:inset-y-0 data-[vaul-drawer-direction=right]:right-0 data-[vaul-drawer-direction=right]:w-3/4 data-[vaul-drawer-direction=right]:border-l data-[vaul-drawer-direction=right]:sm:max-w-sm",
|
|
61
|
-
"data-[vaul-drawer-direction=left]:inset-y-0 data-[vaul-drawer-direction=left]:left-0 data-[vaul-drawer-direction=left]:w-3/4 data-[vaul-drawer-direction=left]:border-r data-[vaul-drawer-direction=left]:sm:max-w-sm",
|
|
62
|
-
className
|
|
63
|
-
)}
|
|
64
|
-
{...props}
|
|
65
|
-
>
|
|
66
|
-
<div className="bg-muted mx-auto mt-4 hidden h-2 w-[100px] shrink-0 rounded-full group-data-[vaul-drawer-direction=bottom]/drawer-content:block" />
|
|
67
|
-
{children}
|
|
68
|
-
</DrawerPrimitive.Content>
|
|
69
|
-
</DrawerPortal>
|
|
70
|
-
)
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
function DrawerHeader({ className, ...props }: React.ComponentProps<"div">) {
|
|
74
|
-
return (
|
|
75
|
-
<div
|
|
76
|
-
data-slot="drawer-header"
|
|
77
|
-
className={cn(
|
|
78
|
-
"flex flex-col gap-0.5 p-4 group-data-[vaul-drawer-direction=bottom]/drawer-content:text-center group-data-[vaul-drawer-direction=top]/drawer-content:text-center md:gap-1.5 md:text-left",
|
|
79
|
-
className
|
|
80
|
-
)}
|
|
81
|
-
{...props}
|
|
82
|
-
/>
|
|
83
|
-
)
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
function DrawerFooter({ className, ...props }: React.ComponentProps<"div">) {
|
|
87
|
-
return (
|
|
88
|
-
<div
|
|
89
|
-
data-slot="drawer-footer"
|
|
90
|
-
className={cn("mt-auto flex flex-col gap-2 p-4", className)}
|
|
91
|
-
{...props}
|
|
92
|
-
/>
|
|
93
|
-
)
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
function DrawerTitle({
|
|
97
|
-
className,
|
|
98
|
-
...props
|
|
99
|
-
}: React.ComponentProps<typeof DrawerPrimitive.Title>) {
|
|
100
|
-
return (
|
|
101
|
-
<DrawerPrimitive.Title
|
|
102
|
-
data-slot="drawer-title"
|
|
103
|
-
className={cn("text-foreground font-semibold", className)}
|
|
104
|
-
{...props}
|
|
105
|
-
/>
|
|
106
|
-
)
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
function DrawerDescription({
|
|
110
|
-
className,
|
|
111
|
-
...props
|
|
112
|
-
}: React.ComponentProps<typeof DrawerPrimitive.Description>) {
|
|
113
|
-
return (
|
|
114
|
-
<DrawerPrimitive.Description
|
|
115
|
-
data-slot="drawer-description"
|
|
116
|
-
className={cn("text-muted-foreground text-sm", className)}
|
|
117
|
-
{...props}
|
|
118
|
-
/>
|
|
119
|
-
)
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
export {
|
|
123
|
-
Drawer,
|
|
124
|
-
DrawerPortal,
|
|
125
|
-
DrawerOverlay,
|
|
126
|
-
DrawerTrigger,
|
|
127
|
-
DrawerClose,
|
|
128
|
-
DrawerContent,
|
|
129
|
-
DrawerHeader,
|
|
130
|
-
DrawerFooter,
|
|
131
|
-
DrawerTitle,
|
|
132
|
-
DrawerDescription,
|
|
133
|
-
}
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import { Drawer as DrawerPrimitive } from "vaul"
|
|
3
|
+
|
|
4
|
+
import { cn } from "@c-rex/utils"
|
|
5
|
+
|
|
6
|
+
function Drawer({
|
|
7
|
+
...props
|
|
8
|
+
}: React.ComponentProps<typeof DrawerPrimitive.Root>) {
|
|
9
|
+
return <DrawerPrimitive.Root data-slot="drawer" {...props} />
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function DrawerTrigger({
|
|
13
|
+
...props
|
|
14
|
+
}: React.ComponentProps<typeof DrawerPrimitive.Trigger>) {
|
|
15
|
+
return <DrawerPrimitive.Trigger data-slot="drawer-trigger" {...props} />
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function DrawerPortal({
|
|
19
|
+
...props
|
|
20
|
+
}: React.ComponentProps<typeof DrawerPrimitive.Portal>) {
|
|
21
|
+
return <DrawerPrimitive.Portal data-slot="drawer-portal" {...props} />
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function DrawerClose({
|
|
25
|
+
...props
|
|
26
|
+
}: React.ComponentProps<typeof DrawerPrimitive.Close>) {
|
|
27
|
+
return <DrawerPrimitive.Close data-slot="drawer-close" {...props} />
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function DrawerOverlay({
|
|
31
|
+
className,
|
|
32
|
+
...props
|
|
33
|
+
}: React.ComponentProps<typeof DrawerPrimitive.Overlay>) {
|
|
34
|
+
return (
|
|
35
|
+
<DrawerPrimitive.Overlay
|
|
36
|
+
data-slot="drawer-overlay"
|
|
37
|
+
className={cn(
|
|
38
|
+
"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",
|
|
39
|
+
className
|
|
40
|
+
)}
|
|
41
|
+
{...props}
|
|
42
|
+
/>
|
|
43
|
+
)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function DrawerContent({
|
|
47
|
+
className,
|
|
48
|
+
children,
|
|
49
|
+
...props
|
|
50
|
+
}: React.ComponentProps<typeof DrawerPrimitive.Content>) {
|
|
51
|
+
return (
|
|
52
|
+
<DrawerPortal data-slot="drawer-portal">
|
|
53
|
+
<DrawerOverlay />
|
|
54
|
+
<DrawerPrimitive.Content
|
|
55
|
+
data-slot="drawer-content"
|
|
56
|
+
className={cn(
|
|
57
|
+
"group/drawer-content bg-background fixed z-50 flex h-auto flex-col",
|
|
58
|
+
"data-[vaul-drawer-direction=top]:inset-x-0 data-[vaul-drawer-direction=top]:top-0 data-[vaul-drawer-direction=top]:mb-24 data-[vaul-drawer-direction=top]:max-h-[80vh] data-[vaul-drawer-direction=top]:rounded-b-lg data-[vaul-drawer-direction=top]:border-b",
|
|
59
|
+
"data-[vaul-drawer-direction=bottom]:inset-x-0 data-[vaul-drawer-direction=bottom]:bottom-0 data-[vaul-drawer-direction=bottom]:mt-24 data-[vaul-drawer-direction=bottom]:max-h-[80vh] data-[vaul-drawer-direction=bottom]:rounded-t-lg data-[vaul-drawer-direction=bottom]:border-t",
|
|
60
|
+
"data-[vaul-drawer-direction=right]:inset-y-0 data-[vaul-drawer-direction=right]:right-0 data-[vaul-drawer-direction=right]:w-3/4 data-[vaul-drawer-direction=right]:border-l data-[vaul-drawer-direction=right]:sm:max-w-sm",
|
|
61
|
+
"data-[vaul-drawer-direction=left]:inset-y-0 data-[vaul-drawer-direction=left]:left-0 data-[vaul-drawer-direction=left]:w-3/4 data-[vaul-drawer-direction=left]:border-r data-[vaul-drawer-direction=left]:sm:max-w-sm",
|
|
62
|
+
className
|
|
63
|
+
)}
|
|
64
|
+
{...props}
|
|
65
|
+
>
|
|
66
|
+
<div className="bg-muted mx-auto mt-4 hidden h-2 w-[100px] shrink-0 rounded-full group-data-[vaul-drawer-direction=bottom]/drawer-content:block" />
|
|
67
|
+
{children}
|
|
68
|
+
</DrawerPrimitive.Content>
|
|
69
|
+
</DrawerPortal>
|
|
70
|
+
)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function DrawerHeader({ className, ...props }: React.ComponentProps<"div">) {
|
|
74
|
+
return (
|
|
75
|
+
<div
|
|
76
|
+
data-slot="drawer-header"
|
|
77
|
+
className={cn(
|
|
78
|
+
"flex flex-col gap-0.5 p-4 group-data-[vaul-drawer-direction=bottom]/drawer-content:text-center group-data-[vaul-drawer-direction=top]/drawer-content:text-center md:gap-1.5 md:text-left",
|
|
79
|
+
className
|
|
80
|
+
)}
|
|
81
|
+
{...props}
|
|
82
|
+
/>
|
|
83
|
+
)
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function DrawerFooter({ className, ...props }: React.ComponentProps<"div">) {
|
|
87
|
+
return (
|
|
88
|
+
<div
|
|
89
|
+
data-slot="drawer-footer"
|
|
90
|
+
className={cn("mt-auto flex flex-col gap-2 p-4", className)}
|
|
91
|
+
{...props}
|
|
92
|
+
/>
|
|
93
|
+
)
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function DrawerTitle({
|
|
97
|
+
className,
|
|
98
|
+
...props
|
|
99
|
+
}: React.ComponentProps<typeof DrawerPrimitive.Title>) {
|
|
100
|
+
return (
|
|
101
|
+
<DrawerPrimitive.Title
|
|
102
|
+
data-slot="drawer-title"
|
|
103
|
+
className={cn("text-foreground font-semibold", className)}
|
|
104
|
+
{...props}
|
|
105
|
+
/>
|
|
106
|
+
)
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function DrawerDescription({
|
|
110
|
+
className,
|
|
111
|
+
...props
|
|
112
|
+
}: React.ComponentProps<typeof DrawerPrimitive.Description>) {
|
|
113
|
+
return (
|
|
114
|
+
<DrawerPrimitive.Description
|
|
115
|
+
data-slot="drawer-description"
|
|
116
|
+
className={cn("text-muted-foreground text-sm", className)}
|
|
117
|
+
{...props}
|
|
118
|
+
/>
|
|
119
|
+
)
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export {
|
|
123
|
+
Drawer,
|
|
124
|
+
DrawerPortal,
|
|
125
|
+
DrawerOverlay,
|
|
126
|
+
DrawerTrigger,
|
|
127
|
+
DrawerClose,
|
|
128
|
+
DrawerContent,
|
|
129
|
+
DrawerHeader,
|
|
130
|
+
DrawerFooter,
|
|
131
|
+
DrawerTitle,
|
|
132
|
+
DrawerDescription,
|
|
133
|
+
}
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { cn } from "@c-rex/utils"
|
|
2
|
-
|
|
3
|
-
interface DropdownHoverItemProps {
|
|
4
|
-
label: React.ReactNode;
|
|
5
|
-
children: React.ReactNode;
|
|
6
|
-
className?: string;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export function DropdownHoverItem({
|
|
10
|
-
label,
|
|
11
|
-
children,
|
|
12
|
-
className
|
|
13
|
-
}: DropdownHoverItemProps) {
|
|
14
|
-
return (
|
|
15
|
-
<div className={cn("relative inline-block group/dropdown", className)}>
|
|
16
|
-
|
|
17
|
-
{label}
|
|
18
|
-
<div className="hidden group-hover/dropdown:block absolute left-0 z-10 pt-2">
|
|
19
|
-
|
|
20
|
-
<div className="w-48 bg-white border rounded shadow-lg p-2 max-h-[30rem] overflow-auto">
|
|
21
|
-
{children}
|
|
22
|
-
</div>
|
|
23
|
-
|
|
24
|
-
</div>
|
|
25
|
-
</div>
|
|
26
|
-
);
|
|
27
|
-
}
|
|
1
|
+
import { cn } from "@c-rex/utils"
|
|
2
|
+
|
|
3
|
+
interface DropdownHoverItemProps {
|
|
4
|
+
label: React.ReactNode;
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
className?: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function DropdownHoverItem({
|
|
10
|
+
label,
|
|
11
|
+
children,
|
|
12
|
+
className
|
|
13
|
+
}: DropdownHoverItemProps) {
|
|
14
|
+
return (
|
|
15
|
+
<div className={cn("relative inline-block group/dropdown", className)}>
|
|
16
|
+
|
|
17
|
+
{label}
|
|
18
|
+
<div className="hidden group-hover/dropdown:block absolute left-0 z-10 pt-2">
|
|
19
|
+
|
|
20
|
+
<div className="w-48 bg-white border rounded shadow-lg p-2 max-h-[30rem] overflow-auto">
|
|
21
|
+
{children}
|
|
22
|
+
</div>
|
|
23
|
+
|
|
24
|
+
</div>
|
|
25
|
+
</div>
|
|
26
|
+
);
|
|
27
|
+
}
|