SPB Git

spb/vquant Public MIT

VibeQuant — AI-powered institutional-grade financial intelligence platform.

TypeScript 84.3% Python 11.7% JavaScript 1.6% CSS 1.5% HTML 0.7%
7.9 KB · 215 lines tsx
Raw Blame History
1/*2 * =============================================================================3 *  VibeQuant (vquant) — AI-Powered Financial Intelligence Platform4 * -----------------------------------------------------------------------------5 *  File:      client/src/components/ui/context-menu.tsx6 *7 *  Author:    Simon-Pierre Boucher8 *  Contact:   contact@spboucher.ai9 *  Website:   https://www.spboucher.ai10 *  Demo:      https://www.vquant.ai11 *  License:   MIT (see LICENSE)12 *13 *  Copyright © 2026 Simon-Pierre Boucher. All rights reserved.14 * =============================================================================15 */1617import * as React from "react"18import * as ContextMenuPrimitive from "@radix-ui/react-context-menu"19import { Check, ChevronRight, Circle } from "lucide-react"2021import { cn } from "@/lib/utils"2223const ContextMenu = ContextMenuPrimitive.Root2425const ContextMenuTrigger = ContextMenuPrimitive.Trigger2627const ContextMenuGroup = ContextMenuPrimitive.Group2829const ContextMenuPortal = ContextMenuPrimitive.Portal3031const ContextMenuSub = ContextMenuPrimitive.Sub3233const ContextMenuRadioGroup = ContextMenuPrimitive.RadioGroup3435const ContextMenuSubTrigger = React.forwardRef<36  React.ElementRef<typeof ContextMenuPrimitive.SubTrigger>,37  React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubTrigger> & {38    inset?: boolean39  }40>(({ className, inset, children, ...props }, ref) => (41  <ContextMenuPrimitive.SubTrigger42    ref={ref}43    className={cn(44      "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",45      inset && "pl-8",46      className47    )}48    {...props}49  >50    {children}51    <ChevronRight className="ml-auto h-4 w-4" />52  </ContextMenuPrimitive.SubTrigger>53))54ContextMenuSubTrigger.displayName = ContextMenuPrimitive.SubTrigger.displayName5556const ContextMenuSubContent = React.forwardRef<57  React.ElementRef<typeof ContextMenuPrimitive.SubContent>,58  React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubContent>59>(({ className, ...props }, ref) => (60  <ContextMenuPrimitive.SubContent61    ref={ref}62    className={cn(63      "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]",64      className65    )}66    {...props}67  />68))69ContextMenuSubContent.displayName = ContextMenuPrimitive.SubContent.displayName7071const ContextMenuContent = React.forwardRef<72  React.ElementRef<typeof ContextMenuPrimitive.Content>,73  React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Content>74>(({ className, ...props }, ref) => (75  <ContextMenuPrimitive.Portal>76    <ContextMenuPrimitive.Content77      ref={ref}78      className={cn(79        "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]",80        className81      )}82      {...props}83    />84  </ContextMenuPrimitive.Portal>85))86ContextMenuContent.displayName = ContextMenuPrimitive.Content.displayName8788const ContextMenuItem = React.forwardRef<89  React.ElementRef<typeof ContextMenuPrimitive.Item>,90  React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Item> & {91    inset?: boolean92  }93>(({ className, inset, ...props }, ref) => (94  <ContextMenuPrimitive.Item95    ref={ref}96    className={cn(97      "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",98      inset && "pl-8",99      className100    )}101    {...props}102  />103))104ContextMenuItem.displayName = ContextMenuPrimitive.Item.displayName105106const ContextMenuCheckboxItem = React.forwardRef<107  React.ElementRef<typeof ContextMenuPrimitive.CheckboxItem>,108  React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.CheckboxItem>109>(({ className, children, checked, ...props }, ref) => (110  <ContextMenuPrimitive.CheckboxItem111    ref={ref}112    className={cn(113      "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",114      className115    )}116    checked={checked}117    {...props}118  >119    <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">120      <ContextMenuPrimitive.ItemIndicator>121        <Check className="h-4 w-4" />122      </ContextMenuPrimitive.ItemIndicator>123    </span>124    {children}125  </ContextMenuPrimitive.CheckboxItem>126))127ContextMenuCheckboxItem.displayName =128  ContextMenuPrimitive.CheckboxItem.displayName129130const ContextMenuRadioItem = React.forwardRef<131  React.ElementRef<typeof ContextMenuPrimitive.RadioItem>,132  React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.RadioItem>133>(({ className, children, ...props }, ref) => (134  <ContextMenuPrimitive.RadioItem135    ref={ref}136    className={cn(137      "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",138      className139    )}140    {...props}141  >142    <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">143      <ContextMenuPrimitive.ItemIndicator>144        <Circle className="h-2 w-2 fill-current" />145      </ContextMenuPrimitive.ItemIndicator>146    </span>147    {children}148  </ContextMenuPrimitive.RadioItem>149))150ContextMenuRadioItem.displayName = ContextMenuPrimitive.RadioItem.displayName151152const ContextMenuLabel = React.forwardRef<153  React.ElementRef<typeof ContextMenuPrimitive.Label>,154  React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Label> & {155    inset?: boolean156  }157>(({ className, inset, ...props }, ref) => (158  <ContextMenuPrimitive.Label159    ref={ref}160    className={cn(161      "px-2 py-1.5 text-sm font-semibold text-foreground",162      inset && "pl-8",163      className164    )}165    {...props}166  />167))168ContextMenuLabel.displayName = ContextMenuPrimitive.Label.displayName169170const ContextMenuSeparator = React.forwardRef<171  React.ElementRef<typeof ContextMenuPrimitive.Separator>,172  React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Separator>173>(({ className, ...props }, ref) => (174  <ContextMenuPrimitive.Separator175    ref={ref}176    className={cn("-mx-1 my-1 h-px bg-border", className)}177    {...props}178  />179))180ContextMenuSeparator.displayName = ContextMenuPrimitive.Separator.displayName181182const ContextMenuShortcut = ({183  className,184  ...props185}: React.HTMLAttributes<HTMLSpanElement>) => {186  return (187    <span188      className={cn(189        "ml-auto text-xs tracking-widest text-muted-foreground",190        className191      )}192      {...props}193    />194  )195}196ContextMenuShortcut.displayName = "ContextMenuShortcut"197198export {199  ContextMenu,200  ContextMenuTrigger,201  ContextMenuContent,202  ContextMenuItem,203  ContextMenuCheckboxItem,204  ContextMenuRadioItem,205  ContextMenuLabel,206  ContextMenuSeparator,207  ContextMenuShortcut,208  ContextMenuGroup,209  ContextMenuPortal,210  ContextMenuSub,211  ContextMenuSubContent,212  ContextMenuSubTrigger,213  ContextMenuRadioGroup,214}215