import { OpenGeniApiError } from "@opengeni/sdk"; import { AlertTriangleIcon, ArrowLeftIcon, ChevronDownIcon, FileIcon, FilePenLineIcon, GalleryHorizontalEndIcon, ImageIcon, Loader2Icon, PanelsTopLeftIcon, RotateCcwIcon, Table2Icon, XIcon, } from "lucide-react"; import { createContext, forwardRef, useContext, useMemo, type ComponentProps, type ReactNode, } from "react"; import { cn } from "../../lib/cn"; import { useOpenGeniText, type OpenGeniText } from "../../messages/runtime"; /** * Shared chrome for artifact surfaces: the Opengeni console and embedding hosts * render the same header, controls, and load states. Class names use the * package theme aliases, so the console's own Tailwind build and the compiled * `.og-root` stylesheet resolve them identically. */ export type ArtifactKind = "document" | "spreadsheet" | "presentation" | "site" | "image" | "file"; const BUTTON_BASE = "inline-flex shrink-0 cursor-pointer items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-all outline-hidden focus-visible:ring-2 focus-visible:ring-ring/40 focus-visible:ring-offset-2 focus-visible:ring-offset-bg disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4"; const BUTTON_VARIANT = { ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50", outline: "border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:border-border dark:bg-input/30 dark:hover:bg-input/50", } as const; const BUTTON_SIZE = { sm: "h-8 gap-1.5 rounded-md px-3 has-[>svg]:px-2.5", icon: "size-9", "icon-sm": "size-8", } as const; export function ArtifactButton({ variant = "ghost", size = "sm", className, type = "button", ...props }: ComponentProps<"button"> & { variant?: keyof typeof BUTTON_VARIANT; size?: keyof typeof BUTTON_SIZE; }) { return (