@gunjo/ui 0.0.1-alpha.0

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 (88) hide show
  1. package/README.md +129 -0
  2. package/design/atoms-metadata.json +82 -0
  3. package/design/molecules-metadata.json +130 -0
  4. package/design/organisms-metadata.json +38 -0
  5. package/design/templates-metadata.json +38 -0
  6. package/package.json +158 -0
  7. package/src/components/atoms/Alert.tsx +63 -0
  8. package/src/components/atoms/Avatar.tsx +57 -0
  9. package/src/components/atoms/Badge.tsx +30 -0
  10. package/src/components/atoms/Button.tsx +29 -0
  11. package/src/components/atoms/ButtonVariants.ts +37 -0
  12. package/src/components/atoms/Checkbox.tsx +52 -0
  13. package/src/components/atoms/Img.tsx +102 -0
  14. package/src/components/atoms/Input.tsx +37 -0
  15. package/src/components/atoms/Kbd.tsx +22 -0
  16. package/src/components/atoms/Label.tsx +22 -0
  17. package/src/components/atoms/Progress.tsx +38 -0
  18. package/src/components/atoms/RadioGroup.tsx +86 -0
  19. package/src/components/atoms/Select.tsx +28 -0
  20. package/src/components/atoms/Separator.tsx +33 -0
  21. package/src/components/atoms/Skeleton.tsx +36 -0
  22. package/src/components/atoms/Slider.tsx +26 -0
  23. package/src/components/atoms/Spinner.tsx +34 -0
  24. package/src/components/atoms/Switch.tsx +47 -0
  25. package/src/components/atoms/Textarea.tsx +34 -0
  26. package/src/components/atoms/ToggleGroup.tsx +60 -0
  27. package/src/components/atoms/ToolPill.tsx +77 -0
  28. package/src/components/atoms/generated/default-variant-keys.ts +36 -0
  29. package/src/components/atoms/generated/variant-keys.ts +61 -0
  30. package/src/components/generated/component-manifest.ts +741 -0
  31. package/src/components/generated/component-style-hints.ts +1262 -0
  32. package/src/components/molecules/AIChatInput.tsx +140 -0
  33. package/src/components/molecules/AIChatMessage.tsx +109 -0
  34. package/src/components/molecules/Accordion.tsx +99 -0
  35. package/src/components/molecules/Breadcrumb.tsx +115 -0
  36. package/src/components/molecules/Calendar.tsx +60 -0
  37. package/src/components/molecules/Card.tsx +78 -0
  38. package/src/components/molecules/Carousel.tsx +261 -0
  39. package/src/components/molecules/Command.tsx +152 -0
  40. package/src/components/molecules/ContextMenu.tsx +200 -0
  41. package/src/components/molecules/Dialog.tsx +122 -0
  42. package/src/components/molecules/DropdownMenu.tsx +200 -0
  43. package/src/components/molecules/FilterButton.tsx +133 -0
  44. package/src/components/molecules/Form.tsx +90 -0
  45. package/src/components/molecules/HoverCard.tsx +29 -0
  46. package/src/components/molecules/List.tsx +120 -0
  47. package/src/components/molecules/Menubar.tsx +231 -0
  48. package/src/components/molecules/Modal.tsx +66 -0
  49. package/src/components/molecules/NotificationCenter.tsx +118 -0
  50. package/src/components/molecules/Pagination.tsx +118 -0
  51. package/src/components/molecules/Popover.tsx +31 -0
  52. package/src/components/molecules/ProgressWidget.tsx +40 -0
  53. package/src/components/molecules/Resizable.tsx +47 -0
  54. package/src/components/molecules/ScrollArea.tsx +48 -0
  55. package/src/components/molecules/Sheet.tsx +140 -0
  56. package/src/components/molecules/SidebarItem.tsx +134 -0
  57. package/src/components/molecules/SortButton.tsx +56 -0
  58. package/src/components/molecules/StatusBar.tsx +41 -0
  59. package/src/components/molecules/Stepper.tsx +108 -0
  60. package/src/components/molecules/Table.tsx +117 -0
  61. package/src/components/molecules/Tabs.tsx +64 -0
  62. package/src/components/molecules/Toast.tsx +57 -0
  63. package/src/components/molecules/Tooltip.tsx +30 -0
  64. package/src/components/molecules/generated/default-variant-keys.ts +22 -0
  65. package/src/components/molecules/generated/variant-keys.ts +33 -0
  66. package/src/components/organisms/AppRail.tsx +28 -0
  67. package/src/components/organisms/CommandPalette.tsx +58 -0
  68. package/src/components/organisms/FileUploader.tsx +151 -0
  69. package/src/components/organisms/FloatingPanel.tsx +46 -0
  70. package/src/components/organisms/InspectorPanel.tsx +65 -0
  71. package/src/components/organisms/RightRail.tsx +29 -0
  72. package/src/components/organisms/ShareModal.tsx +182 -0
  73. package/src/components/organisms/SpatialCanvas.tsx +36 -0
  74. package/src/components/organisms/ToastProvider.tsx +49 -0
  75. package/src/components/templates/AuthTemplate.tsx +58 -0
  76. package/src/components/templates/BannalyzeTemplate.tsx +55 -0
  77. package/src/components/templates/ChatTemplate.tsx +55 -0
  78. package/src/components/templates/DashboardTemplate.tsx +34 -0
  79. package/src/components/templates/EditorTemplate.tsx +46 -0
  80. package/src/components/templates/KanbanTemplate.tsx +38 -0
  81. package/src/components/templates/LandingTemplate.tsx +53 -0
  82. package/src/components/templates/MediaLibraryTemplate.tsx +55 -0
  83. package/src/components/templates/SettingsTemplate.tsx +48 -0
  84. package/src/globals.css +108 -0
  85. package/src/index.ts +89 -0
  86. package/src/lib/utils.ts +6 -0
  87. package/tailwind-preset.js +11 -0
  88. package/tailwind-theme-extend.cjs +86 -0
