import * as React from "react"; import { cn } from "~/lib/utils"; import { Button } from "./button"; import { Tabs as TabsComponent, TabsList, TabsTrigger } from "./tabs"; import { ButtonGroup as SubframeButtonGroup } from "~/ui/components/ButtonGroup"; import { Fragment, useState } from "react"; import { Link } from "react-router"; import HintTooltip from "./tooltips/HintTooltip"; interface ButtonGroupProps { items: { name: string; href?: string; target?: string; component?: React.ReactNode; hidden?: boolean; onClick?: () => void; active?: boolean; disabled?: boolean; }[]; variant?: "default" | "tabs"; size?: "xs" | "sm" | "default" | "lg"; className?: string; } export function ButtonGroup({ items, variant = "tabs", size = "sm", className }: ButtonGroupProps) { let activeItems = items.filter((item) => !item.hidden); const [value, setValue] = useState(activeItems.find((item) => item.active)?.name || (activeItems.length > 0 ? activeItems[0].name : "")); if (variant === "tabs") { return ( setValue(v)} className={cn(className)}> {activeItems.map((item) => item.href ? ( {item.component || item.name} ) : ( {item.component || item.name} ) )} ); } return ( // Subframe ButtonGroup `variant="split"` (gap-0) is the design-system container for the // connected-button row. The original `isolate inline-flex rounded-md` look + width sizing // are restored via className (neutralizing Subframe's `w-full`); per-button border/radius // math stays on the buttons, unchanged. {activeItems.map((item, idx) => ( ))} ); }