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%
6.3 KB · 177 lines tsx
Raw Blame History
1/*2 * =============================================================================3 *  VibeQuant (vquant) — AI-Powered Financial Intelligence Platform4 * -----------------------------------------------------------------------------5 *  File:      client/src/components/ui/select.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 */1617"use client"1819import * as React from "react"20import * as SelectPrimitive from "@radix-ui/react-select"21import { Check, ChevronDown, ChevronUp } from "lucide-react"2223import { cn } from "@/lib/utils"2425const Select = SelectPrimitive.Root2627const SelectGroup = SelectPrimitive.Group2829const SelectValue = SelectPrimitive.Value3031const SelectTrigger = React.forwardRef<32  React.ElementRef<typeof SelectPrimitive.Trigger>,33  React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger>34>(({ className, children, ...props }, ref) => (35  <SelectPrimitive.Trigger36    ref={ref}37    className={cn(38      "flex h-9 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",39      className40    )}41    {...props}42  >43    {children}44    <SelectPrimitive.Icon asChild>45      <ChevronDown className="h-4 w-4 opacity-50" />46    </SelectPrimitive.Icon>47  </SelectPrimitive.Trigger>48))49SelectTrigger.displayName = SelectPrimitive.Trigger.displayName5051const SelectScrollUpButton = React.forwardRef<52  React.ElementRef<typeof SelectPrimitive.ScrollUpButton>,53  React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollUpButton>54>(({ className, ...props }, ref) => (55  <SelectPrimitive.ScrollUpButton56    ref={ref}57    className={cn(58      "flex cursor-default items-center justify-center py-1",59      className60    )}61    {...props}62  >63    <ChevronUp className="h-4 w-4" />64  </SelectPrimitive.ScrollUpButton>65))66SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName6768const SelectScrollDownButton = React.forwardRef<69  React.ElementRef<typeof SelectPrimitive.ScrollDownButton>,70  React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollDownButton>71>(({ className, ...props }, ref) => (72  <SelectPrimitive.ScrollDownButton73    ref={ref}74    className={cn(75      "flex cursor-default items-center justify-center py-1",76      className77    )}78    {...props}79  >80    <ChevronDown className="h-4 w-4" />81  </SelectPrimitive.ScrollDownButton>82))83SelectScrollDownButton.displayName =84  SelectPrimitive.ScrollDownButton.displayName8586const SelectContent = React.forwardRef<87  React.ElementRef<typeof SelectPrimitive.Content>,88  React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content>89>(({ className, children, position = "popper", ...props }, ref) => (90  <SelectPrimitive.Portal>91    <SelectPrimitive.Content92      ref={ref}93      className={cn(94        "relative z-50 max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover 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-select-content-transform-origin]",95        position === "popper" &&96          "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",97        className98      )}99      position={position}100      {...props}101    >102      <SelectScrollUpButton />103      <SelectPrimitive.Viewport104        className={cn(105          "p-1",106          position === "popper" &&107            "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"108        )}109      >110        {children}111      </SelectPrimitive.Viewport>112      <SelectScrollDownButton />113    </SelectPrimitive.Content>114  </SelectPrimitive.Portal>115))116SelectContent.displayName = SelectPrimitive.Content.displayName117118const SelectLabel = React.forwardRef<119  React.ElementRef<typeof SelectPrimitive.Label>,120  React.ComponentPropsWithoutRef<typeof SelectPrimitive.Label>121>(({ className, ...props }, ref) => (122  <SelectPrimitive.Label123    ref={ref}124    className={cn("py-1.5 pl-8 pr-2 text-sm font-semibold", className)}125    {...props}126  />127))128SelectLabel.displayName = SelectPrimitive.Label.displayName129130const SelectItem = React.forwardRef<131  React.ElementRef<typeof SelectPrimitive.Item>,132  React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item>133>(({ className, children, ...props }, ref) => (134  <SelectPrimitive.Item135    ref={ref}136    className={cn(137      "group relative flex w-full cursor-pointer select-none items-center rounded-lg py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent/70 hover:bg-accent/50 focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 transition-all duration-200",138      className139    )}140    {...props}141  >142    <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">143      <SelectPrimitive.ItemIndicator>144        <Check className="h-4 w-4 text-primary" />145      </SelectPrimitive.ItemIndicator>146    </span>147148    <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>149  </SelectPrimitive.Item>150))151SelectItem.displayName = SelectPrimitive.Item.displayName152153const SelectSeparator = React.forwardRef<154  React.ElementRef<typeof SelectPrimitive.Separator>,155  React.ComponentPropsWithoutRef<typeof SelectPrimitive.Separator>156>(({ className, ...props }, ref) => (157  <SelectPrimitive.Separator158    ref={ref}159    className={cn("-mx-1 my-1 h-px bg-muted", className)}160    {...props}161  />162))163SelectSeparator.displayName = SelectPrimitive.Separator.displayName164165export {166  Select,167  SelectGroup,168  SelectValue,169  SelectTrigger,170  SelectContent,171  SelectLabel,172  SelectItem,173  SelectSeparator,174  SelectScrollUpButton,175  SelectScrollDownButton,176}177