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%
5.3 KB · 144 lines tsx
Raw Blame History
1/*2 * =============================================================================3 *  VibeQuant (vquant) — AI-Powered Financial Intelligence Platform4 * -----------------------------------------------------------------------------5 *  File:      client/src/components/ui/toast.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 ToastPrimitives from "@radix-ui/react-toast"19import { cva, type VariantProps } from "class-variance-authority"20import { X } from "lucide-react"2122import { cn } from "@/lib/utils"2324const ToastProvider = ToastPrimitives.Provider2526const ToastViewport = React.forwardRef<27  React.ElementRef<typeof ToastPrimitives.Viewport>,28  React.ComponentPropsWithoutRef<typeof ToastPrimitives.Viewport>29>(({ className, ...props }, ref) => (30  <ToastPrimitives.Viewport31    ref={ref}32    className={cn(33      "fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",34      className35    )}36    {...props}37  />38))39ToastViewport.displayName = ToastPrimitives.Viewport.displayName4041const toastVariants = cva(42  "group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",43  {44    variants: {45      variant: {46        default: "border bg-background text-foreground",47        destructive:48          "destructive group border-destructive bg-destructive text-destructive-foreground",49      },50    },51    defaultVariants: {52      variant: "default",53    },54  }55)5657const Toast = React.forwardRef<58  React.ElementRef<typeof ToastPrimitives.Root>,59  React.ComponentPropsWithoutRef<typeof ToastPrimitives.Root> &60    VariantProps<typeof toastVariants>61>(({ className, variant, ...props }, ref) => {62  return (63    <ToastPrimitives.Root64      ref={ref}65      className={cn(toastVariants({ variant }), className)}66      {...props}67    />68  )69})70Toast.displayName = ToastPrimitives.Root.displayName7172const ToastAction = React.forwardRef<73  React.ElementRef<typeof ToastPrimitives.Action>,74  React.ComponentPropsWithoutRef<typeof ToastPrimitives.Action>75>(({ className, ...props }, ref) => (76  <ToastPrimitives.Action77    ref={ref}78    className={cn(79      "inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",80      className81    )}82    {...props}83  />84))85ToastAction.displayName = ToastPrimitives.Action.displayName8687const ToastClose = React.forwardRef<88  React.ElementRef<typeof ToastPrimitives.Close>,89  React.ComponentPropsWithoutRef<typeof ToastPrimitives.Close>90>(({ className, ...props }, ref) => (91  <ToastPrimitives.Close92    ref={ref}93    className={cn(94      "absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",95      className96    )}97    toast-close=""98    {...props}99  >100    <X className="h-4 w-4" />101  </ToastPrimitives.Close>102))103ToastClose.displayName = ToastPrimitives.Close.displayName104105const ToastTitle = React.forwardRef<106  React.ElementRef<typeof ToastPrimitives.Title>,107  React.ComponentPropsWithoutRef<typeof ToastPrimitives.Title>108>(({ className, ...props }, ref) => (109  <ToastPrimitives.Title110    ref={ref}111    className={cn("text-sm font-semibold", className)}112    {...props}113  />114))115ToastTitle.displayName = ToastPrimitives.Title.displayName116117const ToastDescription = React.forwardRef<118  React.ElementRef<typeof ToastPrimitives.Description>,119  React.ComponentPropsWithoutRef<typeof ToastPrimitives.Description>120>(({ className, ...props }, ref) => (121  <ToastPrimitives.Description122    ref={ref}123    className={cn("text-sm opacity-90", className)}124    {...props}125  />126))127ToastDescription.displayName = ToastPrimitives.Description.displayName128129type ToastProps = React.ComponentPropsWithoutRef<typeof Toast>130131type ToastActionElement = React.ReactElement<typeof ToastAction>132133export {134  type ToastProps,135  type ToastActionElement,136  ToastProvider,137  ToastViewport,138  Toast,139  ToastTitle,140  ToastDescription,141  ToastClose,142  ToastAction,143}144