@@ -0,0 +1,261 @@
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import useEmblaCarousel, {
5
+ type UseEmblaCarouselType,
6
+ } from "embla-carousel-react"
7
+ import { ArrowLeft, ArrowRight } from "lucide-react"
8
+
9
+ import { cn } from "../../lib/utils"
10
+ import { Button } from "../atoms/Button"
11
+
12
+ type CarouselApi = UseEmblaCarouselType[1]
13
+ type UseCarouselParameters = Parameters<typeof useEmblaCarousel>
14
+ type CarouselOptions = UseCarouselParameters[0]
15
+ type CarouselPlugin = UseCarouselParameters[1]
16
+
17
+ type CarouselProps = {
18
+ opts?: CarouselOptions
19
+ plugins?: CarouselPlugin
20
+ orientation?: "horizontal" | "vertical"
21
+ setApi?: (api: CarouselApi) => void
22
+ }
23
+
24
+ type CarouselContextProps = {
25
+ carouselRef: ReturnType<typeof useEmblaCarousel>[0]
26
+ api: CarouselApi
27
+ scrollPrev: () => void
28
+ scrollNext: () => void
29
+ canScrollPrev: boolean
30
+ canScrollNext: boolean
31
+ } & CarouselProps
32
+
33
+ const CarouselContext = React.createContext<CarouselContextProps | null>(null)
34
+
35
+ function useCarousel() {
36
+ const context = React.useContext(CarouselContext)
37
+
38
+ if (!context) {
39
+ throw new Error("useCarousel must be used within a <Carousel />")
40
+ }
41
+
42
+ return context
43
+ }
44
+
45
+ const Carousel = React.forwardRef<
46
+ HTMLDivElement,
47
+ React.HTMLAttributes<HTMLDivElement> & CarouselProps
48
+ >(
49
+ (
50
+ {
51
+ orientation = "horizontal",
52
+ opts,
53
+ setApi,
54
+ plugins,
55
+ className,
56
+ children,
57
+ ...props
58
+ },
59
+ ref
60
+ ) => {
61
+ const [carouselRef, api] = useEmblaCarousel(
62
+ {
63
+ ...opts,
64
+ axis: orientation === "horizontal" ? "x" : "y",
65
+ },
66
+ plugins
67
+ )
68
+ const [canScrollPrev, setCanScrollPrev] = React.useState(false)
69
+ const [canScrollNext, setCanScrollNext] = React.useState(false)
70
+
71
+ const onSelect = React.useCallback((api: CarouselApi) => {
72
+ if (!api) {
73
+ return
74
+ }
75
+
76
+ setCanScrollPrev(api.canScrollPrev())
77
+ setCanScrollNext(api.canScrollNext())
78
+ }, [])
79
+
80
+ const scrollPrev = React.useCallback(() => {
81
+ api?.scrollPrev()
82
+ }, [api])
83
+
84
+ const scrollNext = React.useCallback(() => {
85
+ api?.scrollNext()
86
+ }, [api])
87
+
88
+ const handleKeyDown = React.useCallback(
89
+ (event: React.KeyboardEvent<HTMLDivElement>) => {
90
+ if (event.key === "ArrowLeft") {
91
+ event.preventDefault()
92
+ scrollPrev()
93
+ } else if (event.key === "ArrowRight") {
94
+ event.preventDefault()
95
+ scrollNext()
96
+ }
97
+ },
98
+ [scrollPrev, scrollNext]
99
+ )
100
+
101
+ React.useEffect(() => {
102
+ if (!api || !setApi) {
103
+ return
104
+ }
105
+
106
+ setApi(api)
107
+ }, [api, setApi])
108
+
109
+ React.useEffect(() => {
110
+ if (!api) {
111
+ return
112
+ }
113
+
114
+ onSelect(api)
115
+ api.on("reInit", onSelect)
116
+ api.on("select", onSelect)
117
+
118
+ return () => {
119
+ api?.off("select", onSelect)
120
+ }
121
+ }, [api, onSelect])
122
+
123
+ return (
124
+ <CarouselContext.Provider
125
+ value={{
126
+ carouselRef,
127
+ api: api,
128
+ opts,
129
+ orientation: orientation || (opts?.axis === "y" ? "vertical" : "horizontal"),
130
+ scrollPrev,
131
+ scrollNext,
132
+ canScrollPrev,
133
+ canScrollNext,
134
+ }}
135
+ >
136
+ <div
137
+ ref={ref}
138
+ onKeyDown={handleKeyDown}
139
+ className={cn("relative w-[640px]", className)}
140
+ role="region"
141
+ aria-roledescription="carousel"
142
+ {...props}
143
+ >
144
+ {children}
145
+ </div>
146
+ </CarouselContext.Provider>
147
+ )
148
+ }
149
+ )
150
+ Carousel.displayName = "Carousel"
151
+
152
+ const CarouselContent = React.forwardRef<
153
+ HTMLDivElement,
154
+ React.HTMLAttributes<HTMLDivElement>
155
+ >(({ className, ...props }, ref) => {
156
+ const { carouselRef, orientation } = useCarousel()
157
+
158
+ return (
159
+ <div ref={carouselRef} className="overflow-hidden">
160
+ <div
161
+ ref={ref}
162
+ className={cn(
163
+ "flex",
164
+ orientation === "horizontal" ? "-ml-4" : "-mt-4 flex-col",
165
+ className
166
+ )}
167
+ {...props}
168
+ />
169
+ </div>
170
+ )
171
+ })
172
+ CarouselContent.displayName = "CarouselContent"
173
+
174
+ const CarouselItem = React.forwardRef<
175
+ HTMLDivElement,
176
+ React.HTMLAttributes<HTMLDivElement>
177
+ >(({ className, ...props }, ref) => {
178
+ const { orientation } = useCarousel()
179
+
180
+ return (
181
+ <div
182
+ ref={ref}
183
+ role="group"
184
+ aria-roledescription="slide"
185
+ className={cn(
186
+ "min-w-0 shrink-0 grow-0 basis-full",
187
+ orientation === "horizontal" ? "pl-4" : "pt-4",
188
+ className
189
+ )}
190
+ {...props}
191
+ />
192
+ )
193
+ })
194
+ CarouselItem.displayName = "CarouselItem"
195
+
196
+ const CarouselPrevious = React.forwardRef<
197
+ HTMLButtonElement,
198
+ React.ComponentProps<typeof Button>
199
+ >(({ className, variant = "outline", size = "icon", ...props }, ref) => {
200
+ const { orientation, scrollPrev, canScrollPrev } = useCarousel()
201
+
202
+ return (
203
+ <Button
204
+ ref={ref}
205
+ variant={variant}
206
+ size={size}
207
+ className={cn(
208
+ "absolute h-8 w-8 rounded-full",
209
+ orientation === "horizontal"
210
+ ? "-left-12 top-1/2 -translate-y-1/2"
211
+ : "-top-12 left-1/2 -translate-x-1/2 rotate-90",
212
+ className
213
+ )}
214
+ disabled={!canScrollPrev}
215
+ onClick={scrollPrev}
216
+ {...props}
217
+ >
218
+ <ArrowLeft className="h-4 w-4" />
219
+ <span className="sr-only">Previous slide</span>
220
+ </Button>
221
+ )
222
+ })
223
+ CarouselPrevious.displayName = "CarouselPrevious"
224
+
225
+ const CarouselNext = React.forwardRef<
226
+ HTMLButtonElement,
227
+ React.ComponentProps<typeof Button>
228
+ >(({ className, variant = "outline", size = "icon", ...props }, ref) => {
229
+ const { orientation, scrollNext, canScrollNext } = useCarousel()
230
+
231
+ return (
232
+ <Button
233
+ ref={ref}
234
+ variant={variant}
235
+ size={size}
236
+ className={cn(
237
+ "absolute h-8 w-8 rounded-full",
238
+ orientation === "horizontal"
239
+ ? "-right-12 top-1/2 -translate-y-1/2"
240
+ : "-bottom-12 left-1/2 -translate-x-1/2 rotate-90",
241
+ className
242
+ )}
243
+ disabled={!canScrollNext}
244
+ onClick={scrollNext}
245
+ {...props}
246
+ >
247
+ <ArrowRight className="h-4 w-4" />
248
+ <span className="sr-only">Next slide</span>
249
+ </Button>
250
+ )
251
+ })
252
+ CarouselNext.displayName = "CarouselNext"
253
+
254
+ export {
255
+ type CarouselApi,
256
+ Carousel,
257
+ CarouselContent,
258
+ CarouselItem,
259
+ CarouselPrevious,
260
+ CarouselNext,
261
+ }
@@ -0,0 +1,152 @@
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import { Command as CommandPrimitive } from "cmdk"
5
+ import * as DialogPrimitive from "@radix-ui/react-dialog"
6
+ import { Search } from "lucide-react"
7
+
8
+ import { cn } from "../../lib/utils"
9
+
10
+ const Command = React.forwardRef<
11
+ React.ElementRef<typeof CommandPrimitive>,
12
+ React.ComponentPropsWithoutRef<typeof CommandPrimitive>
13
+ >(({ className, ...props }, ref) => (
14
+ <CommandPrimitive
15
+ ref={ref}
16
+ className={cn(
17
+ "flex h-full w-[320px] w-full flex-col overflow-hidden rounded-md border bg-popover text-popover-foreground",
18
+ className
19
+ )}
20
+ {...props}
21
+ />
22
+ ))
23
+ Command.displayName = CommandPrimitive.displayName
24
+
25
+ const CommandDialog = ({ children, ...props }: React.ComponentProps<typeof CommandPrimitive.Dialog>) => {
26
+ return (
27
+ <CommandPrimitive.Dialog
28
+ {...props}
29
+ className={cn(
30
+ "fixed inset-0 z-50 flex items-start justify-center bg-overlay/80 p-4 pt-[10%]",
31
+ props.className
32
+ )}
33
+ >
34
+ <DialogPrimitive.Title className="hidden">Command Menu</DialogPrimitive.Title>
35
+ <div className="w-full max-w-lg overflow-hidden rounded-lg bg-popover text-popover-foreground shadow-lg">
36
+ {children}
37
+ </div>
38
+ </CommandPrimitive.Dialog>
39
+ )
40
+ }
41
+
42
+ const CommandInput = React.forwardRef<
43
+ React.ElementRef<typeof CommandPrimitive.Input>,
44
+ React.ComponentPropsWithoutRef<typeof CommandPrimitive.Input>
45
+ >(({ className, ...props }, ref) => (
46
+ <div className="flex items-center border-b px-3 py-2" cmdk-input-wrapper="">
47
+ <Search className="mr-2 h-4 w-4 shrink-0 opacity-50" />
48
+ <CommandPrimitive.Input
49
+ ref={ref}
50
+ className={cn(
51
+ "flex h-10 w-full rounded-md bg-transparent text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
52
+ className
53
+ )}
54
+ {...props}
55
+ />
56
+ </div>
57
+ ))
58
+ CommandInput.displayName = CommandPrimitive.Input.displayName
59
+
60
+ const CommandList = React.forwardRef<
61
+ React.ElementRef<typeof CommandPrimitive.List>,
62
+ React.ComponentPropsWithoutRef<typeof CommandPrimitive.List>
63
+ >(({ className, ...props }, ref) => (
64
+ <CommandPrimitive.List
65
+ ref={ref}
66
+ className={cn("max-h-[300px] overflow-y-auto overflow-x-hidden", className)}
67
+ {...props}
68
+ />
69
+ ))
70
+ CommandList.displayName = CommandPrimitive.List.displayName
71
+
72
+ const CommandEmpty = React.forwardRef<
73
+ React.ElementRef<typeof CommandPrimitive.Empty>,
74
+ React.ComponentPropsWithoutRef<typeof CommandPrimitive.Empty>
75
+ >((props, ref) => (
76
+ <CommandPrimitive.Empty
77
+ ref={ref}
78
+ className="py-6 text-center text-sm"
79
+ {...props}
80
+ />
81
+ ))
82
+ CommandEmpty.displayName = CommandPrimitive.Empty.displayName
83
+
84
+ const CommandGroup = React.forwardRef<
85
+ React.ElementRef<typeof CommandPrimitive.Group>,
86
+ React.ComponentPropsWithoutRef<typeof CommandPrimitive.Group>
87
+ >(({ className, ...props }, ref) => (
88
+ <CommandPrimitive.Group
89
+ ref={ref}
90
+ className={cn(
91
+ "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-semibold [&_[cmdk-group-heading]]:text-muted-foreground",
92
+ className
93
+ )}
94
+ {...props}
95
+ />
96
+ ))
97
+ CommandGroup.displayName = CommandPrimitive.Group.displayName
98
+
99
+ const CommandSeparator = React.forwardRef<
100
+ React.ElementRef<typeof CommandPrimitive.Separator>,
101
+ React.ComponentPropsWithoutRef<typeof CommandPrimitive.Separator>
102
+ >(({ className, ...props }, ref) => (
103
+ <CommandPrimitive.Separator
104
+ ref={ref}
105
+ className={cn("-mx-1 h-px bg-border", className)}
106
+ {...props}
107
+ />
108
+ ))
109
+ CommandSeparator.displayName = CommandPrimitive.Separator.displayName
110
+
111
+ const CommandItem = React.forwardRef<
112
+ React.ElementRef<typeof CommandPrimitive.Item>,
113
+ React.ComponentPropsWithoutRef<typeof CommandPrimitive.Item>
114
+ >(({ className, ...props }, ref) => (
115
+ <CommandPrimitive.Item
116
+ ref={ref}
117
+ className={cn(
118
+ "relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none aria-selected:bg-accent aria-selected:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
119
+ className
120
+ )}
121
+ {...props}
122
+ />
123
+ ))
124
+ CommandItem.displayName = CommandPrimitive.Item.displayName
125
+
126
+ const CommandShortcut = ({
127
+ className,
128
+ ...props
129
+ }: React.HTMLAttributes<HTMLSpanElement>) => {
130
+ return (
131
+ <span
132
+ className={cn(
133
+ "ml-auto text-xs tracking-widest text-muted-foreground",
134
+ className
135
+ )}
136
+ {...props}
137
+ />
138
+ )
139
+ }
140
+ CommandShortcut.displayName = "CommandShortcut"
141
+
142
+ export {
143
+ Command,
144
+ CommandDialog,
145
+ CommandInput,
146
+ CommandList,
147
+ CommandEmpty,
148
+ CommandGroup,
149
+ CommandItem,
150
+ CommandShortcut,
151
+ CommandSeparator,
152
+ }
@@ -0,0 +1,200 @@
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import * as ContextMenuPrimitive from "@radix-ui/react-context-menu"
5
+ import { Check, ChevronRight, Circle } from "lucide-react"
6
+
7
+ import { cn } from "../../lib/utils"
8
+
9
+ const ContextMenu = ContextMenuPrimitive.Root
10
+
11
+ const ContextMenuTrigger = ContextMenuPrimitive.Trigger
12
+
13
+ const ContextMenuGroup = ContextMenuPrimitive.Group
14
+
15
+ const ContextMenuPortal = ContextMenuPrimitive.Portal
16
+
17
+ const ContextMenuSub = ContextMenuPrimitive.Sub
18
+
19
+ const ContextMenuRadioGroup = ContextMenuPrimitive.RadioGroup
20
+
21
+ const ContextMenuSubTrigger = React.forwardRef<
22
+ React.ElementRef<typeof ContextMenuPrimitive.SubTrigger>,
23
+ React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubTrigger> & {
24
+ inset?: boolean
25
+ }
26
+ >(({ className, inset, children, ...props }, ref) => (
27
+ <ContextMenuPrimitive.SubTrigger
28
+ ref={ref}
29
+ className={cn(
30
+ "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",
31
+ inset && "pl-8",
32
+ className
33
+ )}
34
+ {...props}
35
+ >
36
+ {children}
37
+ <ChevronRight className="ml-auto h-4 w-4" />
38
+ </ContextMenuPrimitive.SubTrigger>
39
+ ))
40
+ ContextMenuSubTrigger.displayName = ContextMenuPrimitive.SubTrigger.displayName
41
+
42
+ const ContextMenuSubContent = React.forwardRef<
43
+ React.ElementRef<typeof ContextMenuPrimitive.SubContent>,
44
+ React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubContent>
45
+ >(({ className, ...props }, ref) => (
46
+ <ContextMenuPrimitive.SubContent
47
+ ref={ref}
48
+ className={cn(
49
+ "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",
50
+ className
51
+ )}
52
+ {...props}
53
+ />
54
+ ))
55
+ ContextMenuSubContent.displayName = ContextMenuPrimitive.SubContent.displayName
56
+
57
+ const ContextMenuContent = React.forwardRef<
58
+ React.ElementRef<typeof ContextMenuPrimitive.Content>,
59
+ React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Content>
60
+ >(({ className, ...props }, ref) => (
61
+ <ContextMenuPrimitive.Portal>
62
+ <ContextMenuPrimitive.Content
63
+ ref={ref}
64
+ className={cn(
65
+ "z-50 flex flex-col items-center w-[192px] min-w-[8rem] gap-0.5 overflow-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",
66
+ className
67
+ )}
68
+ {...props}
69
+ />
70
+ </ContextMenuPrimitive.Portal>
71
+ ))
72
+ ContextMenuContent.displayName = ContextMenuPrimitive.Content.displayName
73
+
74
+ const ContextMenuItem = React.forwardRef<
75
+ React.ElementRef<typeof ContextMenuPrimitive.Item>,
76
+ React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Item> & {
77
+ inset?: boolean
78
+ }
79
+ >(({ className, inset, ...props }, ref) => (
80
+ <ContextMenuPrimitive.Item
81
+ ref={ref}
82
+ className={cn(
83
+ "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",
84
+ inset && "pl-8",
85
+ className
86
+ )}
87
+ {...props}
88
+ />
89
+ ))
90
+ ContextMenuItem.displayName = ContextMenuPrimitive.Item.displayName
91
+
92
+ const ContextMenuCheckboxItem = React.forwardRef<
93
+ React.ElementRef<typeof ContextMenuPrimitive.CheckboxItem>,
94
+ React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.CheckboxItem>
95
+ >(({ className, children, checked, ...props }, ref) => (
96
+ <ContextMenuPrimitive.CheckboxItem
97
+ ref={ref}
98
+ className={cn(
99
+ "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",
100
+ className
101
+ )}
102
+ checked={checked}
103
+ {...props}
104
+ >
105
+ <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
106
+ <ContextMenuPrimitive.ItemIndicator>
107
+ <Check className="h-4 w-4" />
108
+ </ContextMenuPrimitive.ItemIndicator>
109
+ </span>
110
+ {children}
111
+ </ContextMenuPrimitive.CheckboxItem>
112
+ ))
113
+ ContextMenuCheckboxItem.displayName =
114
+ ContextMenuPrimitive.CheckboxItem.displayName
115
+
116
+ const ContextMenuRadioItem = React.forwardRef<
117
+ React.ElementRef<typeof ContextMenuPrimitive.RadioItem>,
118
+ React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.RadioItem>
119
+ >(({ className, children, ...props }, ref) => (
120
+ <ContextMenuPrimitive.RadioItem
121
+ ref={ref}
122
+ className={cn(
123
+ "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",
124
+ className
125
+ )}
126
+ {...props}
127
+ >
128
+ <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
129
+ <ContextMenuPrimitive.ItemIndicator>
130
+ <Circle className="h-2 w-2 fill-current" />
131
+ </ContextMenuPrimitive.ItemIndicator>
132
+ </span>
133
+ {children}
134
+ </ContextMenuPrimitive.RadioItem>
135
+ ))
136
+ ContextMenuRadioItem.displayName = ContextMenuPrimitive.RadioItem.displayName
137
+
138
+ const ContextMenuLabel = React.forwardRef<
139
+ React.ElementRef<typeof ContextMenuPrimitive.Label>,
140
+ React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Label> & {
141
+ inset?: boolean
142
+ }
143
+ >(({ className, inset, ...props }, ref) => (
144
+ <ContextMenuPrimitive.Label
145
+ ref={ref}
146
+ className={cn(
147
+ "px-2 py-1.5 text-sm font-semibold text-foreground",
148
+ inset && "pl-8",
149
+ className
150
+ )}
151
+ {...props}
152
+ />
153
+ ))
154
+ ContextMenuLabel.displayName = ContextMenuPrimitive.Label.displayName
155
+
156
+ const ContextMenuSeparator = React.forwardRef<
157
+ React.ElementRef<typeof ContextMenuPrimitive.Separator>,
158
+ React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Separator>
159
+ >(({ className, ...props }, ref) => (
160
+ <ContextMenuPrimitive.Separator
161
+ ref={ref}
162
+ className={cn("-mx-1 my-1 h-px bg-border", className)}
163
+ {...props}
164
+ />
165
+ ))
166
+ ContextMenuSeparator.displayName = ContextMenuPrimitive.Separator.displayName
167
+
168
+ const ContextMenuShortcut = ({
169
+ className,
170
+ ...props
171
+ }: React.HTMLAttributes<HTMLSpanElement>) => {
172
+ return (
173
+ <span
174
+ className={cn(
175
+ "ml-auto text-xs tracking-widest text-muted-foreground",
176
+ className
177
+ )}
178
+ {...props}
179
+ />
180
+ )
181
+ }
182
+ ContextMenuShortcut.displayName = "ContextMenuShortcut"
183
+
184
+ export {
185
+ ContextMenu,
186
+ ContextMenuTrigger,
187
+ ContextMenuContent,
188
+ ContextMenuItem,
189
+ ContextMenuCheckboxItem,
190
+ ContextMenuRadioItem,
191
+ ContextMenuLabel,
192
+ ContextMenuSeparator,
193
+ ContextMenuShortcut,
194
+ ContextMenuGroup,
195
+ ContextMenuPortal,
196
+ ContextMenuSub,
197
+ ContextMenuSubContent,
198
+ ContextMenuSubTrigger,
199
+ ContextMenuRadioGroup,
200
+ }