@inspirare/design-system 0.0.11 → 0.0.13

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.
@@ -0,0 +1,369 @@
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import * as RechartsPrimitive from "recharts"
5
+
6
+ import { cn } from "@/lib/utils"
7
+
8
+ // Format: { THEME_NAME: CSS_SELECTOR }
9
+ const THEMES = { light: "", dark: ".dark" } as const
10
+
11
+ export type ChartConfig = {
12
+ [k in string]: {
13
+ label?: React.ReactNode
14
+ icon?: React.ComponentType
15
+ } & (
16
+ | { color?: string; theme?: never }
17
+ | { color?: never; theme: Record<keyof typeof THEMES, string> }
18
+ )
19
+ }
20
+
21
+ type ChartContextProps = {
22
+ config: ChartConfig
23
+ }
24
+
25
+ const ChartContext = React.createContext<ChartContextProps | null>(null)
26
+
27
+ function useChart() {
28
+ const context = React.useContext(ChartContext)
29
+
30
+ if (!context) {
31
+ throw new Error("useChart must be used within a <ChartContainer />")
32
+ }
33
+
34
+ return context
35
+ }
36
+
37
+ const ChartContainer = React.forwardRef<
38
+ HTMLDivElement,
39
+ React.ComponentProps<"div"> & {
40
+ config: ChartConfig
41
+ children: React.ComponentProps<
42
+ typeof RechartsPrimitive.ResponsiveContainer
43
+ >["children"]
44
+ }
45
+ >(({ id, className, children, config, ...props }, ref) => {
46
+ const uniqueId = React.useId()
47
+ const chartId = `chart-${id || uniqueId.replace(/:/g, "")}`
48
+
49
+ return (
50
+ <ChartContext.Provider value={{ config }}>
51
+ <div
52
+ data-chart={chartId}
53
+ ref={ref}
54
+ className={cn(
55
+ "flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-none [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none",
56
+ className
57
+ )}
58
+ {...props}
59
+ >
60
+ <ChartStyle id={chartId} config={config} />
61
+ <RechartsPrimitive.ResponsiveContainer>
62
+ {children}
63
+ </RechartsPrimitive.ResponsiveContainer>
64
+ </div>
65
+ </ChartContext.Provider>
66
+ )
67
+ })
68
+ ChartContainer.displayName = "Chart"
69
+
70
+ const ChartStyle = ({ id, config }: { id: string; config: ChartConfig }) => {
71
+ const colorConfig = Object.entries(config).filter(
72
+ ([, config]) => config.theme || config.color
73
+ )
74
+
75
+ if (!colorConfig.length) {
76
+ return null
77
+ }
78
+
79
+ return (
80
+ <style
81
+ dangerouslySetInnerHTML={{
82
+ __html: Object.entries(THEMES)
83
+ .map(
84
+ ([theme, prefix]) => `
85
+ ${prefix} [data-chart=${id}] {
86
+ ${colorConfig
87
+ .map(([key, itemConfig]) => {
88
+ const color =
89
+ itemConfig.theme?.[theme as keyof typeof itemConfig.theme] ||
90
+ itemConfig.color
91
+ return color ? ` --color-${key}: ${color};` : null
92
+ })
93
+ .join("\n")}
94
+ }
95
+ `
96
+ )
97
+ .join("\n"),
98
+ }}
99
+ />
100
+ )
101
+ }
102
+
103
+ const ChartTooltip = RechartsPrimitive.Tooltip
104
+
105
+ const ChartTooltipContent = React.forwardRef<
106
+ HTMLDivElement,
107
+ React.ComponentProps<typeof RechartsPrimitive.Tooltip> &
108
+ React.ComponentProps<"div"> & {
109
+ hideLabel?: boolean
110
+ hideIndicator?: boolean
111
+ indicator?: "line" | "dot" | "dashed"
112
+ nameKey?: string
113
+ labelKey?: string
114
+ }
115
+ >(
116
+ (
117
+ {
118
+ active,
119
+ payload,
120
+ className,
121
+ indicator = "dot",
122
+ hideLabel = false,
123
+ hideIndicator = false,
124
+ label,
125
+ labelFormatter,
126
+ labelClassName,
127
+ formatter,
128
+ color,
129
+ nameKey,
130
+ labelKey,
131
+ },
132
+ ref
133
+ ) => {
134
+ const { config } = useChart()
135
+
136
+ const tooltipLabel = React.useMemo(() => {
137
+ if (hideLabel || !payload?.length) {
138
+ return null
139
+ }
140
+
141
+ const [item] = payload
142
+ const key = `${labelKey || item?.dataKey || item?.name || "value"}`
143
+ const itemConfig = getPayloadConfigFromPayload(config, item, key)
144
+ const value =
145
+ !labelKey && typeof label === "string"
146
+ ? config[label as keyof typeof config]?.label || label
147
+ : itemConfig?.label
148
+
149
+ if (labelFormatter) {
150
+ return (
151
+ <div className={cn("font-medium", labelClassName)}>
152
+ {labelFormatter(value, payload)}
153
+ </div>
154
+ )
155
+ }
156
+
157
+ if (!value) {
158
+ return null
159
+ }
160
+
161
+ return <div className={cn("font-medium", labelClassName)}>{value}</div>
162
+ }, [
163
+ label,
164
+ labelFormatter,
165
+ payload,
166
+ hideLabel,
167
+ labelClassName,
168
+ config,
169
+ labelKey,
170
+ ])
171
+
172
+ if (!active || !payload?.length) {
173
+ return null
174
+ }
175
+
176
+ const nestLabel = payload.length === 1 && indicator !== "dot"
177
+
178
+ return (
179
+ <div
180
+ ref={ref}
181
+ className={cn(
182
+ "grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl",
183
+ className
184
+ )}
185
+ >
186
+ {!nestLabel ? tooltipLabel : null}
187
+ <div className="grid gap-1.5">
188
+ {payload
189
+ .filter((item) => item.type !== "none")
190
+ .map((item, index) => {
191
+ const key = `${nameKey || item.name || item.dataKey || "value"}`
192
+ const itemConfig = getPayloadConfigFromPayload(config, item, key)
193
+ const indicatorColor = color || item.payload.fill || item.color
194
+
195
+ return (
196
+ <div
197
+ key={item.dataKey}
198
+ className={cn(
199
+ "flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground",
200
+ indicator === "dot" && "items-center"
201
+ )}
202
+ >
203
+ {formatter && item?.value !== undefined && item.name ? (
204
+ formatter(item.value, item.name, item, index, item.payload)
205
+ ) : (
206
+ <>
207
+ {itemConfig?.icon ? (
208
+ <itemConfig.icon />
209
+ ) : (
210
+ !hideIndicator && (
211
+ <div
212
+ className={cn(
213
+ "shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]",
214
+ {
215
+ "h-2.5 w-2.5": indicator === "dot",
216
+ "w-1": indicator === "line",
217
+ "w-0 border-[1.5px] border-dashed bg-transparent":
218
+ indicator === "dashed",
219
+ "my-0.5": nestLabel && indicator === "dashed",
220
+ }
221
+ )}
222
+ style={
223
+ {
224
+ "--color-bg": indicatorColor,
225
+ "--color-border": indicatorColor,
226
+ } as React.CSSProperties
227
+ }
228
+ />
229
+ )
230
+ )}
231
+ <div
232
+ className={cn(
233
+ "flex flex-1 justify-between leading-none",
234
+ nestLabel ? "items-end" : "items-center"
235
+ )}
236
+ >
237
+ <div className="grid gap-1.5">
238
+ {nestLabel ? tooltipLabel : null}
239
+ <span className="text-muted-foreground">
240
+ {itemConfig?.label || item.name}
241
+ </span>
242
+ </div>
243
+ {item.value && (
244
+ <span className="font-mono font-medium tabular-nums text-foreground">
245
+ {item.value.toLocaleString()}
246
+ </span>
247
+ )}
248
+ </div>
249
+ </>
250
+ )}
251
+ </div>
252
+ )
253
+ })}
254
+ </div>
255
+ </div>
256
+ )
257
+ }
258
+ )
259
+ ChartTooltipContent.displayName = "ChartTooltip"
260
+
261
+ const ChartLegend = RechartsPrimitive.Legend
262
+
263
+ const ChartLegendContent = React.forwardRef<
264
+ HTMLDivElement,
265
+ React.ComponentProps<"div"> &
266
+ Pick<RechartsPrimitive.LegendProps, "payload" | "verticalAlign"> & {
267
+ hideIcon?: boolean
268
+ nameKey?: string
269
+ }
270
+ >(
271
+ (
272
+ { className, hideIcon = false, payload, verticalAlign = "bottom", nameKey },
273
+ ref
274
+ ) => {
275
+ const { config } = useChart()
276
+
277
+ if (!payload?.length) {
278
+ return null
279
+ }
280
+
281
+ return (
282
+ <div
283
+ ref={ref}
284
+ className={cn(
285
+ "flex items-center justify-center gap-4",
286
+ verticalAlign === "top" ? "pb-3" : "pt-3",
287
+ className
288
+ )}
289
+ >
290
+ {payload
291
+ .filter((item) => item.type !== "none")
292
+ .map((item) => {
293
+ const key = `${nameKey || item.dataKey || "value"}`
294
+ const itemConfig = getPayloadConfigFromPayload(config, item, key)
295
+
296
+ return (
297
+ <div
298
+ key={item.value}
299
+ className={cn(
300
+ "flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"
301
+ )}
302
+ >
303
+ {itemConfig?.icon && !hideIcon ? (
304
+ <itemConfig.icon />
305
+ ) : (
306
+ <div
307
+ className="h-2 w-2 shrink-0 rounded-[2px]"
308
+ style={{
309
+ backgroundColor: item.color,
310
+ }}
311
+ />
312
+ )}
313
+ {itemConfig?.label}
314
+ </div>
315
+ )
316
+ })}
317
+ </div>
318
+ )
319
+ }
320
+ )
321
+ ChartLegendContent.displayName = "ChartLegend"
322
+
323
+ // Helper to extract item config from a payload.
324
+ function getPayloadConfigFromPayload(
325
+ config: ChartConfig,
326
+ payload: unknown,
327
+ key: string
328
+ ) {
329
+ if (typeof payload !== "object" || payload === null) {
330
+ return undefined
331
+ }
332
+
333
+ const payloadPayload =
334
+ "payload" in payload &&
335
+ typeof payload.payload === "object" &&
336
+ payload.payload !== null
337
+ ? payload.payload
338
+ : undefined
339
+
340
+ let configLabelKey: string = key
341
+
342
+ if (
343
+ key in payload &&
344
+ typeof payload[key as keyof typeof payload] === "string"
345
+ ) {
346
+ configLabelKey = payload[key as keyof typeof payload] as string
347
+ } else if (
348
+ payloadPayload &&
349
+ key in payloadPayload &&
350
+ typeof payloadPayload[key as keyof typeof payloadPayload] === "string"
351
+ ) {
352
+ configLabelKey = payloadPayload[
353
+ key as keyof typeof payloadPayload
354
+ ] as string
355
+ }
356
+
357
+ return configLabelKey in config
358
+ ? config[configLabelKey]
359
+ : config[key as keyof typeof config]
360
+ }
361
+
362
+ export {
363
+ ChartContainer,
364
+ ChartTooltip,
365
+ ChartTooltipContent,
366
+ ChartLegend,
367
+ ChartLegendContent,
368
+ ChartStyle,
369
+ }
@@ -0,0 +1,112 @@
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import { Check, ChevronsUpDown } from "lucide-react"
5
+
6
+ import { cn } from "@/lib/utils"
7
+ import { Button } from "@/components/ui/button"
8
+ import {
9
+ Command,
10
+ CommandEmpty,
11
+ CommandGroup,
12
+ CommandInput,
13
+ CommandItem,
14
+ CommandList,
15
+ } from "@/components/ui/command"
16
+ import {
17
+ Popover,
18
+ PopoverContent,
19
+ PopoverTrigger,
20
+ } from "@/components/ui/popover"
21
+
22
+ interface ComboboxOption {
23
+ value: string
24
+ label: string
25
+ }
26
+
27
+ interface ComboboxProps {
28
+ options: ComboboxOption[]
29
+ value?: string
30
+ onChange?: (value: string) => void
31
+ placeholder?: string
32
+ searchPlaceholder?: string
33
+ emptyMessage?: string
34
+ className?: string
35
+ buttonClassName?: string
36
+ contentClassName?: string
37
+ disabled?: boolean
38
+ }
39
+
40
+ export function Combobox({
41
+ options,
42
+ value,
43
+ onChange,
44
+ placeholder = "Select option...",
45
+ searchPlaceholder = "Search...",
46
+ emptyMessage = "No option found.",
47
+ className,
48
+ buttonClassName,
49
+ contentClassName,
50
+ disabled = false,
51
+ }: ComboboxProps) {
52
+ const [open, setOpen] = React.useState(false)
53
+
54
+ const selectedLabel = React.useMemo(
55
+ () => options.find((opt) => opt.value === value)?.label,
56
+ [options, value]
57
+ )
58
+
59
+ return (
60
+ <Popover open={open} onOpenChange={setOpen}>
61
+ <PopoverTrigger asChild>
62
+ <Button
63
+ variant="outline"
64
+ role="combobox"
65
+ aria-expanded={open}
66
+ disabled={disabled}
67
+ className={cn(
68
+ "w-full justify-between",
69
+ !value && "text-muted-foreground",
70
+ buttonClassName
71
+ )}
72
+ >
73
+ {selectedLabel || placeholder}
74
+ <ChevronsUpDown className="ml-2 h-4 w-4 shrink-0 opacity-50" />
75
+ </Button>
76
+ </PopoverTrigger>
77
+ <PopoverContent
78
+ className={cn("w-full p-0", contentClassName)}
79
+ align="start"
80
+ >
81
+ <Command className={className}>
82
+ <CommandInput placeholder={searchPlaceholder} />
83
+ <CommandList>
84
+ <CommandEmpty>{emptyMessage}</CommandEmpty>
85
+ <CommandGroup>
86
+ {options.map((option) => (
87
+ <CommandItem
88
+ key={option.value}
89
+ value={option.value}
90
+ onSelect={(currentValue) => {
91
+ onChange?.(
92
+ currentValue === value ? "" : currentValue
93
+ )
94
+ setOpen(false)
95
+ }}
96
+ >
97
+ <Check
98
+ className={cn(
99
+ "mr-2 h-4 w-4",
100
+ value === option.value ? "opacity-100" : "opacity-0"
101
+ )}
102
+ />
103
+ {option.label}
104
+ </CommandItem>
105
+ ))}
106
+ </CommandGroup>
107
+ </CommandList>
108
+ </Command>
109
+ </PopoverContent>
110
+ </Popover>
111
+ )
112
+ }
@@ -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-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]",
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 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]",
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
+ }