"use client"; import * as React from "react"; import { cn } from "./lib/utils"; export interface ModelOption { id: string; name: string; meta: string; } export interface ModelPickerProps extends Omit, "onChange"> { models?: ModelOption[]; value?: string; onChange?: (id: string) => void; } /** Compact model selector with popover list and mono meta readout. */ export function ModelPicker({ models = [ { id: "stub-1", name: "Stub One", meta: "FAST · 4K" }, { id: "stub-pro", name: "Stub Pro", meta: "SMART · 32K" }, { id: "stub-ultra", name: "Stub Ultra", meta: "MAX · 128K" }, ], value, onChange, className, ...props }: ModelPickerProps) { const [open, setOpen] = React.useState(false); const [inner, setInner] = React.useState(models[0]?.id ?? ""); const selected = models.find((m) => m.id === (value ?? inner)); const pick = (id: string) => { setInner(id); onChange?.(id); setOpen(false); }; return (
{open && ( )}
); }