import { FormControl, InputLabel, MenuItem, Select, Typography, } from "@mui/material"; import { TextInput } from "./TextInput"; export interface SelectOption { value?: string; label?: string; description?: string; } export function SelectInput(p: { value?: string; editable: boolean; label?: string; options: SelectOption[]; onValueChange: (o?: string) => void; }): React.ReactElement { if (!p.editable && !p.value) return <>>; if (!p.editable) { const value = p.options.find((o) => o.value === p.value)?.label ?? p.value; return ; } return ( {p.label && {p.label}} p.onValueChange(e.target.value)} > {p.options.map((e) => ( {e.label ?? e.value} {e.description && ( {e.description} )} ))} ); }