StillWorking commited on
Commit
6f5c11c
·
verified ·
1 Parent(s): ede894c

Upload frontend/src/components/ui/menubar.tsx with huggingface_hub

Browse files
frontend/src/components/ui/menubar.tsx ADDED
@@ -0,0 +1,229 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import * as React from "react";
2
+ import * as MenubarPrimitive from "@radix-ui/react-menubar";
3
+ import { Check, ChevronRight, Circle } from "lucide-react";
4
+
5
+ import { cn } from "@/lib/utils";
6
+
7
+ function MenubarMenu({ ...props }: React.ComponentProps<typeof MenubarPrimitive.Menu>) {
8
+ return <MenubarPrimitive.Menu {...props} />;
9
+ }
10
+
11
+ function MenubarGroup({ ...props }: React.ComponentProps<typeof MenubarPrimitive.Group>) {
12
+ return <MenubarPrimitive.Group {...props} />;
13
+ }
14
+
15
+ function MenubarPortal({ ...props }: React.ComponentProps<typeof MenubarPrimitive.Portal>) {
16
+ return <MenubarPrimitive.Portal {...props} />;
17
+ }
18
+
19
+ function MenubarRadioGroup({ ...props }: React.ComponentProps<typeof MenubarPrimitive.RadioGroup>) {
20
+ return <MenubarPrimitive.RadioGroup {...props} />;
21
+ }
22
+
23
+ function MenubarSub({ ...props }: React.ComponentProps<typeof MenubarPrimitive.Sub>) {
24
+ return <MenubarPrimitive.Sub data-slot="menubar-sub" {...props} />;
25
+ }
26
+
27
+ const Menubar = React.forwardRef<
28
+ React.ElementRef<typeof MenubarPrimitive.Root>,
29
+ React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Root>
30
+ >(({ className, ...props }, ref) => (
31
+ <MenubarPrimitive.Root
32
+ ref={ref}
33
+ className={cn(
34
+ "flex h-9 items-center space-x-1 rounded-md border bg-background p-1 shadow-sm",
35
+ className,
36
+ )}
37
+ {...props}
38
+ />
39
+ ));
40
+ Menubar.displayName = MenubarPrimitive.Root.displayName;
41
+
42
+ const MenubarTrigger = React.forwardRef<
43
+ React.ElementRef<typeof MenubarPrimitive.Trigger>,
44
+ React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Trigger>
45
+ >(({ className, ...props }, ref) => (
46
+ <MenubarPrimitive.Trigger
47
+ ref={ref}
48
+ className={cn(
49
+ "flex cursor-default select-none items-center rounded-sm px-3 py-1 text-sm font-medium outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",
50
+ className,
51
+ )}
52
+ {...props}
53
+ />
54
+ ));
55
+ MenubarTrigger.displayName = MenubarPrimitive.Trigger.displayName;
56
+
57
+ const MenubarSubTrigger = React.forwardRef<
58
+ React.ElementRef<typeof MenubarPrimitive.SubTrigger>,
59
+ React.ComponentPropsWithoutRef<typeof MenubarPrimitive.SubTrigger> & {
60
+ inset?: boolean;
61
+ }
62
+ >(({ className, inset, children, ...props }, ref) => (
63
+ <MenubarPrimitive.SubTrigger
64
+ ref={ref}
65
+ className={cn(
66
+ "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",
67
+ inset && "pl-8",
68
+ className,
69
+ )}
70
+ {...props}
71
+ >
72
+ {children}
73
+ <ChevronRight className="ml-auto h-4 w-4" />
74
+ </MenubarPrimitive.SubTrigger>
75
+ ));
76
+ MenubarSubTrigger.displayName = MenubarPrimitive.SubTrigger.displayName;
77
+
78
+ const MenubarSubContent = React.forwardRef<
79
+ React.ElementRef<typeof MenubarPrimitive.SubContent>,
80
+ React.ComponentPropsWithoutRef<typeof MenubarPrimitive.SubContent>
81
+ >(({ className, ...props }, ref) => (
82
+ <MenubarPrimitive.SubContent
83
+ ref={ref}
84
+ className={cn(
85
+ "z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg 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-menubar-content-transform-origin)",
86
+ className,
87
+ )}
88
+ {...props}
89
+ />
90
+ ));
91
+ MenubarSubContent.displayName = MenubarPrimitive.SubContent.displayName;
92
+
93
+ const MenubarContent = React.forwardRef<
94
+ React.ElementRef<typeof MenubarPrimitive.Content>,
95
+ React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Content>
96
+ >(({ className, align = "start", alignOffset = -4, sideOffset = 8, ...props }, ref) => (
97
+ <MenubarPrimitive.Portal>
98
+ <MenubarPrimitive.Content
99
+ ref={ref}
100
+ align={align}
101
+ alignOffset={alignOffset}
102
+ sideOffset={sideOffset}
103
+ className={cn(
104
+ "z-50 min-w-[12rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in 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-menubar-content-transform-origin)",
105
+ className,
106
+ )}
107
+ {...props}
108
+ />
109
+ </MenubarPrimitive.Portal>
110
+ ));
111
+ MenubarContent.displayName = MenubarPrimitive.Content.displayName;
112
+
113
+ const MenubarItem = React.forwardRef<
114
+ React.ElementRef<typeof MenubarPrimitive.Item>,
115
+ React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Item> & {
116
+ inset?: boolean;
117
+ }
118
+ >(({ className, inset, ...props }, ref) => (
119
+ <MenubarPrimitive.Item
120
+ ref={ref}
121
+ className={cn(
122
+ "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",
123
+ inset && "pl-8",
124
+ className,
125
+ )}
126
+ {...props}
127
+ />
128
+ ));
129
+ MenubarItem.displayName = MenubarPrimitive.Item.displayName;
130
+
131
+ const MenubarCheckboxItem = React.forwardRef<
132
+ React.ElementRef<typeof MenubarPrimitive.CheckboxItem>,
133
+ React.ComponentPropsWithoutRef<typeof MenubarPrimitive.CheckboxItem>
134
+ >(({ className, children, checked, ...props }, ref) => (
135
+ <MenubarPrimitive.CheckboxItem
136
+ ref={ref}
137
+ className={cn(
138
+ "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",
139
+ className,
140
+ )}
141
+ checked={checked}
142
+ {...props}
143
+ >
144
+ <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
145
+ <MenubarPrimitive.ItemIndicator>
146
+ <Check className="h-4 w-4" />
147
+ </MenubarPrimitive.ItemIndicator>
148
+ </span>
149
+ {children}
150
+ </MenubarPrimitive.CheckboxItem>
151
+ ));
152
+ MenubarCheckboxItem.displayName = MenubarPrimitive.CheckboxItem.displayName;
153
+
154
+ const MenubarRadioItem = React.forwardRef<
155
+ React.ElementRef<typeof MenubarPrimitive.RadioItem>,
156
+ React.ComponentPropsWithoutRef<typeof MenubarPrimitive.RadioItem>
157
+ >(({ className, children, ...props }, ref) => (
158
+ <MenubarPrimitive.RadioItem
159
+ ref={ref}
160
+ className={cn(
161
+ "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",
162
+ className,
163
+ )}
164
+ {...props}
165
+ >
166
+ <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
167
+ <MenubarPrimitive.ItemIndicator>
168
+ <Circle className="h-4 w-4 fill-current" />
169
+ </MenubarPrimitive.ItemIndicator>
170
+ </span>
171
+ {children}
172
+ </MenubarPrimitive.RadioItem>
173
+ ));
174
+ MenubarRadioItem.displayName = MenubarPrimitive.RadioItem.displayName;
175
+
176
+ const MenubarLabel = React.forwardRef<
177
+ React.ElementRef<typeof MenubarPrimitive.Label>,
178
+ React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Label> & {
179
+ inset?: boolean;
180
+ }
181
+ >(({ className, inset, ...props }, ref) => (
182
+ <MenubarPrimitive.Label
183
+ ref={ref}
184
+ className={cn("px-2 py-1.5 text-sm font-semibold", inset && "pl-8", className)}
185
+ {...props}
186
+ />
187
+ ));
188
+ MenubarLabel.displayName = MenubarPrimitive.Label.displayName;
189
+
190
+ const MenubarSeparator = React.forwardRef<
191
+ React.ElementRef<typeof MenubarPrimitive.Separator>,
192
+ React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Separator>
193
+ >(({ className, ...props }, ref) => (
194
+ <MenubarPrimitive.Separator
195
+ ref={ref}
196
+ className={cn("-mx-1 my-1 h-px bg-muted", className)}
197
+ {...props}
198
+ />
199
+ ));
200
+ MenubarSeparator.displayName = MenubarPrimitive.Separator.displayName;
201
+
202
+ const MenubarShortcut = ({ className, ...props }: React.HTMLAttributes<HTMLSpanElement>) => {
203
+ return (
204
+ <span
205
+ className={cn("ml-auto text-xs tracking-widest text-muted-foreground", className)}
206
+ {...props}
207
+ />
208
+ );
209
+ };
210
+ MenubarShortcut.displayname = "MenubarShortcut";
211
+
212
+ export {
213
+ Menubar,
214
+ MenubarMenu,
215
+ MenubarTrigger,
216
+ MenubarContent,
217
+ MenubarItem,
218
+ MenubarSeparator,
219
+ MenubarLabel,
220
+ MenubarCheckboxItem,
221
+ MenubarRadioGroup,
222
+ MenubarRadioItem,
223
+ MenubarPortal,
224
+ MenubarSubContent,
225
+ MenubarSubTrigger,
226
+ MenubarGroup,
227
+ MenubarSub,
228
+ MenubarShortcut,
229
+ };