@blips/ui 0.0.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.
Files changed (53) hide show
  1. package/dist/index.cjs +2675 -0
  2. package/dist/index.cjs.map +1 -0
  3. package/dist/index.d.cts +514 -0
  4. package/dist/index.d.ts +514 -0
  5. package/dist/index.js +2418 -0
  6. package/dist/index.js.map +1 -0
  7. package/package.json +153 -0
  8. package/src/components/accordion.tsx +56 -0
  9. package/src/components/alert-dialog.tsx +138 -0
  10. package/src/components/alert.tsx +59 -0
  11. package/src/components/aspect-ratio.tsx +5 -0
  12. package/src/components/avatar.tsx +50 -0
  13. package/src/components/badge.tsx +36 -0
  14. package/src/components/breadcrumb.tsx +115 -0
  15. package/src/components/button.tsx +56 -0
  16. package/src/components/calendar.tsx +216 -0
  17. package/src/components/card.tsx +86 -0
  18. package/src/components/carousel.tsx +259 -0
  19. package/src/components/checkbox.tsx +28 -0
  20. package/src/components/collapsible.tsx +11 -0
  21. package/src/components/command.tsx +150 -0
  22. package/src/components/context-menu.tsx +198 -0
  23. package/src/components/dialog.tsx +122 -0
  24. package/src/components/drawer.tsx +116 -0
  25. package/src/components/dropdown-menu.tsx +200 -0
  26. package/src/components/hover-card.tsx +27 -0
  27. package/src/components/input-otp.tsx +69 -0
  28. package/src/components/input.tsx +22 -0
  29. package/src/components/label.tsx +26 -0
  30. package/src/components/menubar.tsx +254 -0
  31. package/src/components/navigation-menu.tsx +128 -0
  32. package/src/components/pagination.tsx +116 -0
  33. package/src/components/popover.tsx +29 -0
  34. package/src/components/progress.tsx +28 -0
  35. package/src/components/radio-group.tsx +42 -0
  36. package/src/components/resizable.tsx +45 -0
  37. package/src/components/scroll-area.tsx +46 -0
  38. package/src/components/select.tsx +160 -0
  39. package/src/components/separator.tsx +29 -0
  40. package/src/components/sheet.tsx +140 -0
  41. package/src/components/skeleton.tsx +15 -0
  42. package/src/components/slider.tsx +26 -0
  43. package/src/components/sonner.tsx +45 -0
  44. package/src/components/switch.tsx +27 -0
  45. package/src/components/table.tsx +117 -0
  46. package/src/components/tabs.tsx +53 -0
  47. package/src/components/textarea.tsx +22 -0
  48. package/src/components/toggle-group.tsx +60 -0
  49. package/src/components/toggle.tsx +43 -0
  50. package/src/components/tooltip.tsx +30 -0
  51. package/src/globals.css +77 -0
  52. package/src/index.ts +322 -0
  53. package/src/lib/utils.ts +6 -0
