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%
2.3 KB · 78 lines tsx
Raw Blame History
1/*2 * =============================================================================3 *  VibeQuant (vquant) — AI-Powered Financial Intelligence Platform4 * -----------------------------------------------------------------------------5 *  File:      client/src/components/ui/toggle-group.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 ToggleGroupPrimitive from "@radix-ui/react-toggle-group"21import { type VariantProps } from "class-variance-authority"2223import { cn } from "@/lib/utils"24import { toggleVariants } from "@/components/ui/toggle"2526const ToggleGroupContext = React.createContext<27  VariantProps<typeof toggleVariants>28>({29  size: "default",30  variant: "default",31})3233const ToggleGroup = React.forwardRef<34  React.ElementRef<typeof ToggleGroupPrimitive.Root>,35  React.ComponentPropsWithoutRef<typeof ToggleGroupPrimitive.Root> &36    VariantProps<typeof toggleVariants>37>(({ className, variant, size, children, ...props }, ref) => (38  <ToggleGroupPrimitive.Root39    ref={ref}40    className={cn("flex items-center justify-center gap-1", className)}41    {...props}42  >43    <ToggleGroupContext.Provider value={{ variant, size }}>44      {children}45    </ToggleGroupContext.Provider>46  </ToggleGroupPrimitive.Root>47))4849ToggleGroup.displayName = ToggleGroupPrimitive.Root.displayName5051const ToggleGroupItem = React.forwardRef<52  React.ElementRef<typeof ToggleGroupPrimitive.Item>,53  React.ComponentPropsWithoutRef<typeof ToggleGroupPrimitive.Item> &54    VariantProps<typeof toggleVariants>55>(({ className, children, variant, size, ...props }, ref) => {56  const context = React.useContext(ToggleGroupContext)5758  return (59    <ToggleGroupPrimitive.Item60      ref={ref}61      className={cn(62        toggleVariants({63          variant: context.variant || variant,64          size: context.size || size,65        }),66        className67      )}68      {...props}69    >70      {children}71    </ToggleGroupPrimitive.Item>72  )73})7475ToggleGroupItem.displayName = ToggleGroupPrimitive.Item.displayName7677export { ToggleGroup, ToggleGroupItem }78