@@ -0,0 +1,150 @@
1
+ import type { DialogProps } from "@radix-ui/react-dialog";
2
+ import { Command as CommandPrimitive } from "cmdk";
3
+ import { Search } from "lucide-react";
4
+ import * as React from "react";
5
+ import { Dialog, DialogContent } from "./dialog";
6
+ import { cn } from "../lib/utils";
7
+
8
+ const Command = React.forwardRef<
9
+ React.ElementRef<typeof CommandPrimitive>,
10
+ React.ComponentPropsWithoutRef<typeof CommandPrimitive>
11
+ >(({ className, ...props }, ref) => (
12
+ <CommandPrimitive
13
+ ref={ref}
14
+ className={cn(
15
+ "flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",
16
+ className
17
+ )}
18
+ {...props}
19
+ />
20
+ ));
21
+ Command.displayName = CommandPrimitive.displayName;
22
+
23
+ const CommandDialog = ({ children, ...props }: DialogProps) => {
24
+ return (
25
+ <Dialog {...props}>
26
+ <DialogContent className="overflow-hidden p-0 shadow-lg">
27
+ <Command className="[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5">
28
+ {children}
29
+ </Command>
30
+ </DialogContent>
31
+ </Dialog>
32
+ );
33
+ };
34
+
35
+ const CommandInput = React.forwardRef<
36
+ React.ElementRef<typeof CommandPrimitive.Input>,
37
+ React.ComponentPropsWithoutRef<typeof CommandPrimitive.Input>
38
+ >(({ className, ...props }, ref) => (
39
+ <div className="flex items-center border-b px-3" cmdk-input-wrapper="">
40
+ <Search className="mr-2 h-4 w-4 shrink-0 opacity-50" />
41
+ <CommandPrimitive.Input
42
+ ref={ref}
43
+ className={cn(
44
+ "flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
45
+ className
46
+ )}
47
+ {...props}
48
+ />
49
+ </div>
50
+ ));
51
+
52
+ CommandInput.displayName = CommandPrimitive.Input.displayName;
53
+
54
+ const CommandList = React.forwardRef<
55
+ React.ElementRef<typeof CommandPrimitive.List>,
56
+ React.ComponentPropsWithoutRef<typeof CommandPrimitive.List>
57
+ >(({ className, ...props }, ref) => (
58
+ <CommandPrimitive.List
59
+ ref={ref}
60
+ className={cn("max-h-[300px] overflow-y-auto overflow-x-hidden", className)}
61
+ {...props}
62
+ />
63
+ ));
64
+
65
+ CommandList.displayName = CommandPrimitive.List.displayName;
66
+
67
+ const CommandEmpty = React.forwardRef<
68
+ React.ElementRef<typeof CommandPrimitive.Empty>,
69
+ React.ComponentPropsWithoutRef<typeof CommandPrimitive.Empty>
70
+ >((props, ref) => (
71
+ <CommandPrimitive.Empty
72
+ ref={ref}
73
+ className="py-6 text-center text-sm"
74
+ {...props}
75
+ />
76
+ ));
77
+
78
+ CommandEmpty.displayName = CommandPrimitive.Empty.displayName;
79
+
80
+ const CommandGroup = React.forwardRef<
81
+ React.ElementRef<typeof CommandPrimitive.Group>,
82
+ React.ComponentPropsWithoutRef<typeof CommandPrimitive.Group>
83
+ >(({ className, ...props }, ref) => (
84
+ <CommandPrimitive.Group
85
+ ref={ref}
86
+ className={cn(
87
+ "overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",
88
+ className
89
+ )}
90
+ {...props}
91
+ />
92
+ ));
93
+
94
+ CommandGroup.displayName = CommandPrimitive.Group.displayName;
95
+
96
+ const CommandSeparator = React.forwardRef<
97
+ React.ElementRef<typeof CommandPrimitive.Separator>,
98
+ React.ComponentPropsWithoutRef<typeof CommandPrimitive.Separator>
99
+ >(({ className, ...props }, ref) => (
100
+ <CommandPrimitive.Separator
101
+ ref={ref}
102
+ className={cn("-mx-1 h-px bg-border", className)}
103
+ {...props}
104
+ />
105
+ ));
106
+ CommandSeparator.displayName = CommandPrimitive.Separator.displayName;
107
+
108
+ const CommandItem = React.forwardRef<
109
+ React.ElementRef<typeof CommandPrimitive.Item>,
110
+ React.ComponentPropsWithoutRef<typeof CommandPrimitive.Item>
111
+ >(({ className, ...props }, ref) => (
112
+ <CommandPrimitive.Item
113
+ ref={ref}
114
+ className={cn(
115
+ "relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected='true']:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
116
+ className
117
+ )}
118
+ {...props}
119
+ />
120
+ ));
121
+
122
+ CommandItem.displayName = CommandPrimitive.Item.displayName;
123
+
124
+ const CommandShortcut = ({
125
+ className,
126
+ ...props
127
+ }: React.HTMLAttributes<HTMLSpanElement>) => {
128
+ return (
129
+ <span
130
+ className={cn(
131
+ "ml-auto text-xs tracking-widest text-muted-foreground",
132
+ className
133
+ )}
134
+ {...props}
135
+ />
136
+ );
137
+ };
138
+ CommandShortcut.displayName = "CommandShortcut";
139
+
140
+ export {
141
+ Command,
142
+ CommandDialog,
143
+ CommandInput,
144
+ CommandList,
145
+ CommandEmpty,
146
+ CommandGroup,
147
+ CommandItem,
148
+ CommandShortcut,
149
+ CommandSeparator,
150
+ };
@@ -0,0 +1,198 @@
1
+ import * as ContextMenuPrimitive from "@radix-ui/react-context-menu";
2
+ import { Check, ChevronRight, Circle } from "lucide-react";
3
+ import * as React from "react";
4
+
5
+ import { cn } from "../lib/utils";
6
+
7
+ const ContextMenu = ContextMenuPrimitive.Root;
8
+
9
+ const ContextMenuTrigger = ContextMenuPrimitive.Trigger;
10
+
11
+ const ContextMenuGroup = ContextMenuPrimitive.Group;
12
+
13
+ const ContextMenuPortal = ContextMenuPrimitive.Portal;
14
+
15
+ const ContextMenuSub = ContextMenuPrimitive.Sub;
16
+
17
+ const ContextMenuRadioGroup = ContextMenuPrimitive.RadioGroup;
18
+
19
+ const ContextMenuSubTrigger = React.forwardRef<
20
+ React.ElementRef<typeof ContextMenuPrimitive.SubTrigger>,
21
+ React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubTrigger> & {
22
+ inset?: boolean;
23
+ }
24
+ >(({ className, inset, children, ...props }, ref) => (
25
+ <ContextMenuPrimitive.SubTrigger
26
+ ref={ref}
27
+ className={cn(
28
+ "flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",
29
+ inset && "pl-8",
30
+ className
31
+ )}
32
+ {...props}
33
+ >
34
+ {children}
35
+ <ChevronRight className="ml-auto h-4 w-4" />
36
+ </ContextMenuPrimitive.SubTrigger>
37
+ ));
38
+ ContextMenuSubTrigger.displayName = ContextMenuPrimitive.SubTrigger.displayName;
39
+
40
+ const ContextMenuSubContent = React.forwardRef<
41
+ React.ElementRef<typeof ContextMenuPrimitive.SubContent>,
42
+ React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubContent>
43
+ >(({ className, ...props }, ref) => (
44
+ <ContextMenuPrimitive.SubContent
45
+ ref={ref}
46
+ className={cn(
47
+ "z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md 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 origin-[--radix-context-menu-content-transform-origin]",
48
+ className
49
+ )}
50
+ {...props}
51
+ />
52
+ ));
53
+ ContextMenuSubContent.displayName = ContextMenuPrimitive.SubContent.displayName;
54
+
55
+ const ContextMenuContent = React.forwardRef<
56
+ React.ElementRef<typeof ContextMenuPrimitive.Content>,
57
+ React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Content>
58
+ >(({ className, ...props }, ref) => (
59
+ <ContextMenuPrimitive.Portal>
60
+ <ContextMenuPrimitive.Content
61
+ ref={ref}
62
+ className={cn(
63
+ "z-50 max-h-[--radix-context-menu-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md animate-in fade-in-80 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 origin-[--radix-context-menu-content-transform-origin]",
64
+ className
65
+ )}
66
+ {...props}
67
+ />
68
+ </ContextMenuPrimitive.Portal>
69
+ ));
70
+ ContextMenuContent.displayName = ContextMenuPrimitive.Content.displayName;
71
+
72
+ const ContextMenuItem = React.forwardRef<
73
+ React.ElementRef<typeof ContextMenuPrimitive.Item>,
74
+ React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Item> & {
75
+ inset?: boolean;
76
+ }
77
+ >(({ className, inset, ...props }, ref) => (
78
+ <ContextMenuPrimitive.Item
79
+ ref={ref}
80
+ className={cn(
81
+ "relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
82
+ inset && "pl-8",
83
+ className
84
+ )}
85
+ {...props}
86
+ />
87
+ ));
88
+ ContextMenuItem.displayName = ContextMenuPrimitive.Item.displayName;
89
+
90
+ const ContextMenuCheckboxItem = React.forwardRef<
91
+ React.ElementRef<typeof ContextMenuPrimitive.CheckboxItem>,
92
+ React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.CheckboxItem>
93
+ >(({ className, children, checked, ...props }, ref) => (
94
+ <ContextMenuPrimitive.CheckboxItem
95
+ ref={ref}
96
+ className={cn(
97
+ "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
98
+ className
99
+ )}
100
+ checked={checked}
101
+ {...props}
102
+ >
103
+ <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
104
+ <ContextMenuPrimitive.ItemIndicator>
105
+ <Check className="h-4 w-4" />
106
+ </ContextMenuPrimitive.ItemIndicator>
107
+ </span>
108
+ {children}
109
+ </ContextMenuPrimitive.CheckboxItem>
110
+ ));
111
+ ContextMenuCheckboxItem.displayName =
112
+ ContextMenuPrimitive.CheckboxItem.displayName;
113
+
114
+ const ContextMenuRadioItem = React.forwardRef<
115
+ React.ElementRef<typeof ContextMenuPrimitive.RadioItem>,
116
+ React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.RadioItem>
117
+ >(({ className, children, ...props }, ref) => (
118
+ <ContextMenuPrimitive.RadioItem
119
+ ref={ref}
120
+ className={cn(
121
+ "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
122
+ className
123
+ )}
124
+ {...props}
125
+ >
126
+ <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
127
+ <ContextMenuPrimitive.ItemIndicator>
128
+ <Circle className="h-2 w-2 fill-current" />
129
+ </ContextMenuPrimitive.ItemIndicator>
130
+ </span>
131
+ {children}
132
+ </ContextMenuPrimitive.RadioItem>
133
+ ));
134
+ ContextMenuRadioItem.displayName = ContextMenuPrimitive.RadioItem.displayName;
135
+
136
+ const ContextMenuLabel = React.forwardRef<
137
+ React.ElementRef<typeof ContextMenuPrimitive.Label>,
138
+ React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Label> & {
139
+ inset?: boolean;
140
+ }
141
+ >(({ className, inset, ...props }, ref) => (
142
+ <ContextMenuPrimitive.Label
143
+ ref={ref}
144
+ className={cn(
145
+ "px-2 py-1.5 text-sm font-semibold text-foreground",
146
+ inset && "pl-8",
147
+ className
148
+ )}
149
+ {...props}
150
+ />
151
+ ));
152
+ ContextMenuLabel.displayName = ContextMenuPrimitive.Label.displayName;
153
+
154
+ const ContextMenuSeparator = React.forwardRef<
155
+ React.ElementRef<typeof ContextMenuPrimitive.Separator>,
156
+ React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Separator>
157
+ >(({ className, ...props }, ref) => (
158
+ <ContextMenuPrimitive.Separator
159
+ ref={ref}
160
+ className={cn("-mx-1 my-1 h-px bg-border", className)}
161
+ {...props}
162
+ />
163
+ ));
164
+ ContextMenuSeparator.displayName = ContextMenuPrimitive.Separator.displayName;
165
+
166
+ const ContextMenuShortcut = ({
167
+ className,
168
+ ...props
169
+ }: React.HTMLAttributes<HTMLSpanElement>) => {
170
+ return (
171
+ <span
172
+ className={cn(
173
+ "ml-auto text-xs tracking-widest text-muted-foreground",
174
+ className
175
+ )}
176
+ {...props}
177
+ />
178
+ );
179
+ };
180
+ ContextMenuShortcut.displayName = "ContextMenuShortcut";
181
+
182
+ export {
183
+ ContextMenu,
184
+ ContextMenuTrigger,
185
+ ContextMenuContent,
186
+ ContextMenuItem,
187
+ ContextMenuCheckboxItem,
188
+ ContextMenuRadioItem,
189
+ ContextMenuLabel,
190
+ ContextMenuSeparator,
191
+ ContextMenuShortcut,
192
+ ContextMenuGroup,
193
+ ContextMenuPortal,
194
+ ContextMenuSub,
195
+ ContextMenuSubContent,
196
+ ContextMenuSubTrigger,
197
+ ContextMenuRadioGroup,
198
+ };
@@ -0,0 +1,122 @@
1
+ "use client";
2
+
3
+ import * as DialogPrimitive from "@radix-ui/react-dialog";
4
+ import { X } from "lucide-react";
5
+ import * as React from "react";
6
+
7
+ import { cn } from "../lib/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
+ DialogClose,
116
+ DialogTrigger,
117
+ DialogContent,
118
+ DialogHeader,
119
+ DialogFooter,
120
+ DialogTitle,
121
+ DialogDescription,
122
+ };
@@ -0,0 +1,116 @@
1
+ import * as React from "react";
2
+ import { Drawer as DrawerPrimitive } from "vaul";
3
+
4
+ import { cn } from "../lib/utils";
5
+
6
+ const Drawer = ({
7
+ shouldScaleBackground = true,
8
+ ...props
9
+ }: React.ComponentProps<typeof DrawerPrimitive.Root>) => (
10
+ <DrawerPrimitive.Root
11
+ shouldScaleBackground={shouldScaleBackground}
12
+ {...props}
13
+ />
14
+ );
15
+ Drawer.displayName = "Drawer";
16
+
17
+ const DrawerTrigger = DrawerPrimitive.Trigger;
18
+
19
+ const DrawerPortal = DrawerPrimitive.Portal;
20
+
21
+ const DrawerClose = DrawerPrimitive.Close;
22
+
23
+ const DrawerOverlay = React.forwardRef<
24
+ React.ElementRef<typeof DrawerPrimitive.Overlay>,
25
+ React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Overlay>
26
+ >(({ className, ...props }, ref) => (
27
+ <DrawerPrimitive.Overlay
28
+ ref={ref}
29
+ className={cn("fixed inset-0 z-50 bg-black/80", className)}
30
+ {...props}
31
+ />
32
+ ));
33
+ DrawerOverlay.displayName = DrawerPrimitive.Overlay.displayName;
34
+
35
+ const DrawerContent = React.forwardRef<
36
+ React.ElementRef<typeof DrawerPrimitive.Content>,
37
+ React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Content>
38
+ >(({ className, children, ...props }, ref) => (
39
+ <DrawerPortal>
40
+ <DrawerOverlay />
41
+ <DrawerPrimitive.Content
42
+ ref={ref}
43
+ className={cn(
44
+ "fixed inset-x-0 bottom-0 z-50 mt-24 flex h-auto flex-col rounded-t-[10px] border bg-background",
45
+ className
46
+ )}
47
+ {...props}
48
+ >
49
+ <div className="mx-auto mt-4 h-2 w-[100px] rounded-full bg-muted" />
50
+ {children}
51
+ </DrawerPrimitive.Content>
52
+ </DrawerPortal>
53
+ ));
54
+ DrawerContent.displayName = "DrawerContent";
55
+
56
+ const DrawerHeader = ({
57
+ className,
58
+ ...props
59
+ }: React.HTMLAttributes<HTMLDivElement>) => (
60
+ <div
61
+ className={cn("grid gap-1.5 p-4 text-center sm:text-left", className)}
62
+ {...props}
63
+ />
64
+ );
65
+ DrawerHeader.displayName = "DrawerHeader";
66
+
67
+ const DrawerFooter = ({
68
+ className,
69
+ ...props
70
+ }: React.HTMLAttributes<HTMLDivElement>) => (
71
+ <div
72
+ className={cn("mt-auto flex flex-col gap-2 p-4", className)}
73
+ {...props}
74
+ />
75
+ );
76
+ DrawerFooter.displayName = "DrawerFooter";
77
+
78
+ const DrawerTitle = React.forwardRef<
79
+ React.ElementRef<typeof DrawerPrimitive.Title>,
80
+ React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Title>
81
+ >(({ className, ...props }, ref) => (
82
+ <DrawerPrimitive.Title
83
+ ref={ref}
84
+ className={cn(
85
+ "text-lg font-semibold leading-none tracking-tight",
86
+ className
87
+ )}
88
+ {...props}
89
+ />
90
+ ));
91
+ DrawerTitle.displayName = DrawerPrimitive.Title.displayName;
92
+
93
+ const DrawerDescription = React.forwardRef<
94
+ React.ElementRef<typeof DrawerPrimitive.Description>,
95
+ React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Description>
96
+ >(({ className, ...props }, ref) => (
97
+ <DrawerPrimitive.Description
98
+ ref={ref}
99
+ className={cn("text-sm text-muted-foreground", className)}
100
+ {...props}
101
+ />
102
+ ));
103
+ DrawerDescription.displayName = DrawerPrimitive.Description.displayName;
104
+
105
+ export {
106
+ Drawer,
107
+ DrawerPortal,
108
+ DrawerOverlay,
109
+ DrawerTrigger,
110
+ DrawerClose,
111
+ DrawerContent,
112
+ DrawerHeader,
113
+ DrawerFooter,
114
+ DrawerTitle,
115
+ DrawerDescription,
116
+ };